(line 357) if(strcmp(cmdtext, "/makeleader", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeleader [playerid/PartOfName] [Number(1-10)]"); return 1; } new para1; new level; para1 = ReturnUser(tmp); tmp = strtok(cmdtext, idx); level = strval(tmp); if(level > 0 || level < 1) { SendClientMessage(playerid, COLOR_GREY, "ERROR: Dont go below number 0 nor above number 1!"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 1337) { if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { GetPlayerName(para1, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); PlayerInfo[para1][pLeader] = level; format(string, sizeof(string), "NOTICE: You have been promoted to Leader of a faction by Admin %s", sendername); SendClientMessage(para1, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "NOTICE: You have given %s control to run Faction Number %d.", giveplayer,level); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); format(string, 256, "[ADMIN]: %s has promoted %s to Leader of faction %d.", sendername, giveplayer, level); ABroadCast(COLOR_LIGHTRED,string,1); if(level == 0) { PlayerInfo[para1][pChar] = 0; } else if(level == 3) { PlayerInfo[para1][pChar] = 287; } gTeam[para1] = 11; PlayerInfo[para1][pTeam] = 11; SetPlayerSkin(para1, PlayerInfo[para1][pChar]); } }//not connected } else { SendClientMessage(playerid, COLOR_GRAD1, "ERROR: You are not authorized to use that command!"); } } return 1; }
uhh make sure you have all the brackets and a noob mistake ive seen is people not placing there codes under onplayercommandtext
|
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;
}
print("Hello world!");
//print("This will not be said!");
public OnPlayerCommandText(playerid,cmdtext[]){
if(!strcmp(cmdtext,"/Rawr",true)){
SendClientMessage(playerid,0xFF0000FF,"You typed /Rawr!");
return 1;
}/*
if(!strcmp(cmdtext,"/Nope",true)){
SendClientMessage(playerid,0xFF0000FF,"This command will not work!");
return 1;
}*/
return 0;
}