27.03.2013, 12:25
This is just a simple filterscript, so you cannot fall off from bike (from a crash).
I learned OnPlayerExitVehicle is not called when you fall off from bike (from a crash).
How it works?
When you fall off from a bike ( a crash, ofc ), it checks if your antifall is on. If the antifall is on, it will put you to your old vehicle.
Okay, here is the script (I'm not using zcmd, I'm using strcmp)
Features :
- Short and a simple script
- One command to toggle on/off antifall. -> /antifall
To-do list:
- Make this thing works for passengers too.
This filterscript has been tested by myself. Please report if you have found any bugs.
Have fun.
I learned OnPlayerExitVehicle is not called when you fall off from bike (from a crash).
How it works?
When you fall off from a bike ( a crash, ofc ), it checks if your antifall is on. If the antifall is on, it will put you to your old vehicle.
Okay, here is the script (I'm not using zcmd, I'm using strcmp)
pawn Код:
/*
antifall system - 0.3x
*/
#define FILTERSCRIPT
#include <a_samp>
new
bool: g_antifall[MAX_PLAYERS],
bool: g_bump[MAX_PLAYERS],
g_veh[MAX_PLAYERS]
;
public OnFilterScriptInit() {
print("\n\t- Antifall system (0.3x) by greentarch -\n\t*LOADED*\n");
return true;
}
public OnFilterScriptExit() {
print("\n\t- Antifall system (0.3x) by greentarch -\n\t*UNLOADED*\n");
return true;
}
public OnPlayerConnect(playerid) {
g_antifall[playerid] = true;
g_bump[playerid] = false;
g_veh[playerid] = -1;
SendClientMessage(playerid, -1, "[INFO]: This server uses \"antifall system\" by greentarch.");
SendClientMessage(playerid, -1, "[INFO]: Use /antifall to toggle on antifall on/off. (Only for drivers)");
return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate) {
if (newstate == PLAYER_STATE_DRIVER) {
g_veh[playerid] = GetPlayerVehicleID(playerid);
g_bump[playerid] = true;
}
else if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER) {
if (g_bump[playerid] && g_antifall[playerid]) {
PutPlayerInVehicle(playerid, g_veh[playerid], 0);
}
}
return true;
}
public OnPlayerExitVehicle(playerid, vehicleid) {
g_bump[playerid] = false;
return true;
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if (!strcmp(cmdtext, "/antifall", true)) {
g_antifall[playerid] = !g_antifall[playerid];
SendClientMessage(playerid, 0x33FF33AA,
(g_antifall[playerid]) ? ("[SUCCESS]: Antifall turned on!") : ("[SUCCESS]: Antifall turned off!"));
return true;
}
return false;
}
- Short and a simple script
- One command to toggle on/off antifall. -> /antifall
To-do list:
- Make this thing works for passengers too.
This filterscript has been tested by myself. Please report if you have found any bugs.
Have fun.