Map teleporting not working
#1

When I enable map teleporting, it doesn't teleport where I click on the map.

Код:
new TeleEnabled[MAX_PLAYERS];
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    if(TeleEnabled[playerid] == 1 && PlayerInfo [playerid][pAdmin] >= 2)
    {
    SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
}

CMD:maptp(playerid,params[])
{
    if(TeleEnabled[playerid] == 0)
    {
    TeleEnabled[playerid] = 1;
    SendClientMessage(playerid,WHITE,"You have enabled map teleporting!");
    return 0;
    }
    if(TeleEnabled[playerid] == 1)
    {
    TeleEnabled[playerid] = 0;
    SendClientMessage(playerid,WHITE,"You have disabled map teleporting!");
    return 0;
    }
    return 1;
}
Reply
#2

Код:
if(TeleEnabled[playerid] == 1 && PlayerInfo[playerid][pAdmin] >= 2)
this function will work only with level 2 Admin + teleEnaled
what you want ?
Reply
#3

Yes, that is what I want
Reply
#4

pawn Код:
new tele_Enabled[MAX_PLAYERS]; // Global scope


public OnPlayerClickMap(playerod, FLoat:fX, Float:fY, Float:fZ)
{
    if(tele_Enabled[playerid == 1 && PlayerInfo[playerid][pAdmin] >= 2)
    {
        SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    else break;
    return 1;
}

CMD:togglemaptp(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COL_GREY, "ERR: You cannot use this command!"):
   
    if(tele_Enabled[playerid] == 0)
    {
        tele_Enabled[playerid] = 1;
        SendClientMessage(playerid, COL_GREY, "SRV: You have enabled click-map teleportation!"):
    }
    else
    {
        tele_Enabled[playerid] = 0;
        SendClientMessage(playerid, COL_GREY, "SRV: You have disabled click-map teleportation!");
    }
    return 1;
}
I suggest using Player Variable Integers instead.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)