im trying to give donor more props, and i dont know what wrong with the code
[CODE]/*---------------------------------------------------------
Proplimit
---------------------------------------------------------*/
local MaxPropsL = 50
local DonatorplusL = 15
hook.Add( "PlayerSpawnProp", "PropLimitCheckerLOL", function(ply)
if ply:GetCount("props") >= MaxPropsL and not (ply:IsUserGroup("donor") or ply:IsAdmin()) then
ply:ChatPrint("You have reached the Proplimit!(" .. MaxPropsL .. ")")
return false
end
if ply:GetCount("props") >= MaxPropsL + DonatorplusL and ply:IsUserGroup("donor") then
ply:ChatPrint("You have reached the Proplimit! (" .. MaxPropsL + DonatorplusL .. ")")
return false
end
if ply:GetCount("props") >= 100 and ply:IsAdmin() then
ply:ChatPrint("Note you have more than 100 props!")
return false
end
end)
[/CODE]
no one can help?
What exactly is the problem? Does it give errors?
Please put this in the questions sub-forum.
[QUOTE]
I'm not to sure with the code, but something about this doesn't look right...
local MaxPropsL = 50
local DonatorplusL = 15[/QUOTE]
Tell us what is happening. Is there an error, is it just not giving the donor more props?
I rewrote some of the code, but really I doubt it is the code you are showing us that is the problem. I assume it is the IsUserGroup function. Here is my rewritten code though if you want to try it
[lua]
local MaxPropsL = 50
local MaxPropsAdminL = 100
local DonatorplusL = 15
hook.Add( "PlayerSpawnProp", "PropLimitCheckerLOL", function( ply )
local propCount = ply:GetCount( "props" )
if propCount >= MaxPropsAdminL and ply:IsAdmin() then
ply:ChatPrint( "Note you have more than 100 props!" )
return false -- Do you really want to return false? Based on your message I assume not
elseif propCount >= MaxPropsL + DonatorplusL and ply:IsUserGroup( "donor" ) then -- We know they aren't an admin already
ply:ChatPrint( "You have reached the Proplimit! (" .. MaxPropsL + DonatorplusL .. ")" )
return false
elseif propCount >= MaxPropsL then-- We know they arent admin or donor
ply:ChatPrint( "You have reached the Proplimit!(" .. MaxPropsL .. ")" )
return false
end
return true
end )
[/lua]
although it is a better practice to have the default case be false so this would be better.
[lua]
local MaxPropsL = 50
local MaxPropsAdminL = 100
local MaxDonatorPropsL = 65
hook.Add( "PlayerSpawnProp", "PropLimitCheckerLOL", function( ply )
local propCount = ply:GetCount( "props" )
if ( propCount < MaxPropsAdmin and ply:IsAdmin() ) or ( propCount < MaxDonatorPropsL and ply:IsUserGroup( "donor" ) ) or ( propCount < MaxPropsL ) then
return true
end
if ply:IsAdmin() then
ply:ChatPrint( "Note you have more than 100 props!" )
elseif ply:IsUserGroup( "donor" )
ply:ChatPrint( "You have reached the Proplimit! (" .. MaxDonatorPropsL .. ")" )
else
ply:ChatPrint( "You have reached the Proplimit!(" .. MaxPropsL .. ")" )
end
return false
end)
[/lua]
Sorry, you need to Log In to post a reply to this thread.