View difference between Paste ID: g7tNkatX and SAXHNW9r
SHOW: | | - or go back to the newest paste.
1
//Made by lokii.
2
3
#include <a_samp>
4
5
#define MAX_WARININGS (3)
6
7
static warnings[MAX_PLAYERS char] = {0,...};
8
9
public OnFilterScriptInit()
10
{
11
	for(new i = 0; i < MAX_PLAYERS; i++)
12
	{
13
	    warnings{i} = 0;
14
	}
15
	return 1;
16
}
17
18
public OnPlayerConnect(playerid)
19
{
20
	warnings{playerid} = 0;
21
	return 1;
22
}
23
24
public OnPlayerDisconnect(playerid)
25
{
26
	warnings{playerid} = 0;
27
	return 1;
28
}
29
30
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
31
{
32
	new str[60];
33
	new Float:hp;
34
	GetPlayerHealth(playerid, hp);
35
	if(IsPlayerNPC(issuerid) || !IsPlayerInAnyVehicle(issuerid)) return 0;
36
	if(weaponid > 21 && weaponid < 34 || weaponid == 38)
37
	{
38
	    SetPlayerHealth(playerid, hp);
39
		TogglePlayerControllable(issuerid, 0);
40
		warnings{issuerid} ++;
41
		if(warnings{issuerid} < MAX_WARININGS)
42
		{
43
		    format(str, sizeof(str), "{FFFFFF}Please do not drive-by {FF0000}%d{FFFFFF}/{FF0000}%d", warnings{issuerid}, MAX_WARININGS);
44
		    ShowPlayerDialog(issuerid, 12221, DIALOG_STYLE_MSGBOX, "{FF0000}Drive-By", str, "Ok", "");
45
		    TogglePlayerControllable(issuerid, 1);
46
		}
47
		if(warnings{issuerid} >= MAX_WARININGS)
48
		{
49
		    ShowPlayerDialog(issuerid, 12221, DIALOG_STYLE_MSGBOX, "{FF0000}Drive-By", "{FF0000}You have been kicked for drive-by", "Ok", "");
50
		    SetTimerEx("KickPlayer", 200, false, "i", issuerid);
51
		}
52
	}
53
	return 0;
54
}
55
56
forward KickPlayer(playerid);
57
58
public KickPlayer(playerid)
59
{
60
	return Kick(playerid);
61
}
62
63
64
//EOF.