Help!?
#1

How do when someone teleports me to defend me in chat.

Exemple: Admins has teleport to you.
Reply
#2

Here's an example of a 'goto' command which informs the player when someone teleports to him/her -

pawn Код:
CMD:go(playerid,params[])
{
    new ID;
    if(sscanf(params, "u", ID)) return GameTextForPlayer(playerid,"~g~Usage: ~n~~w~/Go <ID>",2000,3);
    else if(!IsPlayerConnected(ID) || ID == playerid) return GameTextForPlayer(playerid,"~g~Error: ~n~~w~Player Is not connected",2000,3);
    else
    {
    new Float:x, Float:y, Float:z;
    new name[MAX_PLAYER_NAME+1],name2[MAX_PLAYER_NAME+1], string[40+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(ID, name2, sizeof(name2));
    GetPlayerPos(ID, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z+1);
    format(string,sizeof(string),"{99FF00}>> %s(%d) has teleported to you. (/go)",name, playerid);
    SendClientMessage(ID,0xFFFFFFc8,string);
    format(string,sizeof(string),"{99FF00}>> You have teleported to %s. (/go)",name2, ID);
    SendClientMessage(playerid,0xFFFFFFc8,string);
    }
    return 1;
}
Reply
#3

pawn Код:
new Float:x, Float:y, Float:z;
46283            new name[MAX_PLAYER_NAME+1],name2[MAX_PLAYER_NAME+1], string[40+MAX_PLAYER_NAME+1];
            GetPlayerName(playerid, name, sizeof(name));
            GetPlayerName(playerid, name2, sizeof(name2));
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(playerid, x+1, y+1, z+1);
            format(string,sizeof(string),"{99FF00}>> %s(%d) has teleported to you. (/goto)",name, playerid);
            SendClientMessage(playerid,0xFFFFFFc8,string);
            format(string,sizeof(string),"{99FF00}>> You have teleported to %s. (/goto)",name2, playerid);
            SendClientMessage(playerid,0xFFFFFFc8,string);
        }
        return 1;
    }

pawn Код:
C:\Documents and Settings\Madalin\Desktop\GM\gamemodes\Godfather.pwn(46283) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:          11920 bytes
Code size:          2658036 bytes
Data size:          7236240 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 9922580 bytes

1 Warning.
Reply
#4

Hello,

PHP код:
CMD:go(playerid,params[])
{
    new 
ID;
    if(
sscanf(params"u"ID)) return GameTextForPlayer(playerid,"~g~Usage: ~n~~w~/Go <ID>",2000,3);
    else if(!
IsPlayerConnected(ID) || ID == playerid) return GameTextForPlayer(playerid,"~g~Error: ~n~~w~Player Is not connected",2000,3);
    else
    {
    new 
Float:xFloat:yFloat:z,stringg[40+MAX_PLAYER_NAME+1];
    
GetPlayerPos(IDxyz);
    
SetPlayerPos(playeridx+1y+1z+1);
    
format(stringg,sizeof(stringg),"{99FF00}>> %s(%d) has teleported to you. (/go)",GetName(playerid));
    
SendClientMessage(ID,0xFFFFFFc8,stringg);
    
format(stringg,sizeof(stringg),"{99FF00}>> You have teleported to %s. (/go)",GetName(ID));
    
SendClientMessage(playerid,0xFFFFFFc8,stringg);
    }
    return 
1;
}
stock GetName(playerid);
{
    new 
szName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridszNamesizeof(szName));
    return 
szName;

Reply
#5

Why are you getting the player's name and saving it into a variable then using GetName(playerid);
Reply
#6

hmm, nvm, me iz too slow
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)