code.. -
RBTDM - 14.11.2011
Hello!
this code is having a problem with playerid, can any one please fix it ?
pawn Код:
CMD:country(playerid,params[]) {
if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /Country [playerid]");
new player1 = strval(params), string[128];
new dsname[MAX_PLAYER_NAME];
GetPlayerName(playerid, dsname, sizeof(dsname));
format(string, sizeof(string), "** %s [ID: %s] Country: %s", dsname,player1,GetPlayerCountryName(player1));
SendClientMessage(playerid,green, string);
return 1;}
Re: code.. -
RBTDM - 14.11.2011
the problem in playerid , i cant see another player country by using /country id
if i type /country 6 ,then it will show my country
Re: code.. -
RBTDM - 14.11.2011
help.....
Re: code.. -
Unte99 - 14.11.2011
pawn Код:
CMD:country(playerid,params[])
{
new player1, string[128],dsname[MAX_PLAYER_NAME];
if(sscanf(params,"i",player1)) return SendClientMessage(playerid, red, "USAGE: /Country [playerid]");
GetPlayerName(player1, dsname, sizeof(dsname));
format(string, sizeof(string), "** %s [ID: %s] Country: %s", dsname,player1,GetPlayerCountryName(player1));
SendClientMessage(playerid,green, string);
return 1;
}
pawn Код:
GetPlayerName(playerid, dsname, sizeof(dsname));
You use GetPlayerName with playerid. playerid is the player who uses the command. So it will never effect other players. You have to use the sscanf params.
It's what ****** told you, but i guess you didn't understand.
Re: code.. -
RBTDM - 14.11.2011
still its like that...
Re: code.. -
Unte99 - 14.11.2011
Edited it, try again.
Re: code.. -
RBTDM - 14.11.2011
Can you please fix this, i mean } else return SendClientMessage(playerid, red, "Player is not connected");}
pawn Код:
CMD:country(playerid,params[])
{
new string[128],dsname[MAX_PLAYER_NAME];
if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /Country [playerid]");
new player1 = strval(params);
GetPlayerName(player1, dsname, sizeof(dsname));
format(string, sizeof(string), "** %s [ID: %s] Country: %s", dsname,player1,GetPlayerCountryName(player1));
SendClientMessage(playerid,green, string);
} else return SendClientMessage(playerid, red, "Player is not connected");}
Re: code.. -
Unte99 - 14.11.2011
Did you really try this script:
pawn Код:
CMD:country(playerid,params[])
{
new player1, string[128],dsname[MAX_PLAYER_NAME];
if(sscanf(params,"i",player1)) return SendClientMessage(playerid, red, "USAGE: /Country [playerid]");
GetPlayerName(player1, dsname, sizeof(dsname));
format(string, sizeof(string), "** %s [ID: %s] Country: %s", dsname,player1,GetPlayerCountryName(player1));
SendClientMessage(playerid,green, string);
return 1;
}
?
Does the script compile ?
Re: code.. -
RBTDM - 14.11.2011
Yes the scriptis ok but i needed this also
pawn Код:
} else return SendClientMessage(playerid, red, "Player is not connected");}
Re: code.. -
Unte99 - 14.11.2011
Here you go:
pawn Код:
CMD:country(playerid,params[])
{
new player1, string[128],dsname[MAX_PLAYER_NAME];
if(sscanf(params,"i",player1)) return SendClientMessage(playerid, red, "USAGE: /Country [playerid]");
if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, red, "That player isn't connected.");
GetPlayerName(player1, dsname, sizeof(dsname));
format(string, sizeof(string), "** %s [ID: %s] Country: %s",dsname,player1,GetPlayerCountryName(player1));
SendClientMessage(playerid,green, string);
return 1;
}