SendClientMessage(playerid,COLOR_GREEN,"You have sent %s to %s!",amount,name);
warning 202: number of arguments does not match definition
new string[258];
format(string, sizeof(string), "You have sent %s to %s!", amount, name);
SendClientMessage(playerid,COLOR_GREEN, string);
CMD:givecash(playerid,params[])
{
new
id,
amount;
if (sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
else
{
GivePlayerMoney(id,amount);
new string[19];
new string1[19];
format(string, sizeof(string), "You have sent %s to %s",amount,id);
format(string1, sizeof(string1), "You have recieved % from %s",amount,id);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(id, COLOR_GREEN, string1);
}
return 1;
}
CMD:givecash(playerid,params[])
{
new
id,
amount;
if (sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
else
{
GivePlayerMoney(id,amount);
new string[19];
new string1[19];
format(string, sizeof(string), "You have sent %d to %s",amount,id);
format(string1, sizeof(string1), "You have recieved %d from %s",amount,id);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(id, COLOR_GREEN, string1);
}
return 1;
}
%b Inserts a number at this position in binary radix %c Inserts a single character. %d Inserts an integer (whole) number %f Inserts a floating point number. %i Inserts an integer. %s Inserts a string. %x Inserts a number in hexadecimal notation. %% Inserts the literal '%'
pawn Код:
|
CMD:givecash(playerid,params[])
{
new
id,
amount;
if(sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
else
{
GivePlayerMoney(id,amount);
new str[40+MAX_PLAYER_NAME];
format(str, sizeof(str), "You have sent %d to %s",amount,id);
SendClientMessage(playerid, COLOR_GREEN, str);
format(str, sizeof(str), "You have recieved %d from %s",amount,id);
SendClientMessage(id, COLOR_GREEN, str);
}
return 1;
}
The string size is to small as well and there is no need to create 2 different strings.
pawn Код:
|
CMD:givecash(playerid,params[])
{
new
id,
amount;
if(sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
else
{
new
szPName[MAX_PLAYER_NAME];
GivePlayerMoney(id,amount);
new str[40+MAX_PLAYER_NAME];
GetPlayerName(id, szPName, MAX_PLAYER_NAME);
format(str, sizeof(str), "You have sent %d to %s",amount,szPName);
SendClientMessage(playerid, COLOR_GREEN, str);
GetPlayerName(playerid, szPName, MAX_PLAYER_NAME);
format(str, sizeof(str), "You have recieved %d from %s",amount,szPName);
SendClientMessage(id, COLOR_GREEN, str);
}
return 1;
}
CMD:givecash(playerid,params[])
{
new
id,
amount;
if(sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
else
{
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
GivePlayerMoney(id,amount);
new str[40+MAX_PLAYER_NAME];
format(str, sizeof(str), "You have sent %d to %s",amount,PlayerName);
SendClientMessage(playerid, COLOR_GREEN, str);
format(str, sizeof(str), "You have recieved %d from %s",amount,name);
SendClientMessage(id, COLOR_GREEN, str);
}
return 1;
}