SA-MP Forums Archive
[HELP]To ignore teleport to player - 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: [HELP]To ignore teleport to player (/showthread.php?tid=612495)



[HELP]To ignore teleport to player - alekschowee - 18.07.2016

How to igrnore player to teleport /goto [playerid] and to disable /nogoto
Код:
if(strcmp(cmd, "/goto", true) == 0)
	{
	 if(PlayerInfo[playerid][pJail] == 1)
	{
     SendClientMessage(playerid, COLOR_RED, "Не можеш да се телепортираш докато си в затвора!");
     return 1;
	 }
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "Използвай: /goto [Playerid/PartOfName]");
				return 1;
			}
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			new Float:plocx,Float:plocy,Float:plocz;
			new plo;
			plo = ReturnUser(tmp);
			if (IsPlayerConnected(plo))
			{
			    if(plo != INVALID_PLAYER_ID)
			    {
                        {
						GetPlayerPos(plo, plocx, plocy, plocz);
						SetPlayerInterior(playerid, GetPlayerInterior(plo));
						SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(plo));
						if (GetPlayerState(playerid) == 2)
						{
							new tmpcar = GetPlayerVehicleID(playerid);
							SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
							TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
						}
						else
						{
							SetPlayerPos(playerid,plocx,plocy+2, plocz);
						}
				        SendClientMessage(plo, COLOR_WHITE, string);
				        SendClientMessage(playerid, COLOR_WHITE, string);
					}
				}
			}
			else
			{
				format(string, sizeof(string), "ID-то, което посочи не е в сървъра.");
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}



Re: [HELP]To ignore teleport to player - GuyB790 - 19.07.2016

Make a global variable playerIgnoreTeleports[MAX_PLAYERS]. Once that's done make commands to set it to 1 or 0.

Once trying to goto to another player, check their playerIgnoreTeleports[targetPlayerid]'s value and block them accordingly.