Wysłany: 2016-07-11, 18:22
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Witam, robi? frakcj? Venturas News lecz mam taki pewien problem, gdy wpisz? /vnews <text> wywala mi db3:
Kod:
C - SIDE :
local screenW , screenH = guiGetScreenSize ()
addEvent ( "oglos" , true )
addEventHandler ( "oglos" , root ,
function ( reason )
addEventHandler ( "onClientRender" , root , info )
end
)
function info ( reason )
dxDrawText ( "" .. reason .. "" , screenW * 0.3536 , screenH * 0.0111 , screenW * 0.6391 , screenH * 0.0648 , tocolor ( 255 , 254 , 254 , 254 ), 1.20 , "default-bold" , "center" , "top" , false , false , true , false , false )
end
function infor ()
removeEventHandler ( "onClientRender" , root , info )
end
setTimer ( infor , 15000 , 1 )
S - SIDE :
local pojazdy = {
{ 983.91 , 1720.12 , 8.71 , 360 , 0 , 90 },
{ 983.91 , 1725.12 , 8.71 , 360 , 0 , 90 },
{ 983.91 , 1730.12 , 8.71 , 360 , 0 , 90 },
{ 983.91 , 1735.12 , 8.71 , 360 , 0 , 90 },
{ 983.91 , 1740.12 , 8.71 , 360 , 0 , 90 },
}
for i , v in ipairs ( pojazdy ) do
local v = createVehicle ( 582 , v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ])
setElementData ( v , "pojazd_opis" , "Venturas News" )
setElementData ( v , "pojazd_paliwo" , 100 )
setVehicleFrozen ( v , true )
end
addEventHandler ( "onVehicleStartEnter" , resourceRoot ,
function ( player )
local acc = getAccountName ( getPlayerAccount ( player ))
if not isObjectInACLGroup ( "user." .. acc , aclGetGroup ( "LVNews" )) then
cancelEvent ( true )
outputChatBox ( "Nie jeste? pracownikiem Las Venturas News!" , player )
else return
end
end
)
addCommandHandler ( "vnews" ,
function ( player , cmd , reason , ...)
local acc = getAccountName ( getPlayerAccount ( player ))
if isObjectInACLGroup ( "user." .. acc , aclGetGroup ( "LVNews" )) then
local reason = table . concat ( {...}, "" )
triggerClientEvent ( getRootElement (), "oglos" , root , "reason" )
else
outputChatBox ( "Nie jeste? pracownikiem Las Venturas News!" , player )
end
end
)
Za pomoc
Wysłany: 2016-07-11, 18:25
AteX
Wiek: 26 Na forum: 4015 dni Posty: 927
Nick w MP: #AteX
Piwa : 8360
Sk?d funkcja info pobiera argument reason? Z tego co widz? to znik?d. W evencie oglos dodaj zmienn? "x" do kt?rej przypiszesz ten reason i w dxDrawText wy?wietl ten "x".
Wysłany: 2016-07-11, 18:46
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Mo?esz pokaza? przyk?ad? Bo niezbyt rozumiem.
Wysłany: 2016-07-11, 18:48
AteX
Wiek: 26 Na forum: 4015 dni Posty: 927
Nick w MP: #AteX
Piwa : 8360
local screenW , screenH = guiGetScreenSize ()
addEvent ( "oglos" , true )
addEventHandler ( "oglos" , root ,
function ( reason )
x = reason
addEventHandler ( "onClientRender" , root , info )
end
)
function info ()
dxDrawText ( "" .. x .. "" , screenW * 0.3536 , screenH * 0.0111 , screenW * 0.6391 , screenH * 0.0648 , tocolor ( 255 , 254 , 254 , 254 ), 1.20 , "default-bold" , "center" , "top" , false , false , true , false , false )
end
function infor ()
removeEventHandler ( "onClientRender" , root , info )
end
setTimer ( infor , 15000 , 1 )
Wysłany: 2016-07-11, 18:57
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Tak my?la?em ?eby to zrobi?, ale nie by?em przekonany.
Wysłany: 2016-07-11, 18:58
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Tylko, ?e zamiast wpisanego tekstu wy?wietla si? "reason".
Wysłany: 2016-07-11, 19:01
AteX
Wiek: 26 Na forum: 4015 dni Posty: 927
Nick w MP: #AteX
Piwa : 8360
Dlatego, ?e triggerujesz tekst "reason", a nie zmienn? reason.
Wysłany: 2016-07-11, 19:19
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Nie wiem jak mam to zrobi?
Wysłany: 2016-07-11, 19:36
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
triggerClientEvent ( getRootElement (), "oglos" , root , reason )
Wysłany: 2016-07-11, 19:40
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Ok tylko, ?e teraz nie pokazuje pierwszego wyrazu a potem pokazuje all ale bez spacji
np: /vnews elo test skryptu
pokazuje: testskryptu
Wysłany: 2016-07-11, 19:44
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
local reason = table . concat ( { ... }, " " )
Wysłany: 2016-07-11, 19:49
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Wysłany: 2016-07-11, 19:51
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Przypatrz si?, ?e nie dok?adnie. Sprawd? i przetestuj.
Wysłany: 2016-07-11, 19:51
BlackTen
LUA Dev.
Wiek: 28 Na forum: 4329 dni Posty: 698
Piwa : 2080
Da?em twoje i nie dzia?a.
Wysłany: 2016-07-11, 22:31
dudeks
Wiek: 31 Na forum: 6576 dni Posty: 171
Piwa : 89
function ( player , cmd , reason , ...)
usun tu reason
Tagi: venturas :: news
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: