Quote:
Originally Posted by freaxas
anyone?
|
Tbh, I never used strtok before, but give this a try, will ya?
pawn Код:
if(strcmp(cmd, "/makeleader", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SyntaxMessage(playerid, "/makeleader [playerid/name] [number]");
return 1;
}
new para1;
para1 = ReturnUser(tmp);
if(IsPlayerNPC(para1)) return 1;
tmp2 = strtok(tmp, idx);
if(!strlen(tmp2))
{
SyntaxMessage(playerid, "/makeleader [playerid/name] [number]");
return 1;
}
new faction;
faction = strval(tmp2);
if(faction < 0 || faction > MAX_FACTIONS) { format(string, sizeof(string), "Faction ID can't be below 0 or above %d.", MAX_FACTIONS); SendClientMessage(playerid, GREY, string); return 1; }
if(faction != 0 && !FactionInfo[faction][FactionExists]) return SendClientMessage(playerid, GREY, "Invalid faction ID.");
if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pFactionMod] > 0)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
PlayerInfo[para1][pRank] = (faction) ? (6) : (0);
MakeLeaderOf(para1, faction);
format(string, sizeof(string), "WARNING :- You have given %s the leadership-badge of the %s orgnizaiton.", giveplayer,FactionInfo[faction][FactionName]);
SendClientMessage(playerid, LIGHTBLUE, string);
format(string, sizeof(string), "WARNING :- Adminstrator %s has given you the leadership-badge of the %s orgnization.",sendername,FactionInfo[faction][FactionName]);
SendClientMessage(para1, COLOR_LIGHTRED, string);
PlayerInfo[para1][pLeader] = faction;
PlayerInfo[para1][pMember] = faction;
PlayerInfo[para1][pDivision] = 0;
SetPlayerToTeamColor(para1);
OnPlayerSave(para1);
}
}
}
else
{
SendClientMessage(playerid, GREY, " You are not authorized to use that command.");
}
}
return 1;
}