SA-MP Forums Archive
/goto help variable - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /goto help variable (/showthread.php?tid=154239)



/goto help variable - Kar - 12.06.2010

Код:
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.



Re: /goto help variable - Hiddos - 12.06.2010

Which line is line 789?


Re: /goto help variable - Kar - 12.06.2010

Код:
new tmpplayer = tmp;



Re: /goto help variable - Carlton - 12.06.2010

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



Re: /goto help variable - (SF)Noobanatior - 12.06.2010

new tmpplayer = strval(tmp);

try that


Re: /goto help variable - Kar - 12.06.2010

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


Re: /goto help variable - Carlton - 12.06.2010

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



Re: /goto help variable - Kar - 12.06.2010

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