How to add options instead of one option
#9

Quote:
Originally Posted by Oshery
Посмотреть сообщение
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;
}
wht errors you got in your code

PHP код:
CMD:givescore(playeridparams[])
{
    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"true5))
    {
     
format(strSOS"Admin: %s has used command GIVESCORE"pInfo[playerid][Name]);
     
SendAdminMessage(OR, str);
     
format(strSOS"Administrator %s have given you %s criminal scores"pInfo[playerid][Name], score);
     
SendClientMessage(toplayerid, OR, str);
     return 
a_GivePlayerCriminal(toplayeridscore);
    }
    else if(!
strcmp(options"cop"true5))
    {
     
format(strSOS"Admin: %s has used command GIVESCORE"pInfo[playerid][Name]);
     
SendAdminMessage(OR, str);
     
format(strSOS"Administrator %s have given you %s cop scores"pInfo[playerid][Name], score);
     
SendClientMessage(toplayerid, OR, str);
     return 
a_GivePlayerCop(toplayeridscore);
    }
    else if(!
strcmp(options"paramedic"true5))
    {
     
format(strSOS"Admin: %s has used command GIVESCORE"pInfo[playerid][Name]);
     
SendAdminMessage(OR, str);
     
format(strSOS"Administrator %s have given you %s paramedic scores"pInfo[playerid][Name], score);
     
SendClientMessage(toplayerid, OR, str);
     return 
a_GivePlayerParamedic(toplayeridscore);
    }
    else 
SendClientMessage(playeridCOLOR_RED"Invalid Option.");
    return 
1;

Reply


Messages In This Thread
How to add options instead of one option - by Oshery - 19.01.2018, 07:12
Re: How to add options instead of one option - by FreAkeD - 19.01.2018, 09:38
Re: How to add options instead of one option - by iamjems - 19.01.2018, 13:25
Re: How to add options instead of one option - by BulletRaja - 19.01.2018, 14:44
Re: How to add options instead of one option - by Oshery - 19.01.2018, 14:55
Re: How to add options instead of one option - by BulletRaja - 19.01.2018, 15:03
Re: How to add options instead of one option - by Inn0cent - 19.01.2018, 15:05
Re: How to add options instead of one option - by Oshery - 19.01.2018, 16:30
Re: How to add options instead of one option - by BulletRaja - 20.01.2018, 06:56
Re: How to add options instead of one option - by Oshery - 20.01.2018, 10:57

Forum Jump:


Users browsing this thread: 4 Guest(s)