Help with chat command for equipping team members with weapons(for DarkRP)
2 replies, posted
[I]I'm trying to make an addon that equips other team members with weapons , but only a mafia boss can do it. So if im a mexican mafia boss and i do this command, i equip me and all other mexican mafia members with weapons, but i have to pay $900 for each person. I thought it would be easy and since im new to lua i thought it would also help me learn lua, but im stuck and i need help.[/I] [B]This is what i have so far:[/B]
[CODE]weapon = { "weapon_pumpshotgun2", "ls_sniper", "weapon_mp52", "weapon_mac102", "weapon_fiveseven2" }
local function equipmafia( ply, text, public )
if ( text == "!equipmafia" ) and ply:Team() == TEAM_MEXICANBOSS and team.NumPlayers(TEAM_MEXICAN) > 0 then
ply:addMoney(-900*team.NumPlayers(TEAM_MEXICAN)-900)
ply:Give(table.Random( weapon ))
for _,v in pairs(team.GetPlayers(TEAM_MEXICAN)) do
v:Give(table.Random( weapon ))
end
elseif ( text == "!equipmafia" ) and ply:Team() == TEAM_MEXICANBOSS and team.NumPlayers(TEAM_MEXICAN) == 0 then
DarkRP.notify( ply, 1, 4,"You need atleast one mexican mafia.")
elseif ( text == "!equipmafia" ) and not ply:Team() == TEAM_MEXICANBOSS or not ply:Team() == TEAM_AMERICANBOSS or not ply:Team() == TEAM_RUSSIANBOSS or not ply:Team() == TEAM_ITALIANBOSS then
DarkRP.notify( ply, 1, 4,"You need to be a mafia boss!")
end
end
hook.Add( "PlayerSay", "equipmafia", equipmafia )[/CODE]
[I](I havnt added any other mafia boss's because i wanted to atleast know that it can work)
I also havnt gotten any errors, yet.[/I]
This script is wierd and i dont know why it doesnt work. It sometimes equips me a weapon which is good but doesnt equip another mafia member a weapon or it wont equip me a weapon and it will give the other mafia member 2 weapons. Also sometimes the money is weird from it sometimes doing 900 per person(how i want it be) but sometimes takes $2700 for 2 people when it has to take $1800($900*2)
[B][U]Thanks for any help![/U][/B]
[CODE] tags please
[QUOTE=Mikey Howell;49167659][CODE] tags please[/QUOTE]
Oh sorry and thanks for telling me
Sorry, you need to Log In to post a reply to this thread.