iFoReX Posted July 18, 2012 Posted July 18, 2012 0 problem in debugscript 3, and appear : Rango : nil, Zombie Kills : nil cl-side function hideIt(zKills,Rank) local x,y,z = getElementPosition(getLocalPlayer()) local city = getZoneName(x,y,z,true) dxDrawText("Ciudad : "..city,0.0,420.0,171.0,449.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Vida : "..getElementHealth(getLocalPlayer()),595.0,548.0,642.0,566.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Rango : "..tostring(Rank),536.0,499.0,656.0,516.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Zombie Kills :"..tostring(zKills),537.0,517.0,657.0,534.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) end addEventHandler("onClientRender",root,hideIt) addEvent("lolEvent",true) addEventHandler("lolEvent",root,hideIt) sv-side function lol(thePlayer) local account = getPlayerAccount(thePlayer) local zKills = getAccountData(account,"Zombie kills") local Rank = getAccountData(account,"Rango") triggerClientEvent("lolEvent",zKills,Rank) end
TAPL Posted July 18, 2012 Posted July 18, 2012 zKills = "-" Rank = "-" function hideIt(Kills,Ranks) zKills = Kills Rank = Ranks end addEvent("lolEvent",true) addEventHandler("lolEvent",root,hideIt) function draw() local x,y,z = getElementPosition(getLocalPlayer()) local city = getZoneName(x,y,z,true) dxDrawText("Ciudad : "..city,0.0,420.0,171.0,449.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Vida : "..getElementHealth(getLocalPlayer()),595.0,548.0,642.0,566.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Rango : "..tostring(Rank),536.0,499.0,656.0,516.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Zombie Kills :"..tostring(zKills),537.0,517.0,657.0,534.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) end addEventHandler("onClientRender",root,draw)
TAPL Posted July 18, 2012 Posted July 18, 2012 appear rango : -, Zombie Kills : - how you are call function lol ? or it call his self? also you trigger for who? function lol(thePlayer) local account = getPlayerAccount(thePlayer) local zKills = getAccountData(account,"Zombie kills") local Rank = getAccountData(account,"Rango") triggerClientEvent(thePlayer,"lolEvent",thePlayer,zKills,Rank) end
iFoReX Posted July 18, 2012 Author Posted July 18, 2012 I triggered for send accounts data, doesnt work TAPL : Rango : -, Zombie Kills : -
TAPL Posted July 18, 2012 Posted July 18, 2012 I triggered for send accounts data, doesnt work TAPL : Rango : -, Zombie Kills : - doesn't work? did you try with last code i post? this triggerClientEvent("lolEvent",zKills,Rank) should be triggerClientEvent(thePlayer,"lolEvent",thePlayer,zKills,Rank)
TAPL Posted July 18, 2012 Posted July 18, 2012 Yeh I copied ur last post, doesnt work TAPL ok, how is function lol get triggered/called?
TAPL Posted July 18, 2012 Posted July 18, 2012 mmm I need trigger it ? it won't trigger itself, you need to use event or whatever to trigger the function.
iFoReX Posted July 18, 2012 Author Posted July 18, 2012 function lol(thePlayer) local account = getPlayerAccount(thePlayer) local zKills = getAccountData(account,"Zombie kills") local Rank = getAccountData(account,"Rango") triggerClientEvent(thePlayer,"lolEvent",thePlayer,zKills,Rank) end addEventHandler("onResourceStart",resourceRoot,lol) ?
Castillo Posted July 18, 2012 Posted July 18, 2012 @ElMota: When will you read fully about how event system and events work? 'onResourceStart' has no player argument, as is a resource what starts, not a player. I've explained you this many times, I don't know why you still do these mistakes.
iFoReX Posted July 18, 2012 Author Posted July 18, 2012 Ok, function lol(thePlayer) local account = getPlayerAccount(thePlayer) local zKills = getAccountData(account,"Zombie kills") local Rank = getAccountData(account,"Rango") setElementData(account,"zombieK",zKills) setElementData(account,"Rango",zKills) end addEventHandler("onPlayerJoin",root,lol) ?
TAPL Posted July 18, 2012 Posted July 18, 2012 when the player join he aren't logged. and still line 2 wrong you should use source.
TAPL Posted July 18, 2012 Posted July 18, 2012 onPlayerLogin Event ? well, using onPlayerLogin will make for you problem the problem Rango and Zombie Kills won't be updated. try to use event when you kill zombie and event onPlayerLogin, it's will be better.
iFoReX Posted July 18, 2012 Author Posted July 18, 2012 mmm if I try with timer ? bad argument lines : 2,3,4,5,6 function lol() local account = getPlayerAccount(source) local zKills = getAccountData(account,"Zombie kills") local Rank = getAccountData(account,"Rango") setElementData(account,"zombieK",zKills) setElementData(account,"Rango",zKills) end setTimer(lol,1000,0)
TAPL Posted July 18, 2012 Posted July 18, 2012 function onZombieWasted(_,killer) if (killer) then if (getElementType(killer) == "player") and (getElementType(source) == "ped") then if (getElementData(source, "zombie") == true) then local account = getPlayerAccount(killer) if account and not isGuestAccount(account) then local zKills = getAccountData(account,"Zombie kills") local Rank = getAccountData(account,"Rango") setElementData(killer,"zombieK",zKills) setElementData(killer,"Rango",Rank) end end end end end addEventHandler("onPedWasted", root, onZombieWasted)
iFoReX Posted July 18, 2012 Author Posted July 18, 2012 now Work I put a triggerClientEvent, thank you c: u are the better
iFoReX Posted July 18, 2012 Author Posted July 18, 2012 tapl when a player kill to zombie set to me ur rank and ur zombie kills
TwiX! Posted July 18, 2012 Posted July 18, 2012 tapl when a player kill to zombie set to me ur rank and ur zombie kills show your all code with server/client
iFoReX Posted July 18, 2012 Author Posted July 18, 2012 client-side zKills = "-" Rank = "-" function hideIt(Kills,Ranks) zKills = Kills Rank = Ranks end addEvent("lolEvent",true) addEventHandler("lolEvent",root,hideIt) function draw() local x,y,z = getElementPosition(getLocalPlayer()) local city = getZoneName(x,y,z,true) dxDrawText("Ciudad : "..city,0.0,420.0,171.0,449.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Vida : "..getElementHealth(getLocalPlayer()),595.0,548.0,642.0,566.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Rango : "..tostring(Rank),536.0,499.0,656.0,516.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Zombie Kills :"..tostring(zKills),537.0,517.0,657.0,534.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) end addEventHandler("onClientRender",root,draw) sv.side function onZombieWasted(_,killer) if (killer) then if (getElementType(killer) == "player") and (getElementType(source) == "ped") then if (getElementData(source, "zombie") == true) then local account = getPlayerAccount(killer) if account and not isGuestAccount(account) then local Kills = getAccountData(account,"Zombie kills") local Ranks = getAccountData(account,"Rango") triggerClientEvent("lolEvent",killer,Kills,Ranks) end end end end end addEventHandler("onPedWasted", root, onZombieWasted)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now