stefutz101 Posted July 31, 2015 Share Posted July 31, 2015 Hellov everyone . I just created a vip system and i want to make this command only 1 time / life , but didn't work And why Czech Backback looks like that ? function useAgain() local use = 0 end addEventHandler("onPlayerWasted", root , useAgain) function giveVipItems(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("VIP")) then if use == 0 then setElementData(thePlayer, "Map", 1) setElementData(thePlayer, "GPS", 1) setElementData(thePlayer, "Box of Matches", 1) setElementData(thePlayer, "Toolbox", 1) setElementData(thePlayer, "Watch", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "M4 Mag", 150) setElementData(thePlayer, "M4", 1) setElementData(thePlayer, "CZ 550 Mag", 25) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "Medic Kit", 1) setElementData(thePlayer, "Morphine", 1) setElementData(thePlayer, "Painkiller", 2) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "CZ 550 Mag", 30) setElementData(thePlayer, "Milk", 2) setElementData(thePlayer, "Camouflage Clothing", 1) setElementData(thePlayer, "Pizza", 2) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "MAX_Slots" , 26 ) local use = 1 outputChatBox("VIP: Items set !", thePlayer, 50, 255, 0, false) end else outputChatBox("VIP: Only VIP users can use this command!", thePlayer, 255, 0, 0, false) end end addCommandHandler("vipitems", giveVipItems , thePlayer) Link to comment
[XP]~Cnosi~> Posted July 31, 2015 Share Posted July 31, 2015 Maybe texture for Czech backpack is missing or any error in script for change texture, anyway screenshots from debugscript should be helpful Link to comment
stefutz101 Posted July 31, 2015 Author Share Posted July 31, 2015 I dont get errors but Czech Backpack looks like in photo and players can use /vipitems how many times they want ... Link to comment
Moderators IIYAMA Posted July 31, 2015 Moderators Share Posted July 31, 2015 How many times are they suppose to use that command? (like everyday or only ones per account) Well at least try this: local vipItemsSetLimiter = {} function useAgain() if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove end end addEventHandler("onPlayerWasted", root , useAgain) -- clean up -- addEventHandler("onPlayerQuit",root, function () if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove/clean up end end) -------------- function giveVipItems(thePlayer) if not vipItemsSetLimiter[thePlayer] then -- check if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("VIP")) then if use == 0 then setElementData(thePlayer, "Map", 1) setElementData(thePlayer, "GPS", 1) setElementData(thePlayer, "Box of Matches", 1) setElementData(thePlayer, "Toolbox", 1) setElementData(thePlayer, "Watch", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "M4 Mag", 150) setElementData(thePlayer, "M4", 1) setElementData(thePlayer, "CZ 550 Mag", 25) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "Medic Kit", 1) setElementData(thePlayer, "Morphine", 1) setElementData(thePlayer, "Painkiller", 2) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "CZ 550 Mag", 30) setElementData(thePlayer, "Milk", 2) setElementData(thePlayer, "Camouflage Clothing", 1) setElementData(thePlayer, "Pizza", 2) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "MAX_Slots" , 26 ) outputChatBox("VIP: Items set !", thePlayer, 50, 255, 0, false) vipItemsSetLimiter[thePlayer] = true -- store end else outputChatBox("VIP: Only VIP users can use this command!", thePlayer, 255, 0, 0, false) end else outputChatBox("VIP: You can only use this command ones in a lifetime. : )", thePlayer, 255, 0, 0, false) end end addCommandHandler("vipitems", giveVipItems) -- not needed> , thePlayer Link to comment
stefutz101 Posted July 31, 2015 Author Share Posted July 31, 2015 Nothing happen . I want to be used only 1 time per life . (And this reset after player die ). Still don't work Link to comment
Moderators IIYAMA Posted July 31, 2015 Moderators Share Posted July 31, 2015 It seems you are spawning players when they are still alive. I now added the event onPlayerSpawn too. local vipItemsSetLimiter = {} function useAgain() if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove end end addEventHandler("onPlayerWasted", root , useAgain) -- added -- addEventHandler("onPlayerSpawn",root, function () if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove end end) ------------- -- clean up -- addEventHandler("onPlayerQuit",root, function () if vipItemsSetLimiter[source] then -- check vipItemsSetLimiter[source] = nil -- remove/clean up end end) -------------- function giveVipItems(thePlayer) if not vipItemsSetLimiter[thePlayer] then -- check if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("VIP")) then if use == 0 then setElementData(thePlayer, "Map", 1) setElementData(thePlayer, "GPS", 1) setElementData(thePlayer, "Box of Matches", 1) setElementData(thePlayer, "Toolbox", 1) setElementData(thePlayer, "Watch", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "M4 Mag", 150) setElementData(thePlayer, "M4", 1) setElementData(thePlayer, "CZ 550 Mag", 25) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "Medic Kit", 1) setElementData(thePlayer, "Morphine", 1) setElementData(thePlayer, "Painkiller", 2) setElementData(thePlayer, "CZ 550", 1) setElementData(thePlayer, "CZ 550 Mag", 30) setElementData(thePlayer, "Milk", 2) setElementData(thePlayer, "Camouflage Clothing", 1) setElementData(thePlayer, "Pizza", 2) setElementData(thePlayer, "Infrared Goggles", 1) setElementData(thePlayer, "Night Vision Goggles", 1) setElementData(thePlayer, "MAX_Slots" , 26 ) outputChatBox("VIP: Items set !", thePlayer, 50, 255, 0, false) vipItemsSetLimiter[thePlayer] = true -- store end else outputChatBox("VIP: Only VIP users can use this command!", thePlayer, 255, 0, 0, false) end else outputChatBox("VIP: You can only use this command ones in a lifetime.", thePlayer, 255, 0, 0, false) end end addCommandHandler("vipitems", giveVipItems , thePlayer) Link to comment
stefutz101 Posted July 31, 2015 Author Share Posted July 31, 2015 Script dont have errors or Warnings but nothing happen ... again . Link to comment
Moderators IIYAMA Posted July 31, 2015 Moderators Share Posted July 31, 2015 Remove that: if use == 0 then < it is from the old code (line 31 and it's "end" on line 56) Link to comment
stefutz101 Posted July 31, 2015 Author Share Posted July 31, 2015 Oh , yes , thank you ! 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