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;
}
|
Originally Posted by MenaceX^
What crashes? your game/server/pawn?
|
|
Originally Posted by Torekk
Uhm, seriously, that's the problem I think, because you can't "goto" yourself. That's kinda like trying to add nitro to bikes or dividing by 0.
|
SendClientMessage(otherplayer, GREEN, "%s (ID %d) has been teleported to you!, name, playerid");
SendClientMessage(otherplayer, GREEN, "%s (ID %d) has been teleported to you!", name, playerid);




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", name, playerid);
new string[256]; format(string, 256, "You've been teleported to %s (ID %d)!", othername, otherplayer); SendClientMessage(playerid, GREEN, string); format(string, 256, "%s (ID %d) has been teleported to you!", name, playerid); SendClientMessage(otherplayer, GREEN, string);
|
Originally Posted by [MOB
Tr1viUm ]
You forgot to format the messages. Код:
new string[256]; format(string, 256, "You've been teleported to %s (ID %d)!", othername, otherplayer); SendClientMessage(playerid, GREEN, string); format(string, 256, "%s (ID %d) has been teleported to you!", name, playerid); SendClientMessage(otherplayer, GREEN, string); |