OnPlayerClickPlayer
#4

This should work.

pawn Код:
#define         TELEPORT_XOFFSET            2.0
#define         TELEPORT_YOFFSET            2.0

new bool:AllowClickTeleport[MAX_PLAYERS] = { true, ... };

CMD:ctele(playerid, arg[])
{
    if(AllowClickTeleport[playerid])
    {
        AllowClickTeleport[playerid] = false;
        SendClientMessage(playerid, COLOR_RED, "You have disabled teleport clicking");
    }
    else
    {
        AllowClickTeleport[playerid] = true;
        SendClientMessage(playerid, COLOR_RED, "You have enabled teleport clicking");
    }
    return 1;
}


public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    if(Teleport[playerid] == 1 || indeathmatch[playerid] == 1) SendClientMessage(playerid, COLOR_RED, "Exit the DM first");
    else
    {
        if(Teleport[playerid] == 1 || indeathmatch[playerid] == 1) SendClientMessage(playerid, COLOR_RED, "That player is in a DM");
        else
        {
            if(AllowClickTeleport[clickedplayerid])
            {
                new Float: X,Float:Y, Float:Z, string[70];
                GetPlayerPos(clickedplayerid, X,Y,Z);
                SetPlayerPos(playerid, X+TELEPORT_XOFFSET,Y+TELEPORT_YOFFSET,Z);
                format(string, sizeof(string), "You have teleported to ID: %i", clickedplayerid);
            }
            else SendClientMessage(playerid, COLOR_RED, "That player has teleporting disabled");
        }
    }
    return 1;
}
Reply


Messages In This Thread
OnPlayerClickPlayer - by DarkB0y - 26.04.2013, 15:55
Re: OnPlayerClickPlayer - by RaZzZzoR - 26.04.2013, 16:02
Re: OnPlayerClickPlayer - by DarkB0y - 26.04.2013, 16:09
Re: OnPlayerClickPlayer - by Pottus - 26.04.2013, 16:37

Forum Jump:


Users browsing this thread: 1 Guest(s)