12.05.2011, 13:33
This is my problem,i've made /setarmyleader command (admin sets player as Army leader).
and /takem4 command ( Take m4 from the army armory(player needs to be army member to do that))
Okay i've compiled it and everything was fine no errors.When i gone to test it i did /setarmyleader 0 i got the message You have been made Army lead by Kobatz and all that but when i tried to take gun it said You aren't an army solider.
I hope you understand me,thanks for any help!
Код:
if(strcmp(cmd,"/setarmyleader",true)==0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "|| Only server owner can do this ||");
else if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /setarmyleader [playerid]");
{
new otherplayerid;
otherplayerid = strval(tmp);
new string2[128];
new playername[24];
new othername[24];
PlayerData[otherplayerid][armyrank] = 5;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(otherplayerid, othername, sizeof(othername));
format(string2, sizeof string2, "** You have been made the Army Leader by %s.",playername);
SendClientMessage(otherplayerid,COLOR_RED,string2);
format(string2, sizeof string2, "** You have made %s the Army Leader", othername);
SendClientMessage(playerid,COLOR_RED,string2);
}
return 1;
}
Код:
if(strcmp("/takem4", cmdtext, true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid,3.5,2787.7021,-2502.9038,13.6504)) return SendClientMessage(playerid, COLOR_RED, "You have to be in Army Base Garage Three to take m4");
else if (gTeam[playerid] != TEAM_ARMY) return SendClientMessage(playerid,COLOR_RED,"** You aren't an army soldier!"); // if player team doesn't equal to army it doesn't give him gun
{
GivePlayerWeapon(playerid,31,200); // First number is weps ID and second is ammount of bullz
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name)); // Gets the player name for this action.
format(str, sizeof(str), "%s extends his arm and takes m4a1 from the table", name); // What it's going to look like.
SendClientMessageToAll(COLOR_BLUE, str); // Color to send the message to everyone in.
}
return 1;
}
I hope you understand me,thanks for any help!

