code..
#1

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;}
Reply
#2

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
Reply
#3

help.....
Reply
#4

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.
Reply
#5

still its like that...
Reply
#6

Edited it, try again.
Reply
#7

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");}
Reply
#8

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 ?
Reply
#9

Yes the scriptis ok but i needed this also
pawn Код:
} else return SendClientMessage(playerid, red, "Player is not connected");}
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)