CMD:paintball(playerid, params[])
{
if(sscanf(params, "s[50]", params)) return UsageMSG(playerid, "/paintball[LIST/EDIT/LEADER]");
if(strcmp(params, "list", true) && strcmp(params, "edit", true) && strcmp(params, "leader", true)) return UsageMSG(playerid, "/paintball[LIST/EDIT/LEADER]");
if(!strcmp(params, "list", true))
{
ShowPaintballLobbies(playerid);
}
if(!strcmp(params, "edit", true))
{
if(pInfo[playerid][InPBLobby] == -1) return ErrorMSG(playerid, "You are not in any paintball lobby.");
if(pbInfo[pInfo[playerid][InPBLobby]][pbLeader] != playerid) return ErrorMSG(playerid, "You are not the paintball leader.");
ShowPaintballEdit(playerid, pInfo[playerid][InPBLobby]);
}
if(!strcmp(params, "leader", true))
{
if(pInfo[playerid][InPBLobby] == -1) return ErrorMSG(playerid, "You are not in any paintball lobby.");
if(pbInfo[pInfo[playerid][InPBLobby]][pbLeader] != playerid) return ErrorMSG(playerid, "You are not the paintball leader.");
new pID;
if(sscanf(params, "u", pID)) return UsageMSG(playerid, "/paintball leader [PLAYER_ID]");
if(!IsPlayerConnected(pID)) return ErrorMSG(playerid, "This player is not connected.");
if(pInfo[pID][InPBLobby] != pInfo[playerid][InPBLobby]) return ErrorMSG(playerid, "This player isn't in your PB lobby.");
new pbid = pInfo[playerid][InPBLobby], string[128];
pbInfo[pbid][pbLeader] = pID;
format(string, sizeof(string), "%s(%d) is the new paintball leader.", PlayerName(pID), pID);
SendMSGToPBMembers(pbid, string);
}
return 1;
}
if (!strcmp(params, "list", true)) ShowPaintballLobbies(playerid); else if (!strcmp(params, "edit", true)) { if (pInfo[playerid][InPBLobby] == -1) return ErrorMSG(playerid, "You are not in any paintball lobby."); if (pbInfo[pInfo[playerid][InPBLobby]][pbLeader] != playerid) return ErrorMSG(playerid, "You are not the paintball leader."); ShowPaintballEdit(playerid, pInfo[playerid][InPBLobby]); } else if (!strcmp(params, "leader", true)) { if (pInfo[playerid][InPBLobby] == -1) return ErrorMSG(playerid, "You are not in any paintball lobby."); if (pbInfo[pInfo[playerid][InPBLobby]][pbLeader] != playerid) return ErrorMSG(playerid, "You are not the paintball leader."); UsageMSG(playerid, "/paintball leader [PLAYER_ID]"); } else if (!strcmp(params, "leader ", true)) { new pID; if (sscanf(params[7], "u", pID)) return UsageMSG(playerid, "/paintball leader [PLAYER_ID]"); if (!IsPlayerConnected(pID)) return ErrorMSG(playerid, "This player is not connected."); if (pInfo[pID][InPBLobby] != pInfo[playerid][InPBLobby]) return ErrorMSG(playerid, "This player isn't in your PB lobby."); new pbid = pInfo[playerid][InPBLobby], string[128]; pbInfo[pbid][pbLeader] = pID; format(string, sizeof(string), "%s(%d) is the new paintball leader.", PlayerName(pID), pID); SendMSGToPBMembers(pbid, string); } else UsageMSG(playerid, "/paintball[LIST/EDIT/LEADER]");
Bro, I've tested it now, I did "/paintball leader", and it shows /paintball leader [PLAYER_ID], then I did /paintball leader 0 (my ID), then it showed the command usage (/paintball[LIST/EDIT/LEADER]).
Help please. |
else if (!strcmp(params, "leader ", true))
else if (!strcmp(params, "leader ", true, 7))
Change this:
Код:
else if (!strcmp(params, "leader ", true)) Код:
else if (!strcmp(params, "leader ", true, 7)) |