SA-MP Forums Archive
Teleport - 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)
+--- Thread: Teleport (/showthread.php?tid=443610)



Teleport - lsreskjn - 12.06.2013

Hey all, i want to make a teleport..something like this

Код:
if (strcmp("/pq", cmdtext, true, 10) == 0)
	{
		SetPlayerPos(playerid, 1519.7275,-1659.0162,13.2662,184.9231);
		SendClientMessage(playerid, "You have teleported to Pershing Square");
		SendClientMessageToAll(-1, "blablabla!");
		return 1;
	}
	return 0;
The problem is i want everyone to see that the player has teleported but i dont know what to put in the SendMessageToAll to show his name


Re: Teleport - ReVo_ - 12.06.2013

pawn Код:
if (strcmp("/pq", cmdtext, true) == 0)
    {
        SetPlayerPos(playerid, 1519.7275,-1659.0162,13.2662,184.9231);
        SendClientMessage(playerid, "You have teleported to Pershing Square");
                new name [MAX_PLAYER_NAME]; // variabile where you store his name
                GetPlayerName (playerid, name, 24); // here you get his name, 24 = MAX_PLAYER_NAME you can use MAX_PLAYER_NAME too
                new name[128]; // i used 128 here, but you can balance the size based on your message: has teleported to length: 21 + 24 (player name) + 1 (\0) + x (place length)
                format (string, sizeof string, "%s has teleported to blabla", name);
        SendClientMessageToAll(-1, string);
        return 1;
    }
    return 0;



Re: Teleport - lsreskjn - 12.06.2013

oh, thats to complicated i got error, im not sure how to make it work, the stored name


Re: Teleport - ReVo_ - 12.06.2013

if you compile the code you get an error? Can you share the error?


Re: Teleport - lsreskjn - 12.06.2013

here it is


Re: Teleport - Riddick94 - 12.06.2013

pawn Код:
SetPlayerPos(playerid, 1519.7275,-1659.0162,13.2662,184.9231);
Four arguments? Should be X, Y, Z only, and Angle can be set in other function.


Re: Teleport - feartonyb - 12.06.2013

Код:
if (strcmp("/pq", cmdtext, true) == 0)
    {
        SetPlayerPos(playerid, 1519.7275,-1659.0162,13.2662,184.9231);
        SendClientMessage(playerid, "You have teleported to Pershing Square"");
        new sendname [MAX_PLAYER_NAME];
        GetPlayerName (playerid, sendname, MAX_PLAYER_NAME);
        new sendstring[128];
        format (sendstring, sizeof sendstring, "%s has teleported to Pershing Square", sendname);
        SendClientMessageToAll(-1, sendstring);
        return 1;
    }



Re: Teleport - lsreskjn - 12.06.2013

feartonyb

i got only 2 error now

C:\Users\kjn\Desktop\Untitled.pwn(94) : error 035: argument type mismatch (argument 2)
C:\Users\kjn\Desktop\Untitled.pwn(97) : warning 219: local variable "sendstring" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Teleport - feartonyb - 12.06.2013

Sry missed something

Код:
if (strcmp("/pq", cmdtext, true) == 0)
    {
        SetPlayerPos(playerid, 1519.7275,-1659.0162,13.2662);
        SendClientMessage(playerid, "You have teleported to Pershing Square"");
        new sendname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sendname, sizeof(sendname));
        new senderstring[128];
        format (senderstring, sizeof(senderstring), "%s has teleported to Pershing Square", sendname);
        SendClientMessageToAll(-1, senderstring);
        return 1;
    }



Re: Teleport - lsreskjn - 12.06.2013

I still got (94) : error 035: argument type mismatch (argument 2)

on line:

Код:
 SendClientMessage(playerid, "You have teleported to Pershing Square");