17.08.2011, 00:30
Quote:
uhh make sure you have all the brackets and a noob mistake ive seen is people not placing there codes under onplayercommandtext
|
pawn Код:
if(strcmp(cmd, "/makeleader", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeleader [playerid/PartOfName] [Number(1-20)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(level >= SCRIPT_OPENFACTIONS || level < 0) { SendClientMessage(playerid, COLOR_GREY, " Dont go below number 0, or above!"); return 1; }
if (PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
GiveNameSpace(sendername);
GiveNameSpace(giveplayer);
PlayerInfo[para1][pMember] = level;
format(string, sizeof(string), " You have been promoted to Leader to your requested Faction by Admin %s", sendername);
SendClientMessage(para1, COLOR_WHITE, string);
format(string, sizeof(string), " You have given %s control to run Faction Number %d.", giveplayer,level);
SendClientMessage(playerid, COLOR_WHITE, string);
if(level == 0) { PlayerInfo[para1][pRank] = 0; gTeam[para1] = 3; PlayerInfo[para1][pTeam] = 0; return 1; }
else if(level == 1) { PlayerInfo[para1][pModel] = 288; } //Police Force
else if(level == 2) { PlayerInfo[para1][pModel] = 286; } //FBI/ATF
else if(level == 3) { PlayerInfo[para1][pModel] = 26; } // Goverment
else if(level == 4) { PlayerInfo[para1][pModel] = 228; } //Fire/Ambulance
else if(level >= 7) { PlayerInfo[para1][pModel] = FamilyInfo[level][FamilySkin6]; } // Open Faction
PlayerInfo[playerid][pFactionIden]=FamilyInfo[PlayerInfo[playerid][pMember]][FamilyIden]; //just to make sure its synced
if(level == 0)
{
gTeam[para1] = 3;
PlayerInfo[para1][pTeam] = 3;
}
else if(level == 1 || level == 2 || level == 3)
{
gTeam[para1] = 2;
PlayerInfo[para1][pTeam] = 2;
}
else if(level == 4)
{
gTeam[para1] = 1;
PlayerInfo[para1][pTeam] = 1;
}
else
{
gTeam[para1] = 15;
PlayerInfo[para1][pTeam] = 15;
}
SetPlayerSkinEx(para1, PlayerInfo[para1][pModel]);
if(level == 0)
{
PlayerInfo[para1][pRank] = 0;
}
else if(level == 1)
{
PlayerInfo[para1][pRank] = 16;
}
else if(level == 3)
{
PlayerInfo[para1][pRank] = 16;
}
else if(level >= 7)
{
PlayerInfo[para1][pRank] = 6;
SendClientMessage(para1,COLOR_WHITE,"[INFO]: Type /factionhelp to learn how to build your faction.");
}
else
{
PlayerInfo[para1][pRank] = 6;
}
}
}//not connected
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}