04.04.2009, 13:38
Why does this script crash?
I defined name earlier in the script, and i used the goto only on myself (because there's nobody else on my server).
Do anybody have a idea?
pawn Код:
if(!strcmp(cmd, "/goto", true))
{
//News
new otherplayer;
tmp = strtok(cmdtext, idx);
//strlen
if(!strlen(tmp))
{
SendClientMessage(playerid, RED,"USAGE: /goto [playerid]");
return 1;
}
//strval
otherplayer = strval(tmp);
//Playerid = Connected
if(IsPlayerConnected(otherplayer))
{
//News
new interior;
new othername[MAX_PLAYER_NAME];
//Gets
GetPlayerName(otherplayer, othername, sizeof(othername));
GetPlayerPos(otherplayer, px, py, pz);
interior = GetPlayerInterior(otherplayer);
//Sets
SetPlayerInterior(playerid, interior);
SetPlayerPos(playerid, px, py, pz+2);
//Text
SendClientMessage(playerid, GREEN, "You've been teleported to %s (ID %d)!, othername, otherplayer");
SendClientMessage(otherplayer, GREEN, "%s (ID %d) has been teleported to you!, name, playerid");
format(string, sizeof(string), "%s (ID %d) is teleported to %s (ID %d). ", name, playerid, othername, otherplayer);
print(string);
return 1;
}
else
{
SendClientMessage(playerid, RED, "That player isn't online!");
}
return 1;
}
Do anybody have a idea?