11.09.2016, 10:05
Hello guys, I have made a command with more than one usage. Command is: /paintball.
Usage: /paintball[LIST/EDIT/LEADER].
"List" or "Edit" are working well, about the "leader" one, it's made to set the paintball leader.
so the usage should be like: /paintball leader [PLAYER_ID]. I scripted it, and went ingame, I did "/paintball leader", then it said: this player is not connected. I didn't even type a player name/id. And if I type a name/id, it says: USAGE: /paintball[LIST/EDIT/LEADER]..
Usage: /paintball[LIST/EDIT/LEADER].
"List" or "Edit" are working well, about the "leader" one, it's made to set the paintball leader.
so the usage should be like: /paintball leader [PLAYER_ID]. I scripted it, and went ingame, I did "/paintball leader", then it said: this player is not connected. I didn't even type a player name/id. And if I type a name/id, it says: USAGE: /paintball[LIST/EDIT/LEADER]..
PHP код:
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;
}