-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_gamemode.pwn
258 lines (210 loc) · 4.31 KB
/
test_gamemode.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#include <a_samp>
#include <a_spdlog>
#define MoneyLog "money"
#define LoginLog "login"
#define RandomLog "random"
#define ChatLog "chatlog"
#define Console "stdout"
main() {
LogCritical(Console, "Loaded script '%s'", "test");
}
public OnGameModeInit()
{
// Enable async logging
LoggerSetAsyncMode(4096);
// Initialize log sinks
BasicLogger(MoneyLog, "scriptfiles/MoneyLog.txt"); // To file
BasicLogger(LoginLog, "scriptfiles/LoginLog.txt"); // To file
BasicLogger(ChatLog, "scriptfiles/ChatLog.txt"); // To file
BasicLogger(RandomLog, "scriptfiles/Random.txt"); // To file
ConsoleLogger(Console); // To console (no log)
// Info (This text doesnt show up in server_log.txt)
LogInfo(Console, "Gamemode initializing...");
// Don't use these lines if it's a filterscript
SetGameModeText("SPDLog Test");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
// Info (This text doesnt show up in server_log.txt)
LogInfo(Console, "Gamemode initialized...");
// Use param ids
LogInfo(
RandomLog,
"The last param: %s and then the rest %d %s", "BLUB", 0, "50", 5991992, 10, 20, 30
);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
LogInfo(LoginLog, "New player joined pid(%d)", playerid);
LogCritical(Console, "OMG a new USER!!!");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
LogInfo(LoginLog, "Player left pid(%d)", playerid);
LogCritical(Console, "We are losing users!!!!!!!");
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
LogInfo(ChatLog, "Chat message pid(%d): %s", playerid, text);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
// Commands
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
return 1;
}
// Commands
if (strcmp("/writelog", cmdtext, true, 9) == 0)
{
LogInfo(RandomLog, "Some things");
return 1;
}
// Set log level to debug
if (strcmp("/debug", cmdtext, true, 6) == 0)
{
LoggerSetLevel(SPDLOG_LEVEL:DEBUG);
return 1;
}
// Yeah
LogWarn(Console, "Unknown command by pid(%d): %s", playerid, cmdtext);
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
LogInfo(Console, "RCon Command: %s", cmd);
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}