02.04.2013, 11:22
From
to
Might get loose indention because I am tired (Just back from school)
For tutorial on switching STRCMP to ZCMD.
Read the tutorial here
pawn Код:
if(strcmp(cmd, "/makeleader", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "|Usage: /makeleader [Playerid/PartOfName] [Team]|");
SendClientMessage(playerid, COLOR_RED, "|Criminal: Grove, Ballas, Aztecas, Yakuza, VCripz, BadBoys, SonsOfAnarchy|");
SendClientMessage(playerid, COLOR_RED, "|Criminal2: SAH|");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|Legal: JM, AFArmy, NoBrain|");
SendClientMessage(playerid, COLOR_WHITE, "|Neutral: Civilian|");
return 1;
}
new para1;
new ftext[200];
new level[32];
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "|Usage: /makeleader [Playerid/PartOfName] [Team]|");
SendClientMessage(playerid, COLOR_RED, "|Criminal: Grove, Ballas, Aztecas, Yakuza, VCripz, BadBoys, SonsOfAnarchy|");
SendClientMessage(playerid, COLOR_RED, "|Criminal2: SAH|");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|Legal: JM, AFArmy, NoBrain|");
SendClientMessage(playerid, COLOR_WHITE, "|Neutral: Civilian|");
return 1;
}
strmid(level, tmp, 0, sizeof(level), sizeof(level));
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
if (strcmp(level, "Grove", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_GROVE;
gTeam[para1] = TEAM_GROVE;
ftext = "Grove Street Families";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Ballas", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_BALLAS;
gTeam[para1] = TEAM_BALLAS;
ftext = "Rolling Height Ballas";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия 'Rolling Height Ballas'",GetName(playerid), GetName(para1));
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'Rolling Height Ballas' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Aztecas", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_AZTECAS;
gTeam[para1] = TEAM_AZTECAS;
ftext = "Aztecas";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Yakuza", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_YAKUZA;
gTeam[para1] = TEAM_YAKUZA;
ftext = "Yakuza";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "VCripz", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_CRIPZ;
gTeam[para1] = TEAM_CRIPZ;
ftext = "Vinewood Cripz";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "BadBoys", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_BADBOYS;
gTeam[para1] = TEAM_BADBOYS;
ftext = "BadBoys";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "AFArmy", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_AFARMY;
gTeam[para1] = TEAM_AFARMY;
ftext = "Army Aviation";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'Army Aviation' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
}
if (strcmp(level, "SonsOfAnarchy", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_SONS;
gTeam[para1] = TEAM_SONS;
ftext = "SonsOfAnarchy";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия 'Sons Of Anarchy'",GetName(playerid), GetName(para1));
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'Sons Of Anarchy' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "JM", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_JM;
gTeam[para1] = TEAM_JM;
ftext = "Junior Mafia";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext, GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "SAH", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_SAH;
gTeam[para1] = TEAM_SAH;
ftext = "San Andreas Hunters";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'San Andreas Hunters' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "NoBrain", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_BRAIN;
gTeam[para1] = TEAM_BRAIN;
ftext = "No Brain";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'No Brain' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Civilian", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_CIVILIAN;
gTeam[para1] = TEAM_CIVILIAN;
PlayerInfo[para1][pRank] = 0;
SpawnPlayer(para1);
format(string, sizeof(string), "%s премахна лидерството на %s",GetName(playerid), GetName(para1));
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "%s премахна твоето лидерство.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
}
}
} else
{
SendClientMessage(playerid, COLOR_RED, "Нямаш достатъчно права");
return 1;
}
}
return 1;
}
pawn Код:
CMD:makeleader(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "|Usage: /makeleader [Playerid/PartOfName] [Team]|");
SendClientMessage(playerid, COLOR_RED, "|Criminal: Grove, Ballas, Aztecas, Yakuza, VCripz, BadBoys, SonsOfAnarchy|");
SendClientMessage(playerid, COLOR_RED, "|Criminal2: SAH|");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|Legal: JM, AFArmy, NoBrain|");
SendClientMessage(playerid, COLOR_WHITE, "|Neutral: Civilian|");
return 1;
}
new para1;
new ftext[200];
new level[32];
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "|Usage: /makeleader [Playerid/PartOfName] [Team]|");
SendClientMessage(playerid, COLOR_RED, "|Criminal: Grove, Ballas, Aztecas, Yakuza, VCripz, BadBoys, SonsOfAnarchy|");
SendClientMessage(playerid, COLOR_RED, "|Criminal2: SAH|");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|Legal: JM, AFArmy, NoBrain|");
SendClientMessage(playerid, COLOR_WHITE, "|Neutral: Civilian|");
return 1;
}
strmid(level, tmp, 0, sizeof(level), sizeof(level));
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
if (strcmp(level, "Grove", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_GROVE;
gTeam[para1] = TEAM_GROVE;
ftext = "Grove Street Families";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Ballas", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_BALLAS;
gTeam[para1] = TEAM_BALLAS;
ftext = "Rolling Height Ballas";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия 'Rolling Height Ballas'",GetName(playerid), GetName(para1));
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'Rolling Height Ballas' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Aztecas", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_AZTECAS;
gTeam[para1] = TEAM_AZTECAS;
ftext = "Aztecas";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Yakuza", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_YAKUZA;
gTeam[para1] = TEAM_YAKUZA;
ftext = "Yakuza";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "VCripz", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_CRIPZ;
gTeam[para1] = TEAM_CRIPZ;
ftext = "Vinewood Cripz";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "BadBoys", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_BADBOYS;
gTeam[para1] = TEAM_BADBOYS;
ftext = "BadBoys";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext,GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "AFArmy", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_AFARMY;
gTeam[para1] = TEAM_AFARMY;
ftext = "Army Aviation";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'Army Aviation' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
}
if (strcmp(level, "SonsOfAnarchy", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_SONS;
gTeam[para1] = TEAM_SONS;
ftext = "SonsOfAnarchy";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия 'Sons Of Anarchy'",GetName(playerid), GetName(para1));
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'Sons Of Anarchy' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "JM", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_JM;
gTeam[para1] = TEAM_JM;
ftext = "Junior Mafia";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в '%s' от %s.", ftext, GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "SAH", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_SAH;
gTeam[para1] = TEAM_SAH;
ftext = "San Andreas Hunters";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'San Andreas Hunters' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "NoBrain", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_BRAIN;
gTeam[para1] = TEAM_BRAIN;
ftext = "No Brain";
PlayerInfo[para1][pRank] = 6;
SpawnPlayer(para1);
format(string, sizeof(string), "%s направи %s лидер на банда/мафия '%s'",GetName(playerid), GetName(para1), ftext);
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "Ти беше назначен за лидер в 'No Brain' от %s.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
if (strcmp(level, "Civilian", true) == 0)
{
PlayerInfo[para1][pMember] = TEAM_CIVILIAN;
gTeam[para1] = TEAM_CIVILIAN;
PlayerInfo[para1][pRank] = 0;
SpawnPlayer(para1);
format(string, sizeof(string), "%s премахна лидерството на %s",GetName(playerid), GetName(para1));
SendAdminMessage(COLOR_YELLOW, string);
format(string, sizeof(string), "%s премахна твоето лидерство.", GetName(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
SaveAccounts();
}
}
}
} else
{
SendClientMessage(playerid, COLOR_RED, "Нямаш достатъчно права");
return 1;
}
}
return 1;
}
For tutorial on switching STRCMP to ZCMD.
Read the tutorial here