Shady1 Posted August 13, 2021 Share Posted August 13, 2021 hi guys, I wrote a vip system for my own dayz server, but I wrote something wrong, can you help me? When vip players spawn, automatic special loots will be given, I set them, but it does not work, can you fix it? function giveAcl(thePlayer, cmd, target) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("VIP")) then local theTargetElement = getPlayerFromNamePart(target) if(getElementType(theTargetElement) == "player") then setElementData(theTargetElement, "IsPlayerVip", true) local acc = getPlayerAccount(theTargetElement) if acc then setAccountData(acc, "IsPlayerVip", true) end end end end addCommandHandler("setvip", giveAcl) function rmvVipD() setElementData(source, "vip.items", 0) end addEventHandler("onPlayerWasted", getRootElement(), rmvVipD) function loadVip() local VIPi = getAccountData(getPlayerAccount(source), "vip.items") setElementData(source, "vip.items", VIPi) end addEventHandler("onPlayerLogin", getRootElement(), loadVip) function saveVip() local player = getPlayerAccount(source) setAccountData(player, "vip.items", getElementData(source, "vip.items")) end addEventHandler("onPlayerQuit", getRootElement(), saveVip) addEventHandler("onPlayerSpawn", root, function() local acc = getPlayerAccount(source) if getAccountData(acc, "IsPlayerVip") then outputDebugString("Entered 1") local VIPi = getElementData(source, "vip.items") or 0 if VIPi == 0 then outputDebugString("Entered 2") setElementData(source, "Map", 1) setElementData(source, "GPS", 1) setElementData(source, "Bandage", 2) setElementData(source, "Morphine", 1) setElementData(source, "Painkiller", 1) setElementData(source, "Water Bottle", 5) setElementData(source, "Camouflage Clothing", 1) setElementData(source, "Alice Pack", 1) outputChatBox("VIP: VIP Items loaded press 'J'!", source, 0, 255, 0, false) else end end end ) Link to comment
CastiaL Posted August 13, 2021 Share Posted August 13, 2021 Try changing the values of "theTargetElement" to "target" Link to comment
Shady1 Posted August 15, 2021 Author Share Posted August 15, 2021 i tested this but it didn't work, why might Link to comment
Shady1 Posted August 17, 2021 Author Share Posted August 17, 2021 did not improve function giveAcl(thePlayer, cmd, target) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("VIP")) then local target = getPlayerFromNamePart(target) if(getElementType(target) == "player") then setElementData(target, "IsPlayerVip", true) local acc = getPlayerAccount(target) if acc then setAccountData(acc, "IsPlayerVip", true) end end end end addCommandHandler("setvip", giveAcl) function rmvVipD() setElementData(source, "vip.items", 0) end addEventHandler("onPlayerWasted", getRootElement(), rmvVipD) function loadVip() local VIPi = getAccountData(getPlayerAccount(source), "vip.items") setElementData(source, "vip.items", VIPi) end addEventHandler("onPlayerLogin", getRootElement(), loadVip) function saveVip() local player = getPlayerAccount(source) setAccountData(player, "vip.items", getElementData(source, "vip.items")) end addEventHandler("onPlayerQuit", getRootElement(), saveVip) addEventHandler("onPlayerSpawn", root, function() local acc = getPlayerAccount(source) if getAccountData(acc, "IsPlayerVip") then outputDebugString("Entered 1") local VIPi = getElementData(source, "vip.items") or 0 if VIPi == 0 then outputDebugString("Entered 2") setElementData(source, "Map", 1) setElementData(source, "GPS", 1) setElementData(source, "Bandage", 2) setElementData(source, "Morphine", 1) setElementData(source, "Painkiller", 1) setElementData(source, "Water Bottle", 5) setElementData(source, "Camouflage Clothing", 1) setElementData(source, "Alice Pack", 1) outputChatBox("VIP: VIP Items loaded press 'J'!", source, 0, 255, 0, false) else end end end ) Link to comment
nikitafloy Posted August 17, 2021 Share Posted August 17, 2021 I see a lot of errors in the code Need logs /debugscript 3 And it's not a fact that the spawn event is triggered after the login event Link to comment
Shady1 Posted August 18, 2021 Author Share Posted August 18, 2021 @nikitafloy now i wrote a new one,There is an error on the 4th line, I kill myself and I use the ./adminvip command, it does not give my inventory item server.lua function vipItemCek () local account = getPlayerAccount ( source ) local accName = getAccountName ( account ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) ) then if getElementData(source,"Alive Time") = 0 then setElementData(source, "Map", 1)--bu soldaki 1 adet haberin olsun setElementData(source, "GPS", 1) setElementData(source, "Alice Pack", 1) setElementData(source, "Camouflage Clothing", 1) setElementData(source, "Water Bottle", 1) else outputChatBox("İtemleri yeniden alman için ölmen gerekir.",source) end else outputChatBox("Yetkili değilsin.",source) end end addEvent( "ıtemCek", true ) addEventHandler( "ıtemCek", getRootElement(), vipItemCek ) client.lua function vip() triggerServerEvent ( "ıtemCek", getLocalPlayer() ) end addCommandHandler ("adminvip", vip) 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