Jump to content

What is bad ?


iFoReX

Recommended Posts

Posted

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 
  

Posted
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) 

Posted
appear rango : -, Zombie Kills : -

how you are call function lol ?

or it call his self? :roll:

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 
  

Posted
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) 

Posted
mmm I need trigger it ?

it won't trigger itself, you need to use event or whatever to trigger the function.

Posted
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) 
  

?

Posted

@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.

Posted

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) 
  

?

Posted
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.

Posted

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) 

Posted
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) 

Posted

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) 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...