[Include] Teleportation Include - A simple teleportation method.
#1

Basically, - this makes use of the WeaponShot functions in 0.3z, allowing players to teleport around the map by shooting a weapon. This is pretty straight forward, how-ever it has some neat functions.

Functions:
pawn Код:
public TogglePlayerTeleport(playerid, bool: status, bool: vehicle=true)
pawn Код:
public GetPlayerTeleportStatus(playerid);
pawn Код:
public GetPlayerVehicleTeleportStatus(playerid);
Callbacks:
pawn Код:
public OnPlayerTeleport(playerid, weaponid, fX, fY, fZ, hittype, hitid=INVALID_HIT_TYPE);
Players can only teleport if they have it enabled. Besides normal map teleporting, players can also teleport into vehicles.

For normal world shooting, you can choose wheter or not to find a better Z ground position(using SetPlayerPosFindZ), or not(enabled by default, - #DISABLE_Z_SETPOS to turn off).

This include uses y_hooks, and since the OnPlayerWeaponShot is hooked, you'll need the latest version(I believe it's 4.0?).

Additionally, whenever a player teleports the OnPlayerTeleport callback gets called accordingly. As of now, a player cannot teleport to an object.

My simple testing script:
pawn Код:
#include a_samp
#include teleport
#include zcmd

CMD:teleport(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new tpstatus = GetPlayerTeleportStatus(playerid);
        if(tpstatus)
        {
            TogglePlayerTeleport(playerid, false);
            SendClientMessage(playerid, -1, "Teleportation disabled.");
        }
        else
        {
            TogglePlayerTeleport(playerid, true);
            SendClientMessage(playerid, -1, "Teleportation enabled.");
        }
    }
    return true;
}
Update 1:
- You can disallow vehicle teleportation by using TogglePlayerTeleport(.., ..., false). You can also use GetPlayerVehicleTeleportStatus to check if a player is authorized for vehicle teleportation.

http://pastebin.com/kTp62SQi#
http://pastebin.com/AQzKdeL2NEW DOWNLOAD
http://pastebin.com/nDyxGQNc#
Reply
#2

Very nice, another good release from Evan!

-leppi
Reply
#3

It says the newer version has been removed.
Reply
#4

It hasn't been. Here's a direct link for the YSI library,
https://codeload.github.com/Y-Less/Y...des/zip/YSI.tl
NOTE: You'll need zeex's amx assembly inside the YSI/amx folder(https://github.com/Zeex/amx_assembly)
Reply
#5

Oh, my bad, it's just that I pressed the first link without looking and it had the "- NEW VERSION" in the URL. Should be [ url ]http://pastebin.com/AQzKdeL2[ /url ].
Reply
#6

My bad, fixed.
Reply
#7

Great work, Keep it up.
Reply
#8

Version 3:
- OnPlayerTeleport now includes the hitid. For backwards compatibility it is not a required param.
(http://pastebin.com/5ndFz4vR#)
Reply
#9

A weaponid check can be allowed so that it can be processed on the defined weapons only. Otherwise it could create a lot of spams if being overused and can probably be used as an exploit.

pawn Код:
AllowTeleportWeapon(playerid, weapons[MAX_WEAPONS] = {-1, ...});
Reply
#10

Well, - there shouldn't be anything to exploit, as you should only allow trusted players to teleport. How-ever, I will implement weapon restriction ability in (a) future update(s).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)