09.05.2013, 11:18
(
Последний раз редактировалось Lordzy; 10.05.2013 в 17:17.
)
SetPlayerPosEx - It sets the player's position just like setplayerpos does and sets the player's vehicle position if player is in a vehicle and is a driver.
SetPlayerInteriorEx - Just like above mentioned, but sets the interior.
OnPlayerTeleport - Calls when 'SetPlayerPos' is being called in the script for player.
OnVehicleTeleport - Calls when 'SetVehiclePos' is being called in the script for vehicle.
Both the above callbacks requires to the hooked stuff to be added in scripts which uses teleportation or else the calls won't work well.
Functions which need to be added in every script which uses 'SetPlayerPos' or 'SetVehiclePos' if the callback must work perfectly. NOTE: Must be added before using those functions in the script or else it won't work well.
SetPlayerInteriorEx - Just like above mentioned, but sets the interior.
OnPlayerTeleport - Calls when 'SetPlayerPos' is being called in the script for player.
OnVehicleTeleport - Calls when 'SetVehiclePos' is being called in the script for vehicle.
Both the above callbacks requires to the hooked stuff to be added in scripts which uses teleportation or else the calls won't work well.
Functions which need to be added in every script which uses 'SetPlayerPos' or 'SetVehiclePos' if the callback must work perfectly. NOTE: Must be added before using those functions in the script or else it won't work well.
pawn Код:
stock ___SetPos(playerid, Float:X, Float:Y, Float:Z)
{
SetPlayerPos(playerid, X, Y, Z);
CallLocalFunction("OnPlayerTeleport", "i", playerid);
return 1;
}
stock ___SetvPos(vehicleid, Float:X, Float:Y, Float:Z)
{
SetVehiclePos(vehicleid, X, Y, Z);
CallLocalFunction("OnVehicleTeleport", "i", vehicleid);
return 1;
}
stock __SetInt(playerid, inte)
{
SetPlayerInterior(playerid, inte);
CallLocalFunction("OnPlayerTeleport", "i", playerid);
return 1;
}
stock __SetvInt(vehicleid, inte)
{
LinkVehicleToInterior(vehicleid, inte);
CallLocalFunction("OnVehicleTeleport", "i", vehicleid);
return 1;
}
#if defined _ALS_SetPlayerPos
#undef SetPlayerPos
#else
#define _ALS_SetPlayerPos
#endif
#if defined _ALS_SetVehiclePos
#undef SetVehiclePos
#else
#define _ALS_SetVehiclePos
#endif
#if defined _ALS_SetPlayerInterior
#undef SetPlayerInterior
#else
#define _ALS_SetPlayerInterior
#endif
#if defined _ALS_LinkVehicleToInterior
#undef LinkVehicleToInterior
#else
#define _ALS_LinkVehicleToInterior
#endif
#define SetPlayerPos ___SetPos
#define SetVehiclePos ___SetvPos
#define SetPlayerInterior __SetInt
#define LinkVehicleToInterior __SetvInt
forward OnPlayerTeleport(playerid);
forward OnVehicleTeleport(vehicleid);
pawn Код:
stock SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z)
{
if(IsPlayerInAnyVehicle(playerid))
{
new __vid__ = GetPlayerVehicleID(playerid);
SetVehiclePos(__vid__, X, Y, Z);
}
else
{
SetPlayerPos(playerid, X, Y, Z);
}
return 1;
}
stock SetPlayerInteriorEx(playerid, interior)
{
if(IsPlayerInAnyVehicle(playerid))
{
new _ivid_ = GetPlayerVehicleID(playerid);
LinkVehicleToInterior(_ivid_, interior);
}
else
{
SetPlayerInterior(playerid, interior);
}
return 1;
}