View difference between Paste ID: BRcXrJ8c and gxM7Pejt
SHOW: | | - or go back to the newest paste.
1
#if defined _pnscallback_included
2
	#endinput
3
#endif
4
#define _pnscallback_included
5
6-
#tryinclude <a_samp>
6+
7
8
new Float:_pns_vehicleHealth[MAX_VEHICLES] = {1000.0,...};
9
10
new _pns_t;
11
12
forward OnVehicleRepair(playerid, vehicleid);
13
14
public OnGameModeInit()
15
{
16
	_pns_t = SetTimer("@_pns_Timer", 100, true);
17
	print("\n======================================\n");
18
	print("<-> PNS Callback by HydranT_ geladen");
19
	print("\n======================================\n");
20
	return CallLocalFunction("_OnGameModeInit", "");
21
}
22
23
#if defined _OnGameModeInit
24
	forward _OnGameModeInit();
25
#endif
26
27
#if defined _ALS_OnGameModeInit
28
	#undef OnGameModeInit
29
#else
30
	#define _ALS_OnGameModeInit
31
#endif
32
#define OnGameModeInit _OnGameModeInit
33
34
public OnGameModeExit()
35
{
36
	KillTimer(_pns_t);
37
	return CallLocalFunction("_OnGameModeExit", "");
38
}
39
40
#if defined _OnGameModeExit
41
	forward _OnGameModeExit();
42
#endif
43
44
#if defined _ALS_OnGameModeExit
45
	#undef OnGameModeExit
46
#else
47
	#define _ALS_OnGameModeExit
48
#endif
49
#define OnGameModeExit _OnGameModeExit
50
51
public OnVehicleSpawn(vehicleid)
52
{
53
	_pns_vehicleHealth[vehicleid] = 1000.0;
54
	return CallLocalFunction("_OnVehicleSpawn", "i", vehicleid);
55
}
56
57
#if defined _OnVehicleSpawn
58
	forward _OnVehicleSpawn();
59
#endif
60
61
#if defined _ALS_OnVehicleSpawn
62
	#undef OnVehicleSpawn
63
#else
64
	#define _ALS_OnVehicleSpawn
65
#endif
66
#define OnVehicleSpawn _OnVehicleSpawn
67
68
@_pns_Timer(); @_pns_Timer() {
69
	new i=0, id=INVALID_VEHICLE_ID, Float:vHp=0.0;
70
	for(; i < MAX_PLAYERS; i++) {
71
	    if(!IsPlayerConnected(i)) continue;
72
	    if(!IsPlayerInAnyVehicle(i)) continue;
73
	    if(GetPlayerState(i) != PLAYER_STATE_DRIVER) continue;
74
		id = GetPlayerVehicleID(i);
75
		if(id == INVALID_VEHICLE_ID) continue;
76
		GetVehicleHealth(id, vHp);
77
		if(vHp <= _pns_vehicleHealth[id]) {
78
			_pns_vehicleHealth[id] = vHp;
79
			continue;
80
		}
81
		_pns_vehicleHealth[id] = vHp;
82
		if(vHp != 1000.0) continue;
83
		CallLocalFunction("OnVehicleRepair", "ii", i, id);
84
	}
85
}