This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPoker_Callbacks.pwn
214 lines (178 loc) · 5.04 KB
/
Poker_Callbacks.pwn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
#if defined Pkr_OnFilterScriptInit
Pkr_OnFilterScriptInit();
#endif
Pkr_InitialisePoker();
SetTimer("Pkr_OnOneSecond", 1000, true);
Pkr_ForeachPlayer(playerid) {
if(IsPlayerNPC(playerid))
SetPlayerPos(playerid, 0.0, 0.0, 0.0);
}
#if defined RUN_TESTS
Pkr_InitialiseTests();
#endif
return 1;
}
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#else
#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit Pkr_OnFilterScriptInit
#if defined Pkr_OnFilterScriptInit
forward Pkr_OnFilterScriptInit();
#endif
public OnFilterScriptExit()
{
#if defined Pkr_OnFilterScriptExit
Pkr_OnFilterScriptExit();
#endif
for(new _j = 0; _j < MAX_POKER_GAMES; ++_j)
{
if(Pkr_GetIsAssigned(_j))
{
Pkr_UnassignAllPlayers(_j);
Pkr_UnassignAllSpectators(_j);
Pkr_DestroyGame(_j);
}
}
return 1;
}
#if defined _ALS_OnFilterScriptExit
#undef OnFilterScriptExit
#else
#define _ALS_OnFilterScriptExit
#endif
#define OnFilterScriptExit Pkr_OnFilterScriptExit
#if defined Pkr_OnFilterScriptExit
forward Pkr_OnFilterScriptExit();
#endif
#else
public OnGameModeInit()
{
#if defined Pkr_OnGameModeInit
Pkr_OnGameModeInit();
#endif
Pkr_InitialisePoker();
SetTimer("Pkr_OnOneSecond", 1000, true);
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit Pkr_OnGameModeInit
#if defined Pkr_OnGameModeInit
forward Pkr_OnGameModeInit();
#endif
#endif
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
#if defined Pkr_OnPlayerClickTextDraw
Pkr_OnPlayerClickTextDraw(playerid, clickedid);
#endif
new bool: _handled = false;
_handled = Pkr_PlayerReadyTextDrawClick(playerid, clickedid);
if(!_handled)
Pkr_PlayerMenuTextDrawClick(playerid, clickedid);
return 0;
}
#if defined _ALS_OnPlayerClickTextDraw
#undef OnPlayerClickTextDraw
#else
#define _ALS_OnPlayerClickTextDraw
#endif
#define OnPlayerClickTextDraw Pkr_OnPlayerClickTextDraw
#if defined Pkr_OnPlayerClickTextDraw
forward Pkr_OnPlayerClickTextDraw(playerid, Text:clickedid);
#endif
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
#if defined Pkr_OnDialogResponse
Pkr_OnDialogResponse(playerid, dialogid, response, listitem, inputtext);
#endif
if(dialogid != POKER_DIALOG_ID)
return 0;
Pkr_PlayerDialogResponse(playerid, dialogid, response, listitem, inputtext);
Pkr_GameDialogResponse(playerid, dialogid, response, listitem, inputtext);
Pkr_PlayerChipsDialogResponse(playerid, response, inputtext);
return 1;
}
#if defined _ALS_OnDialogResponse
#undef OnDialogResponse
#else
#define _ALS_OnDialogResponse
#endif
#define OnDialogResponse Pkr_OnDialogResponse
#if defined Pkr_OnDialogResponse
forward Pkr_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
#endif
public OnPlayerDeath(playerid, killerid, reason)
{
#if defined Pkr_OnPlayerDeath
Pkr_OnPlayerDeath(playerid, killerid, reason);
#endif
if(!Pkr_IsPlayerOnAnyGame(playerid))
return;
new gameId = Pkr_GetPlayerGame(playerid);
Pkr_UnassignPlayerFromGame(playerid, gameId);
return;
}
#if defined _ALS_OnPlayerDeath
#undef OnPlayerDeath
#else
#define _ALS_OnPlayerDeath
#endif
#define OnPlayerDeath Pkr_OnPlayerDeath
#if defined Pkr_OnPlayerDeath
forward Pkr_OnPlayerDeath(playerid, killerid, reason);
#endif
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
#if defined Pkr_OnPlayerTakeDamage
Pkr_OnPlayerTakeDamage(playerid, issuerid, amount, weaponid, bodypart);
#endif
new gameId = Pkr_GetPlayerGame(playerid);
if(gameId == -1)
return;
if(issuerid == INVALID_PLAYER_ID)
return;
if(GetPVarType(playerid, POKER_SIT_VAR_NAME) == PLAYER_VARTYPE_NONE)
return;
SetCameraBehindPlayer(playerid);
Pkr_HidePlayerTextDraws(playerid, gameId);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_GREEN, "You've taken damage, you can sit at the game again by using /pkr sit");
DeletePVar(playerid, POKER_SIT_VAR_NAME);
return;
}
#if defined _ALS_OnPlayerTakeDamage
#undef OnPlayerTakeDamage
#else
#define _ALS_OnPlayerTakeDamage
#endif
#define OnPlayerTakeDamage Pkr_OnPlayerTakeDamage
#if defined Pkr_OnPlayerTakeDamage
forward Pkr_OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart);
#endif
public OnPlayerDisconnect(playerid, reason)
{
new gameId = Pkr_GetPlayerGame(playerid);
if(gameId != INVALID_POKER_GAME_ID)
Pkr_UnassignPlayerFromGame(playerid, gameId);
#if defined Pkr_OnPlayerDisconnect
Pkr_OnPlayerDisconnect(playerid, reason);
#endif
return 1;
}
#if defined _ALS_OnPlayerDisconnect
#undef OnPlayerDisconnect
#else
#define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect Pkr_OnPlayerDisconnect
#if defined Pkr_OnPlayerDisconnect
forward Pkr_OnPlayerDisconnect(playerid, reason);
#endif