BieHDC Posted July 12, 2013 Share Posted July 12, 2013 Hello, i have this GodModeScript working very well, but i wanna have for working only for Admins and it should write in Chatbox if not Admin: "This is only for Admins" addEvent("buyGodMode", true) addEventHandler("buyGodMode", rootElement, function() if ( getPlayerMoney (source) >= 70000 ) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else outputChatBox("Not enough money.", source, 255, 0, 0, true) end end ) Link to comment
MIKI785 Posted July 12, 2013 Share Posted July 12, 2013 There is example on the wiki: isObjectInACLGroup, that's what you're looking for. Link to comment
BieHDC Posted July 12, 2013 Author Share Posted July 12, 2013 Like so? Attention: If Player not Admin he should loose the money and if admin he loose money and get ghostmode addEvent("buyGodMode", true) addEventHandler("buyGodMode", rootElement, function() if ( getPlayerMoney (source) >= 70000 ) then takePlayerMoney(source, 70000) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else outputChatBox("Function only for Admins, but you lost money for try to buy.", source, 255, 0, 0, true) end end ) Link to comment
Alen141 Posted July 12, 2013 Share Posted July 12, 2013 Like so?Attention: If Player not Admin he should loose the money and if admin he loose money and get ghostmode addEvent("buyGodMode", true) addEventHandler("buyGodMode", rootElement, function() if ( getPlayerMoney (source) >= 70000 ) then takePlayerMoney(source, 70000) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else outputChatBox("Function only for Admins, but you lost money for try to buy.", source, 255, 0, 0, true) end end ) this is going to take player money and then tell him that he's not an admin EDIT : Try this code addEvent("buyGodMode", true) addEventHandler("buyGodMode", rootElement, function() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if ( getPlayerMoney (source) >= 70000 ) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else outputChatBox("Not enough money or you're not an admin!", source, 255, 0, 0, true) end end end ) Link to comment
BieHDC Posted July 12, 2013 Author Share Posted July 12, 2013 This takes normal players money if not admin? > I want normal players to loose money And admins get godmode for buy? > admins should get godmode for money Link to comment
Alen141 Posted July 12, 2013 Share Posted July 12, 2013 This takes normal players money if not admin? > I want normal players to loose moneyAnd admins get godmode for buy? > admins should get godmode for money so if normal player tries to buy it he only loses money and dosen't get one and admins lose money and get one? is that right? Link to comment
BieHDC Posted July 12, 2013 Author Share Posted July 12, 2013 Yes and player should see chat message: Only for Admins, but you loose money for trying to buy Link to comment
Alen141 Posted July 12, 2013 Share Posted July 12, 2013 Yes and player should see chat message: Only for Admins, but you loose money for trying to buy addEvent("buyGodMode", true) addEventHandler("buyGodMode", rootElement, function() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if ( getPlayerMoney (source) >= 70000 ) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else takePlayerMoney(source, 70000) outputChatBox("Only for Admins, but you loose money for trying to buy", source, 255, 0, 0, true) end end end ) Try this ( if the player has 100 dolars his money will turn red( -69900 ).. is that ok? ) Link to comment
BieHDC Posted July 12, 2013 Author Share Posted July 12, 2013 LOL negativ money i dont thought about this but good idea THX man and maybe you can help me also there? viewtopic.php?f=91&t=62015&p=590871#p590871 Link to comment
BieHDC Posted July 12, 2013 Author Share Posted July 12, 2013 Doesnt work if normal player tryes to buy nothng happens no money no message and if admin buy work but with warning: WARNING: userpanel\server.lua:78 Bad 'vehicle' pointer @ 'setVehicleDamageProof'(1) Link to comment
manawydan Posted July 12, 2013 Share Posted July 12, 2013 try addEvent("buyGodMode", true) addEventHandler("buyGodMode", getRootElement(), function() if ( getPlayerMoney (source) >= 70000 ) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else takePlayerMoney(source, 70000) outputChatBox("Only for Admins, but you loose money for trying to buy", source, 255, 0, 0, true) end end end ) Link to comment
manawydan Posted July 12, 2013 Share Posted July 12, 2013 or addEvent("buyGodMode", true) addEventHandler("buyGodMode", getRootElement(), function() if ( getPlayerMoney (source) >= 70000 ) then local Myv = getPedOccupiedVehicle(source) if Myv then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(Myv,true) setTimer( setVehicleDamageProof, 60000, 1, Myv, false) else takePlayerMoney(source, 70000) outputChatBox("Only for Admins, but you loose money for trying to buy", source, 255, 0, 0, true) end end end end ) Link to comment
BieHDC Posted July 12, 2013 Author Share Posted July 12, 2013 First one works THX^ But i miss the "You have not enouth money" message Link to comment
itoko Posted July 12, 2013 Share Posted July 12, 2013 addEvent("buyGodMode", true) addEventHandler("buyGodMode", getRootElement(), function() if ( getPlayerMoney (source) >= 70000 ) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else takePlayerMoney(source, 70000) outputChatBox("Only for Admins, but you loose money for trying to buy", source, 255, 0, 0, true) end else outputChatBox("You haven't got enough money.", source, 255, 0, 0, true) end end ) Link to comment
BieHDC Posted July 12, 2013 Author Share Posted July 12, 2013 Works perfect^thx man and how to change to set money to 0 like so? setPlayerMoney(source, 0) outputChatBox("Only for Admins, but you loose ALL money for trying to buy!", source, 255, 0, 0, true) Link to comment
iMr.3a[Z]eF Posted July 12, 2013 Share Posted July 12, 2013 Yes, like this and use isGuestAccount in the event onPlayerJoin 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