22.03.2015, 16:36
(
Последний раз редактировалось rootcause; 11.08.2015 в 17:14.
)
This include adds 4 things, 3 functions and a callback.
You can prevent car surfing on all vehicles or for certain models using SetVehicleSurfable function. By default, all vehicle models (including boats) are not allowed to car surf on.
OnPlayerCarSurf will get called if you add the public to your script and you can do whatever you want to the player from there, if you don't add it to your script players will get slapped when they car surf.
Also you can define SURF_MIN_SPEED before including antisurf. By default if a vehicle's speed is lower than 25, surfers won't get slapped or callback won't get called. You can change that using SURF_MIN_SPEED.
[NEW] You can give immunity to players now using SetPlayerSurfImmunity. If they've been given immunity, when they car surf nothing will happen. You can get a players immunity state using GetPlayerSurfImmunity.
Few Examples:
Changelog:
23.03.2015:
- Added SetPlayerSurfImmunity and GetPlayerSurfImmunity. Thanks Abagail for your suggestion.
Код:
stock SetVehicleSurfable(modelid, bool: set); stock SetPlayerSurfImmunity(playerid, bool: immunity); stock GetPlayerSurfImmunity(playerid); forward OnPlayerCarSurf(playerid, vehicleid);
OnPlayerCarSurf will get called if you add the public to your script and you can do whatever you want to the player from there, if you don't add it to your script players will get slapped when they car surf.
Also you can define SURF_MIN_SPEED before including antisurf. By default if a vehicle's speed is lower than 25, surfers won't get slapped or callback won't get called. You can change that using SURF_MIN_SPEED.
[NEW] You can give immunity to players now using SetPlayerSurfImmunity. If they've been given immunity, when they car surf nothing will happen. You can get a players immunity state using GetPlayerSurfImmunity.
Few Examples:
Код:
#include <antisurf> public OnPlayerCarSurf(playerid, vehicleid) { // take $250 from the player GivePlayerMoney(playerid, -250); SendClientMessage(playerid, 0xFF0000FF, "Car surfing is not allowed on this server, $250 taken."); return 1; }
Код:
#include <antisurf> public OnPlayerCarSurf(playerid, vehicleid) { // stop the vehicle player surfed on SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0); return 1; }
Код:
#define SURF_MIN_SPEED 120.0 #include <antisurf> public OnPlayerCarSurf(playerid, vehicleid) { // this callback only gets called when a player surfs on a 120+ speed vehicle because of SURF_MIN_SPEED. // kill the player because vehicle the player was surfing on was too fast SetPlayerHealth(playerid, -1.0); SendClientMessage(playerid, -1, "You fell from the vehicle."); return 1; }
23.03.2015:
- Added SetPlayerSurfImmunity and GetPlayerSurfImmunity. Thanks Abagail for your suggestion.