How To Disable Player To Teleport?
#1

guys i made a dm teleport and i just need to know how to disable the player to teleport if he is inside the DM? so he wont teleport to any place and kill the people in the server - btw here is my code to the teleport
Код:
GivePlayerWeapon(playerid, 38, 50000000);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /mgdm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new Random = random(sizeof(RandomSpawns));
        SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
        SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
Reply
#2

new CanTeleport[MAX_PLAYERS];

Use if(CanTeleport[playerid] == 1/0)

Then CanTeleport[playerid] = 1/0;
Reply
#3

pawn Код:
// Global variable
new
    tog_tp[ MAX_PLAYERS ]
;
// OnPlayerConnect
tog_tp[ playerid ] = 0;
// There you want to disable it add
tog_tp[ playerid ] = 1;
// Message that doesn't allow player to teleport
if( tog_tp == 1 ) return SendClientMessage( playerid, -1, "You cannot teleport there" );
// There you want to enable it add
tog_tp[ playerid ] = 0;
// OnPlayerDisconnect
tog_tp[ playerid ] = 0;
Reply
#4

i just used the wiki thing and then i made it work - i solved it by myself xD all i made is this

Код:
public ResetPlayerWeaponsEx(playerid,...)
{
	new W[] =
	{
		0,0,1,1,1,1,1,1,1,1,10,10,10,10,10,10,8,8,
		8,0,0,0,2,2,2,3,3,3,4,4,5,5,4,6,6,7,7,7,7,
		8,12,9,9,9,11,11,11,11
	};

	new
		idx = 0,
		tmp = 0,
		weapons,
 	 	args = numargs() - 1,
		bool:Reset[13] = {true,...};


	if(IsPlayerConnected(playerid))
	{
		if(args > 0)
		{
		    if(args <= 46)
		    {
				while(args > idx++)
				{
				    new wep = getarg(idx);

					if(0 <= wep <= 46)
					{
					    GetPlayerWeaponData(playerid,W[wep],weapons,tmp);

						if(weapons == wep)
						{
							Reset[W[wep]] = false;
						}
					}
					else
					{
		   				printf("ResetPlayerWeaponEx warning: invalid argument (argument: #%d)! \"%d\" is not a valid weapon!", idx+1,wep);
					}
				}

				for(new a = 0; a < 13; a ++)
				{
				    if(Reset[a])
				    {
				        GetPlayerWeaponData(playerid,a,weapons,tmp);

				        if(weapons)
				        {
	       					SetPlayerAmmo(playerid,weapons,0);

							weapons = -1;
						}
					}
				    else
				    {
						Reset[a] = true;
				    }
				}
				return 1;
			}
		    print("ResetPlayerWeaponsEx Error: You have specified over 46 weapons! Check for duplicate weapons");
		    return 1;
		}
		ResetPlayerWeapons(playerid);
		return 1;
	}
	return 1;
}
then used

Код:
ResetPlayerWeaponsEx(playerid, 46);
resetplayerweapons is used to remove all the weapons to a teleport except the weapon 46 - parachute as i made it so i typed that over every teleport i want the minigun to be removed and it works!!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)