BucketBull Posted December 27, 2016 Posted December 27, 2016 hey guys. How can i change a changer for only one player in server side? thx, for help!
Mr.Loki Posted December 27, 2016 Posted December 27, 2016 In English please? Are you talking about replacing models?
BucketBull Posted December 27, 2016 Author Posted December 27, 2016 Here is the script: local con = exports.mta_connection:getConnection() local got = false function ppadd(player, pp) if got == false then local pp = tonumber(pp) local oldPP = getElementData(player, "char:pp") local sql = dbExec(con, "UPDATE characters SET premiumpont='".. oldPP .. "' WHERE id='" .. getElementData(player, "char:id") .. "'") if (sql) then setElementData(player, "char:pp", oldPP + 1) outputChatBox( " ...",player,255,255,255,true) got = true end else outputChatBox( " ..",player,255,255,255,true) end end addCommandHandler("watchpp", ppadd) Now we can use it only once. It should be used by every player only once on their own account not everbody only once.
Mr.Loki Posted December 27, 2016 Posted December 27, 2016 if someone uses the watchpp command the "got" variable will beset to true then the code will no longer run. You should probably use SetAccountData and GetAccountData so the script checks the player's account to see if he used the command.
BucketBull Posted December 27, 2016 Author Posted December 27, 2016 thx now it is working but now when someone reconnect he can use it again and it is working again.
iPrestege Posted December 27, 2016 Posted December 27, 2016 You have to make sure that the player is logged in and not a guest then check if the data exists in the player account and return end or whatever.
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