Teleport
#1

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
Reply
#2

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;
Reply
#3

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

if you compile the code you get an error? Can you share the error?
Reply
#5

here it is
Reply
#6

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.
Reply
#7

Код:
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;
    }
Reply
#8

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.
Reply
#9

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;
    }
Reply
#10

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

on line:

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


Forum Jump:


Users browsing this thread: 1 Guest(s)