CMD:setscore(playerid,params[]) { if(pInfo[playerid][Admin] >= 5) { new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, RED, "USAGE: /setcriminal [playerid] [score]"); new player1 = strval(tmp), score = strval(tmp2), string[128]; if(pInfo[player1][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(player1) && player1 != INVALID_PLAYER_ID) { { CMDMessageToAdmins(playerid,"SETSCORE"); format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string); if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your criminal level to '%d'", pInfo[playerid][Name], score); SendClientMessage(player1,blue,string); } return SetPlayerCriminal(player1, score); } } else return SendClientMessage(playerid,RED,"SERVER: Player is not connected"); } else return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command."); }
SetPlayerCop(player1, score), SetPlayerParamedic(player1, score), pInfo[playerid][Cop], pInfo[playerid][Paramedic]
CMD:setscore(playerid,params[])
{
if(pInfo[playerid][Admin] >= 5)
{
new targetid, score, string[144];
if(sscanf(params, "ud", targetid, score)) return SendClientMessage(playerid, RED, "USAGE: /setcriminal [playerid] [score]");
if(pInfo[targetid][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(targetid) && targetid != INVALID_PLAYER_ID)
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your criminal level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerCriminal(targetid, score);
} else return SendClientMessage(playerid,RED,"SERVER: Player is not connected");
} else return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command.");
}
CMD:setscore(playerid, params[])
{
new options[128], targetid, score, string[144];
if(pInfo[playerid][Admin] >= 5)
if(pInfo[targetid][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(targetid) && targetid != INVALID_PLAYER_ID)
if(sscanf(params, "us[128]d",targetid,options,score))
{
SendClientMessage(playerid, -1, "Usage: /setscore [playerid] [Option] [score]");
SendClientMessage(playerid, -1, "{FF0000}Option:{00FF00}Criminal, Cop, Paramedic");
return 1;
}
else if(!strcmp(options, "Criminal", true, 5))
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your criminal level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerCriminal(targetid, score);
pInfo[targetid][Criminal] = score;
}
else if(!strcmp(options, "Cop", true, 5))
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your cop level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerCop(targetid, score);
pInfo[targetid][Cop] = score;
}
else if(!strcmp(options, "Paramedic", true, 5))
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your paramedic level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerParamedic(targetid, score);
pInfo[targetid][Paramedic] = score;
}
else SendClientMessage(playerid, COLOR_RED, "Invalid Option.");
else return SendClientMessage(playerid,RED,"SERVER: Player is not connected");
else return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command.");
return 1;
}
C:\Osher\Scripting Learning\Scripting Projects\Project #2\CNR - Project v0.0.3\gamemodes\CNR.pwn(2194) : error 029: invalid expression, assumed zero
C:\Osher\Scripting Learning\Scripting Projects\Project #2\CNR - Project v0.0.3\gamemodes\CNR.pwn(2194) : warning 215: expression has no effect C:\Osher\Scripting Learning\Scripting Projects\Project #2\CNR - Project v0.0.3\gamemodes\CNR.pwn(2194) : error 001: expected token: ";", but found "return" " else return SendClientMessage(playerid,RED,"SERVER: Player is not connected"); else return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command."); return 1; " |
CMD:setscore(playerid, params[])
{
new options[128], targetid, score, string[144];
if(pInfo[playerid][Admin] >= 5) {
if(pInfo[targetid][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(targetid) && targetid != INVALID_PLAYER_ID) {
if(sscanf(params, "us[128]d",targetid,options,score))
{
SendClientMessage(playerid, -1, "Usage: /setscore [playerid] [Option] [score]");
SendClientMessage(playerid, -1, "{FF0000}Option:{00FF00}Criminal, Cop, Paramedic");
return 1;
}
else if(!strcmp(options, "Criminal", true, 5))
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your criminal level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerCriminal(targetid, score);
pInfo[targetid][Criminal] = score;
}
else if(!strcmp(options, "Cop", true, 5))
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your cop level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerCop(targetid, score);
pInfo[targetid][Cop] = score;
}
else if(!strcmp(options, "Paramedic", true, 5))
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your paramedic level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerParamedic(targetid, score);
pInfo[targetid][Paramedic] = score;
}
else SendClientMessage(playerid, COLOR_RED, "Invalid Option.");
} else return SendClientMessage(playerid,RED,"SERVER: Player is not connected");
} else return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command.");
return 1;
}
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; }
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; } |
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;
}