20.01.2018, 06:56
Quote:
I also tried it and it didn't work, when i used /givescore with a wrong id it just gave me the message "unknown command" and then when i tried doing it correctly it wrote me the same like something went wrong
Код:
CMD:givescore(playerid, params[]) { new options[128], score; if(pInfo[playerid][Admin] >= 5) return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command."); if(pInfo[toplayerid][Admin] == ServerInfo[MaxAdminLevel] && pInfo[playerid][Admin] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command on this admin."); if(IsPlayerConnected(toplayerid) && toplayerid != INVALID_PLAYER_ID) return SendClientMessage(playerid,RED,"SERVER: Player is not connected"); if(sscanf(params, "us[128]d",toplayerid,options,score)) { SendClientMessage(playerid, -1, "Usage: /givescore [playerid] [Option] [score]"); SendClientMessage(playerid, -1, "{FF0000}Option:{00FF00}Criminal, Cop, Paramedic"); return 1; } else if(!strcmp(options, "criminal", true, 5)) { format(str, SOS, "Admin: %s has used command GIVESCORE", pInfo[playerid][Name]); SendAdminMessage(OR, str); format(str, SOS, "Administrator %s have given you %s criminal scores", pInfo[playerid][Name], score); SendClientMessage(toplayerid, OR, str); return a_GivePlayerCriminal(toplayerid, score); } else if(!strcmp(options, "cop", true, 5)) { format(str, SOS, "Admin: %s has used command GIVESCORE", pInfo[playerid][Name]); SendAdminMessage(OR, str); format(str, SOS, "Administrator %s have given you %s cop scores", pInfo[playerid][Name], score); SendClientMessage(toplayerid, OR, str); return a_GivePlayerCop(toplayerid, score); } else if(!strcmp(options, "paramedic", true, 5)) { format(str, SOS, "Admin: %s has used command GIVESCORE", pInfo[playerid][Name]); SendAdminMessage(OR, str); format(str, SOS, "Administrator %s have given you %s paramedic scores", pInfo[playerid][Name], score); SendClientMessage(toplayerid, OR, str); return a_GivePlayerParamedic(toplayerid, score); } else SendClientMessage(playerid, COLOR_RED, "Invalid Option."); return 1; } |
PHP код:
CMD:givescore(playerid, params[])
{
new options[128], score;
if(pInfo[playerid][Admin] >= 5) return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command.");
if(pInfo[toplayerid][Admin] == ServerInfo[MaxAdminLevel] && pInfo[playerid][Admin] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command on this admin.");
if(IsPlayerConnected(toplayerid) && toplayerid != INVALID_PLAYER_ID) return SendClientMessage(playerid,RED,"SERVER: Player is not connected");
if(sscanf(params, "us[128]d",toplayerid,options,score))
{
SendClientMessage(playerid, -1, "Usage: /givescore [playerid] [Option] [score]");
SendClientMessage(playerid, -1, "{FF0000}Option:{00FF00}Criminal, Cop, Paramedic");
return 1;
}
else if(!strcmp(options, "criminal", true, 5))
{
format(str, SOS, "Admin: %s has used command GIVESCORE", pInfo[playerid][Name]);
SendAdminMessage(OR, str);
format(str, SOS, "Administrator %s have given you %s criminal scores", pInfo[playerid][Name], score);
SendClientMessage(toplayerid, OR, str);
return a_GivePlayerCriminal(toplayerid, score);
}
else if(!strcmp(options, "cop", true, 5))
{
format(str, SOS, "Admin: %s has used command GIVESCORE", pInfo[playerid][Name]);
SendAdminMessage(OR, str);
format(str, SOS, "Administrator %s have given you %s cop scores", pInfo[playerid][Name], score);
SendClientMessage(toplayerid, OR, str);
return a_GivePlayerCop(toplayerid, score);
}
else if(!strcmp(options, "paramedic", true, 5))
{
format(str, SOS, "Admin: %s has used command GIVESCORE", pInfo[playerid][Name]);
SendAdminMessage(OR, str);
format(str, SOS, "Administrator %s have given you %s paramedic scores", pInfo[playerid][Name], score);
SendClientMessage(toplayerid, OR, str);
return a_GivePlayerParamedic(toplayerid, score);
}
else SendClientMessage(playerid, COLOR_RED, "Invalid Option.");
return 1;
}