Jump to content

race points


Recommended Posts

hi all,

i wanna make a script that you get Race points

but it's not work can you help me?

Greeting Maarten123

Script:

function addPoints(playerSource)
local playeraccount = getPlayerAccount ( source )
local points = getPlayerAccount ( source, "Points" ) + 3
setAccountData ( playeraccount, "Points", points )
outputChatBox("will it work?", player, 222, 0, 0, true)
end
addCommandHandler("add",addPoints)

Link to comment

for command handlers the player is not source but the first parameter of the function (in your case playerSource), if you however change it to use the appropriate event source will be fine. to make it work with what you currently have replace all "source"s with "playerSource"

Link to comment
function addPoints(playerSource)
local playeraccount = getPlayerAccount ( playerSource )
local points = getPlayerAccount ( playerSource, "Points" ) + 3
setAccountData ( playeraccount, "Points", points )
outputChatBox("will it work?", playerSource, 222, 0, 0, true)
end
addCommandHandler("add",addPoints)

but didn't work :(

Link to comment
did you just forget to copy it or did you remove the end of the function and the command handler? line 3 should be getAccountData (the player account should go there), you maybe need to use tonumber to turn the string which getAccountDataReturns to a number

is this wat you mean?Not work i don't understand :P

function addPoints(playerSource)
local playeraccount = getPlayerAccount ( playerSource )
local points = getPlayerAccount ( playerSource, "Points" ) + 3
setAccountData ( playeraccount, "Points", tonumber(points) )
outputChatBox("work?", playerSource, 222, 0, 0, true)
end
addCommandHandler("add",addPoints)

Link to comment

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