Posts: 213
Threads: 51
Joined: Dec 2011
Reputation:
0
if(strcmp(cmd, "/givegcoin", true) == 0)
{
if(sscanf(cmd, "ud", giveplayerid, amount1)) return SendClientMessage(playerid, RED, "USAGE: /givegcoins [playerid] [Gold Coins]");
whats the wrong here ?
When i type /givegcoin my ID 1 it shows me
USAGE: /givegcoins [playerid] [Gold Coins]
Posts: 213
Threads: 51
Joined: Dec 2011
Reputation:
0
if(strcmp(cmd, "/givegcoin", true) == 0)
{
if(sscanf(cmd, "ud", giveplayerid, amount1)) return SendClientMessage(playerid, RED, "USAGE: /givegcoins [playerid] [Gold Coins]");
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That player is not connected!");
if(giveplayerid == playerid) return SendClientMessage(playerid, RED, "ERROR: You cant send yourself coins!");
if(amount1 > PlayerInfo[playerid][pGoldcoin]) return SendClientMessage(playerid, RED, "ERROR: You dont have that amount of gold coins!");
new sstring[ 256 ];
new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(giveplayerid, Global_Name, sizeof(Global_Name));GetPlayerName(playerid,Name,s izeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),Name);
format(tmp, sizeof(tmp), "You have succesfully sent %d gold coins to %s(%d)!", amount1, Global_Name, playerid);
SendClientMessage(playerid, YELLOW, sstring);
format(tmp, sizeof(tmp), "%s(%d) has given to you %d amount of gold coins!", Name, playerid, amount1);
SendClientMessage(giveplayerid, YELLOW, sstring);
PlayerInfo[giveplayerid][pGoldcoin] += amount1;
PlayerInfo[playerid][pGoldcoin] -= amount1;
return 1;
}
Posts: 213
Threads: 51
Joined: Dec 2011
Reputation:
0
same problem when i type /givegcoin ID 1 it shows me
if(sscanf(cmd, "ui", giveplayerid, amount1)) return SendClientMessage(playerid, RED, "USAGE: /givegcoins [playerid] [Gold Coins]");
Posts: 1,274
Threads: 54
Joined: Jul 2012
Код:
format(tmp, sizeof(tmp), "You have succesfully sent %d gold coins to %s(%d)!", amount1, Global_Name, playerid);
Why don't you have it set to 'GetPlayerNameEx' ?
instead of having it
playerid? It's getting the player who typed the command, not who he gave it to.