28.10.2014, 22:37
(
Последний раз редактировалось Abagail; 29.10.2014 в 20:55.
)
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:
Callbacks:
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:
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#
Functions:
pawn Код:
public TogglePlayerTeleport(playerid, bool: status, bool: vehicle=true)
pawn Код:
public GetPlayerTeleportStatus(playerid);
pawn Код:
public GetPlayerVehicleTeleportStatus(playerid);
pawn Код:
public OnPlayerTeleport(playerid, weaponid, fX, fY, fZ, hittype, hitid=INVALID_HIT_TYPE);
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;
}
- 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#