Help with /hi
#1

The command does not work.

Код:
if (strcmp(cmd, "/hi", true) == 0)
  {
    new tmp[256],id;
    tmp = strtok(cmdtext, idx);
    if (!strlen(tmp)) return SendClientMessage(playerid, 0xFF0000AA, "ПРИМИНЕНИЕ: /hi id "); 
    id = strval(tmp);
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Такой игрок не подключён!");
    new string[255],plname[24],idname[24];
    GetPlayerName(playerid,plname,sizeof(plname));
    GetPlayerName(id,idname,sizeof(idname));
    format(string,sizeof(string),".:: %s приветствует %s",plname,idname);
    SendClientMessageToAll(0x00FF00AA,string);
    return 1;
  }
2 Warnings:
Код:
warning 219: local variable "tmp" shadows a variable at a preceding level
warning 219: local variable "string" shadows a variable at a preceding level
In what the reason?
Reply
#2

You already maked variables called "string" and "idx".

Код:
if (strcmp(cmd, "/hi", true) == 0)
  {
    new id;
    tmp = strtok(cmdtext, idx);
    if (!strlen(tmp)) return SendClientMessage(playerid, 0xFF0000AA, "ПРИМИНЕНИЕ: /hi id "); 
    id = strval(tmp);
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Такой игрок не подключён!");
    new plname[24],idname[24];
    GetPlayerName(playerid,plname,sizeof(plname));
    GetPlayerName(id,idname,sizeof(idname));
    format(string,sizeof(string),".:: %s приветствует %s",plname,idname);
    SendClientMessageToAll(0x00FF00AA,string);
    return 1;
  }
Reply
#3

Quote:
Originally Posted by Aram555
Код:
2 Warnings:
warning 219: local variable "tmp" shadows a variable at a preceding level
warning 219: local variable "string" shadows a variable at a preceding level
In what the reason?
What GTAguillaume should work..the reason is because you most likely have tmp and string already at the top of OnPlayerCommandText..
Reply
#4

How still to make the such:
%s (ID: %d) welcome %s (ID: %d)
does not show ID the correct
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)