warnings
#1

pawn Код:
CMD:hi(playerid,params[])
{
    new player1,string[128];
    if(sscanf(params, "i",player1)) return SendClientMessage(playerid, 0xFF0000FF,"/hi [Player id]");
   
    format(string,sizeof(string),"%s Says Hi To %s", GetPlayerName(playerid),GetPlayerName(player1));
    SCMTA(COLOR_GREEN,string);
    return 1;
}

CMD:wb(playerid,params[])
{
    new Player1,string[128];
    if(sscanf(params,"i",Player1)) return SendClientMessage(playerid, 0xFF0000FF, "/wb [Player id]");
   
    format(string,sizeof(string),"Welcome Back \"%s\" (From: %s)",GetPlayerName(Player1),GetPlayerName(playerid));
    SCMTA(COLOR_GREEN,string);
    return 1;
}
pawn Код:
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38461) : warning 202: number of arguments does not match definition
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38461) : warning 202: number of arguments does not match definition
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38461) : warning 202: number of arguments does not match definition
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38461) : warning 202: number of arguments does not match definition
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38471) : warning 202: number of arguments does not match definition
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38471) : warning 202: number of arguments does not match definition
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38471) : warning 202: number of arguments does not match definition
C:\Users\carlo\Desktop\SA-MP Server\RolePlay\gamemodes\SATDM_v11.pwn(38471) : warning 202: number of arguments does not match definition
Reply
#2

Код:
 CMD:hi(playerid,params[])
{
    new player1,string[128];
    if(sscanf(params, "i",player1)) return SendClientMessage(playerid, 0xFF0000FF,"/hi [Player id]");


    format(string,sizeof(string),"%s Says Hi To %s", ReturnName(playerid),ReturnName(player1));
    SCMTA(COLOR_GREEN,string);
    return 1;
}

CMD:wb(playerid,params[])
{
    new Player1,string[128];
    if(sscanf(params,"i",Player1)) return SendClientMessage(playerid, 0xFF0000FF, "/wb [Player id]");
    
    format(string,sizeof(string),"Welcome Back \"%s\" (From: %s)",ReturnName(Player1),ReturnName(playerid));
    SCMTA(COLOR_GREEN,string);
    return 1;
}
Place this function in the end of the fs / gm, but not above that commands
Код:
stock ReturnName(playerid)
{
    new name[MAX_PLAYER_NAME];
   GetPlayerName(playerid,name,sizeof(name));
  return name;
}
The problem was that you didn not used the entire arguments of GetPlayerName function
Do not use GetPlayerName(playerid);
correct is GetPlayerName(playerid,string,sizeof(string)); ///you can define string with whatever you want example under

Код:
     new name[MAX_PLAYER_NAME], string[256];
    GetPlayerName(playerid,name,sizeof(name));
   format(string,sizeof(string),"Hello %s",name);
  SMT(-1,string);
Reply
#3

You need to use a variable the the player's name will be stored to that variable. Also, it's better to use the "r" specifier on sscanf.
pawn Код:
CMD:hi(playerid,params[])
{
    new player1,string[128], name1[ 24 ], namep[ 24 ];
    if(sscanf(params, "r",player1)) return SendClientMessage(playerid, 0xFF0000FF,"/hi [Player id]");
    GetPlayerName(playerid, namep, 24);
    GetPlayerName(player1, name1, 24);
    format(string,sizeof(string),"%s Says Hi To %s", namep, name1 );
    SCMTA(COLOR_GREEN,string);
    return 1;
}

CMD:wb(playerid,params[])
{
    new Player1,string[128], name1[ 24 ], namep[ 24 ];
    if(sscanf(params,"r",Player1)) return SendClientMessage(playerid, 0xFF0000FF, "/wb [Player id]");
    GetPlayerName(playerid, namep, 24);
    GetPlayerName(player1, name1, 24);
    format(string,sizeof(string),"Welcome Back \"%s\" (From: %s)",name1,namep);
    SCMTA(COLOR_GREEN,string);
    return 1;
}
@XStormiest
- It's slower than getting the name on the command.
Reply
#4

yeah but is more usefull , because you waste your time writing new
Код:
  new name[MAX_PLAYER_NAME], string[256];
    GetPlayerName(playerid,name,sizeof(name));
   format(string,sizeof(string),"Hello %s",name);
  SMT(-1,string);
AGAIN, and agian , and again...
Reply
#5

Sscanf "r" specifier can be used for both names and ID's. For Example: /hi gta. That will send me a message although my name is gtakillerIV.
Reply
#6

I know, but I never used "i" or "d" to commands and just to make sure it's correct.

I prefer wasting my time type it again and again as it'd get faster results in-game.
Reply
#7

"u" accepts, and get the id or the name of the player, when "i", "d", is used as variable and only for integrers, but you can also use it only for the id of the player
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)