/goto help variable
#1

Код:
if(strcmp(cmd, "/goto", true) == 0)
  {
    new str[128];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, 0xbbff0000 , "/goto [playerid]");
      return 1;
    }
    new tmpplayer = tmp;
    new Float:tmpx, Float:tmpy, Float:tmpz;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(tmpplayer, name, sizeof(name));
    GetPlayerPos(tmpplayer, tmpx, tmpy, tmpz);
    SetPlayerPos(playerid, tmpx, tmpy, tmpz+1);
    format(str, sizeof(str), "You have teleported to %s(ID:%d)", name, tmpplayer);
    SendClientMessage(playerid, 0x00bbbb00 , str);
    return 1;
  }
Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(789) : error 033: array must be indexed (variable "-unknown-")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Which line is line 789?
Reply
#3

Код:
new tmpplayer = tmp;
Reply
#4

pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
  {
   new str[128];
   tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, 0xbbff0000 , "/goto [playerid]");
      return 1;
    }
    new tmpplayer = strval(tmp);
    new Float:tmpx, Float:tmpy, Float:tmpz;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(tmpplayer, name, sizeof(name));
    GetPlayerPos(tmpplayer, tmpx, tmpy, tmpz);
    SetPlayerPos(playerid, tmpx, tmpy, tmpz+1);
    format(str, sizeof(str), "You have teleported to %s(ID:%d)", name, tmpplayer);
    SendClientMessage(playerid, 0x00bbbb00 , str);
    return 1;
  }
Reply
#5

new tmpplayer = strval(tmp);

try that
Reply
#6

ok thx no errors how to make a gethere now<.<
Reply
#7

Quote:
Originally Posted by Kar
ok thx no errors how to make a gethere now<.<
pawn Код:
if(strcmp(cmd, "/gethere", true) == 0)
  {
    new str[128];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, 0xbbff0000 , "/gethere[playerid]");
      return 1;
    }
    new tmpplayer = strval(tmp);
    new Float:tmpx, Float:tmpy, Float:tmpz;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(tmpplayer, name, sizeof(name));
    GetPlayerPos(playerid, tmpx, tmpy, tmpz);
    SetPlayerPos(tmpplayer, tmpx, tmpy, tmpz+1);
    format(str, sizeof(str), "You have teleported %s(ID:%d) to you.", name, tmpplayer);
    SendClientMessage(playerid, 0x00bbbb00 , str);
    return 1;
  }
Reply
#8

ok thx. help me test for bugs? someone 72.51.89.208:7777
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)