Map teleporting not working - 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: Map teleporting not working (
/showthread.php?tid=505354)
Map teleporting not working -
ChromeMenu - 08.04.2014
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;
}
Re: Map teleporting not working -
VishvaJeet - 08.04.2014
Код:
if(TeleEnabled[playerid] == 1 && PlayerInfo[playerid][pAdmin] >= 2)
this function will work only with level 2 Admin + teleEnaled
what you want ?
Re: Map teleporting not working -
ChromeMenu - 08.04.2014
Yes, that is what I want
Re: Map teleporting not working -
Ari - 08.04.2014
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.