devildead622 Posted March 12, 2013 Share Posted March 12, 2013 (edited) how to create a variable only for a player that can set true or false? Edited March 12, 2013 by Guest Link to comment
Cassandra Posted March 12, 2013 Share Posted March 12, 2013 Using setElementData and getElementData to get the variable value later on. This is an example. setElementData(playerpointer, "variablename", true/false) local toggle = getElementData(playerpointer, "variablename") Link to comment
devildead622 Posted March 12, 2013 Author Share Posted March 12, 2013 Can you help me with this? I did, but neither remembered that this does not work if another player were to use the command ... function givekit2( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then if not tempokit2 then giveWeapon ( player, 31, 300 ) --Give M4 giveWeapon ( player, 34, 80 ) -- Give Sniper Rifle tempokit2 = true setTimer(set1hora,3600000,1,player) else outputChatBox ( "#ff0000Voce tem que esperar 1 hora para poder pegar o kit novamente.", player, 255,0,0) end else outputChatBox ( "#ff0000Voce nao e um VIP!", player, 255,0,0) end end addCommandHandler("kitpremiun",givekit2) function set1hora() tempokit2 = false end Link to comment
Cassandra Posted March 12, 2013 Share Posted March 12, 2013 Can you help me with this?I did, but neither remembered that this does not work if another player were to use the command ... function givekit2( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then if not tempokit2 then giveWeapon ( player, 31, 300 ) --Give M4 giveWeapon ( player, 34, 80 ) -- Give Sniper Rifle tempokit2 = true setTimer(set1hora,3600000,1,player) else outputChatBox ( "#ff0000Voce tem que esperar 1 hora para poder pegar o kit novamente.", player, 255,0,0) end else outputChatBox ( "#ff0000Voce nao e um VIP!", player, 255,0,0) end end addCommandHandler("kitpremiun",givekit2) function set1hora() tempokit2 = false end Don't use normal variables for player variables, use element data with the example I showed you. Another example: setElementData(player, "tempokit2", true) local istrue = getElementData(player, "tempokit2") Link to comment
devildead622 Posted March 12, 2013 Author Share Posted March 12, 2013 so? function givekit2( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) local istrue = getElementData(player, "tempokit2") if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then if not istrue then giveWeapon ( player, 31, 300 ) --Give M4 giveWeapon ( player, 34, 80 ) -- Give Sniper Rifle setElementData(player, "tempokit2", true) setTimer ( function() setElementData(player, "tempokit2", false) end, 3600000, 1 ) else outputChatBox ( "#ff0000Voce tem que esperar 1 hora para poder pegar o kit novamente.", player, 255,0,0) end else outputChatBox ( "#ff0000Voce nao e um VIP!", player, 255,0,0) end end addCommandHandler("kitpremiun",givekit2) Link to comment
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