Jump to content

setElementData


drk

Recommended Posts

Posted

Hi ! I'm coding an pointing and money system for my clan server.

I want that code add + 1500$ for player.

The code is:

                        setElementData ( player, "Dinheiro" ) -1500 ) 

It have a error, the symbol - is not recognized. How I can do this ?

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

You Mean Like This ?

function M () 
local Evil-Cod3r = givePlayerMoney( 1500 ) 
setElementData ( source, "Dinheiro", Evil-Cod3r ) 
end 
addEventHandler( "onClientResourceStart", getRootElement( ), M) 
  

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

No, I want to set money to the Data "Dinheiro", not for the player like normal GTA:SA.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted
function Me ( thePlayer, command ) 
      setElementData ( thePlayer, "Dinheiro" , +1500 ) 
end 
addCommandHandler ( "give", Me ) 

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

It is was I've writed before. I've tested on SciTE debugging mode and don't work. I will try on the server.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

you mean my code dont work or what ?

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

it doesnt work like that Evil-Cod3r

    function Me ( thePlayer, command ) 
  
          setElementData ( thePlayer, "Dinheiro" , getElementData(thePlayer, "Dinheiro")+1500 ) 
    end 
    addCommandHandler ( "give", Me ) 

Posted

Thanks BinSlayer1, don't appear any error now. I'll test.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

oh i was thinking does it need getElementData or not i think he need :)

Thx BinSlayer1 :)

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

Hi ! the script dont appear any error but don't work. :S

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

Try this then

function save () 
    local M = getElementData(source,"Dinheiro") 
    setElementData(source,"Dinheiro",M+1500) 
end 
addEventHandler("onPlayerJoin",getRootElement(),save) 

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted
Hi ! the script dont appear any error but don't work. :S

You can't just use that code.. I only showed you how to do it but it obviously won't work because when you get the element data and it's non-existent, it will return false...

you can't add a number to false o.O

You need to tweak your own "point system" that you say you have to make it work with this..

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