help me change cmd
#1

it is possible to change this command to give score


CMD:givecash(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 3) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /givecash [playerid] [amount]");
new player1 = strval(tmp), cash = strval(tmp2), string[128];
if(PlayerInfo[player1][Level] == 8 && PlayerInfo[playerid][Level] != return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
CMDMessageToAdmins(playerid,"GIVECASH");
format(string, sizeof(string), "You have given '$%d to \"%s\", ", cash, pName(player1)); SendClientMessage(playerid,blue,string);
if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has given you '$%d'", pName(playerid), cash); SendClientMessage(player1,blue,string); }
return GivePlayerMoneyEx(player1, cash);
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Reply
#2

Quote:
Originally Posted by nbx2000
Посмотреть сообщение
it is possible to change this command to give score


CMD:givecash(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 3) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /givecash [playerid] [amount]");
new player1 = strval(tmp), cash = strval(tmp2), string[128];
if(PlayerInfo[player1][Level] == 8 && PlayerInfo[playerid][Level] != return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
CMDMessageToAdmins(playerid,"GIVECASH");
format(string, sizeof(string), "You have given '$%d to \"%s\", ", cash, pName(player1)); SendClientMessage(playerid,blue,string);
if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has given you '%i'", pName(playerid), cash); SendClientMessage(player1,blue,string); }
return GivePlayerMoneyEx(player1, cash);
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
PHP код:
CMD:givescore(playerid,params[])
{
    if(
PlayerInfo[playerid][Level] >= 3)
     {
        new 
tmp[128], tmp2[128], Indextmp strtok(params,Index), tmp2 strtok(params,Index);
        if(
isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playeridred"USAGE: /givescore [playerid] [amount]");
        new 
player1 strval(tmp), amount strval(tmp2), string[128];
        if(
PlayerInfo[player1][Level] == && PlayerInfo[playerid][Level] !=  return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(
IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            
CMDMessageToAdmins(playerid,"GIVESCORE");
            
format(stringsizeof(string), "You have given '%i to \"%s\", "amountpName(player1));
            
SendClientMessage(playerid,blue,string);
            if(
player1 != playerid)
            {
                
format(string,sizeof(string),"Administrator \"%s\" has given you '%i'"pName(playerid), amount);
                
SendClientMessage(player1,blue,string);
            }
            return 
GivePlayerScore(player1amount);
    }
    else return 
SendClientMessage(playerid,red,"ERROR: Player is not connected");
}
else return 
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");

Also it's quiet easy man , just change "GivePlayerMoneyEX" to "GivePlayerScore" and change the variable "cash" to "amount". Also sscanf is better but here you go.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)