5
5
#include "pysamp/pysamp.h"
6
6
#include "test/callbackstest.h"
7
7
8
+ #include <stdio.h>
9
+
8
10
char * fromConst (const char * str ) {
9
11
const size_t len = strlen (str );
10
12
char * cstr = new char [len + 1 ];
@@ -39,7 +41,7 @@ PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerCommandText(int playerid,
39
41
const char * cmdtext ) {
40
42
char * cmd = fromConst (cmdtext );
41
43
sampgdk ::logprintf (cmd );
42
- bool ret = PySAMP ::callback ("OnPlayerCommandText" , Py_BuildValue ("(is )" , playerid , cmd ));
44
+ bool ret = PySAMP ::callback ("OnPlayerCommandText" , Py_BuildValue ("(iy )" , playerid , cmd ));
43
45
delete [] cmd ;
44
46
return ret ;
45
47
}
@@ -62,7 +64,7 @@ PLUGIN_EXPORT bool PLUGIN_CALL OnVehicleDeath(int vehicleid, int killerid) {
62
64
63
65
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerText (int playerid , const char * text ) {
64
66
char * txt = fromConst (text );
65
- bool ret = PySAMP ::callback ("OnPlayerText" , Py_BuildValue ("(is )" , playerid , txt ));
67
+ bool ret = PySAMP ::callback ("OnPlayerText" , Py_BuildValue ("(iy )" , playerid , txt ));
66
68
delete [] txt ;
67
69
return ret ;
68
70
}
@@ -97,7 +99,7 @@ PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerLeaveRaceCheckpoint(int playerid) {
97
99
98
100
PLUGIN_EXPORT bool PLUGIN_CALL OnRconCommand (const char * cmd ) {
99
101
char * str = fromConst (cmd );
100
- bool ret = PySAMP ::callback ("OnPlayerCommandText" , Py_BuildValue ("(is )" , str ));
102
+ bool ret = PySAMP ::callback ("OnPlayerCommandText" , Py_BuildValue ("(iy )" , str ));
101
103
delete [] str ;
102
104
return ret ;
103
105
}
@@ -161,7 +163,7 @@ PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerKeyStateChange(int playerid, int newkeys,
161
163
PLUGIN_EXPORT bool PLUGIN_CALL OnRconLoginAttempt (const char * ip , const char * password , bool success ) {
162
164
char * ipStr = fromConst (ip );
163
165
char * passwordStr = fromConst (password );
164
- bool ret = PySAMP ::callback ("OnRconLoginAttempt" , Py_BuildValue ("(ssO )" , ipStr , passwordStr , (success ? Py_True : Py_False )));
166
+ bool ret = PySAMP ::callback ("OnRconLoginAttempt" , Py_BuildValue ("(yyO )" , ipStr , passwordStr , (success ? Py_True : Py_False )));
165
167
delete [] ipStr , passwordStr ;
166
168
return ret ;
167
169
}
@@ -196,7 +198,7 @@ PLUGIN_EXPORT bool PLUGIN_CALL OnActorStreamOut(int actorid, int forplayerid) {
196
198
197
199
PLUGIN_EXPORT bool PLUGIN_CALL OnDialogResponse (int playerid , int dialogid , int response , int listitem , const char * inputtext ) {
198
200
char * inputtextStr = fromConst (inputtext );
199
- bool ret = PySAMP ::callback ("OnDialogResponse" , Py_BuildValue ("(iiiis )" , playerid , dialogid , response , listitem , inputtextStr ));
201
+ bool ret = PySAMP ::callback ("OnDialogResponse" , Py_BuildValue ("(iiiiy )" , playerid , dialogid , response , listitem , inputtextStr ));
200
202
delete [] inputtextStr ;
201
203
return ret ;
202
204
}
@@ -228,7 +230,7 @@ PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerClickPlayerTextDraw(int playerid, int pla
228
230
PLUGIN_EXPORT bool PLUGIN_CALL OnIncomingConnection (int playerid , const char * ip_address , int port ) {
229
231
sampgdk ::logprintf ("OnIncomingConnection" );
230
232
char * ipStr = fromConst (ip_address );
231
- bool ret = PySAMP ::callback ("OnIncomingConnection" , Py_BuildValue ("(isi )" , playerid , ipStr , port ));
233
+ bool ret = PySAMP ::callback ("OnIncomingConnection" , Py_BuildValue ("(iyi )" , playerid , ipStr , port ));
232
234
delete [] ipStr ;
233
235
return ret ;
234
236
}
0 commit comments