Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help (
/showthread.php?tid=254731)
Help -
Kobatz - 12.05.2011
This is my problem,i've made /setarmyleader command (admin sets player as Army leader).
Код:
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;
}
and /takem4 command ( Take m4 from the army armory(player needs to be army member to do that))
Код:
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;
}
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!
Re: Help -
Daddy Yankee - 13.05.2011
You only set the player's rank from what I see here.. Put this too in your first command
Код:
gTeam[playerid] = TEAM_ARMY;