Jump to content

Trigger? Or not? I don't know!


Rat32

Recommended Posts

Posted

Hey!

serverside:

function nadajkolory() 
kontod = getPlayerAccount(source) 
r = setAccountData(kontod, "kolor", 56) 
g = setAccountData(kontod, "kolor2", 24) 
b = setAccountData(kontod, "kolor3", 67) 
a = getAccountData(kontod, "kolor") 
b = getAccountData(kontod, "kolor2") 
c = getAccountData(kontod, "kolor3") 
triggerClientEvent(source, "kolorely", resourceRoot, a,b,c) 
end 
addEventHandler("onPlayerLogin", getRootElement(), nadajkolory) 
  

client:

function dajkolor(a, b, c) 
setVehicleColor(kar, tonumber(a)..","..tonumber(b)..","..tonumber(c)) 
outputChatBox(a..","..b..","..c) 
end 
addEventHandler("kolorely", getRootElement(), dajkolor) 
  

In debugstring i have "Incorret numbers, but outputChatBox say good: "x, x, x". Any help?

Posted
function nadajkolory(_,cur) 
    local r,g,b = 56 , 24 , 67 
    local a,b,c = setAccountData(cur, "kolor", r),setAccountData(cur, "kolor2", g),setAccountData(cur, "kolor3", b) 
    triggerClientEvent(source, "kolorely", source, r,g,b) 
end 
addEventHandler("onPlayerLogin", getRootElement(), nadajkolory) 
  
function dajkolor(a, b, c) 
    setVehicleColor(kar, tonumber(a)..","..tonumber(b)..","..tonumber(c)) 
    outputChatBox(a..","..b..","..c) 
end 
addEvent("kolorely",true) 
addEventHandler("kolorely", root, dajkolor) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

  • Moderators
Posted

Don't ask me why it gives that error, since it should not give you that one on that line...

Yet, this is/was your problem:

setVehicleColor(kar, tonumber(a) or 0,tonumber(b) or 0,tonumber(c) or 0) 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

Then you got the wrong line. Something wrong with your text editor?

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted
"atempt to concetante a nil value"

=

"what ever" .. nil

setVehicleColor(kar, tonumber(a) or 0,tonumber(b) or 0,tonumber(c) or 0) 

Do you see here .. ?????? I don't think so...

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

b = setAccountData(kontod, "kolor3", 67)

[...]

b = getAccountData(kontod, "kolor2")

You're overwriting 'b' variable ;d

Posted

client

addEvent("kolorely", true); 
function dajkolor(a, b, c) 
setVehicleColor(getPedOccupiedVehicle(localPlayer), a,b,c); 
outputChatBox(a..","..b..","..c); 
end 
addEventHandler("kolorely", getRootElement(), dajkolor) 

server

function nadajkolory(_, kontod) 
    if kontod then 
        r = setAccountData(kontod, "kolor", 56); 
        g = setAccountData(kontod, "kolor2", 24); 
        b = setAccountData(kontod, "kolor3", 67); 
        a = getAccountData(kontod, "kolor"); 
        b = getAccountData(kontod, "kolor2"); 
        c = getAccountData(kontod, "kolor3"); 
        if ( tonumber(a) and tonumber(b) and tonumber(c) ) then 
        triggerClientEvent(source, "kolorely", resourceRoot, a,b,c); 
        end 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), nadajkolory) 

Inactivo.

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