[Include] Anti Car Surfing
#1

This include adds 4 things, 3 functions and a callback.

Код:
stock SetVehicleSurfable(modelid, bool: set);
stock SetPlayerSurfImmunity(playerid, bool: immunity);
stock GetPlayerSurfImmunity(playerid);
forward OnPlayerCarSurf(playerid, vehicleid);
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:

Код:
#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;
}
Changelog:

23.03.2015:
- Added SetPlayerSurfImmunity and GetPlayerSurfImmunity. Thanks Abagail for your suggestion.

Reply
#2

Good job! you're doing good with your systems.
Reply
#3

I'd recommend adding more options to disabling checks for a certain player. Example,

pawn Код:
stock SetPlayerSurfImmune(playerid, bool: immunity)
Reply
#4

Good job!
i like it
Reply
#5

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I'd recommend adding more options to disabling checks for a certain player. Example,

pawn Код:
stock SetPlayerSurfImmune(playerid, bool: immunity)
Added, thanks for the suggestion!

New links are on the first post.
Reply
#6

It's good, but better would be if you can surf on bikes and pickups. More realistic. You can make exception for bikes (not motorbikes) and pickups.
Reply
#7

Nice , Good Work

can you make it in Command ) when player surf in car , and a one is drive car , when he write : Ex : /ejectsurf [ID] , and he will get slap. if he surf in car
Reply
#8

Nice Work ,But i need ,Anti DM vehicle ,Mean if Someone DM car he will slap
Reply
#9

mean i want CarSurfing with weapon ,
,Anti DM vehicle ,Mean if Someone DM car he will slap
Reply
#10

CLICK HERE FOR A MIRROR PASTE!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)