SA-MP Forums Archive
Tool to convert strtok to ZCMD/sscanf - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Tool to convert strtok to ZCMD/sscanf (/showthread.php?tid=270777)



Tool to convert strtok to ZCMD/sscanf - Memoryz - 21.07.2011

Is there a tool out there that will automatically convert my commands to ZCMD/sscanf? I have a lot of commands and it will be very time consuming to do each one by one.

Or is there at least a way that I can use both zcmd and regular commands so that I can slowly convert what I need?


Re: Tool to convert strtok to ZCMD/sscanf - MadeMan - 21.07.2011

You can use OnPlayerCommandReceived instead of OnPlayerCommandText for regular commands.


Re: Tool to convert strtok to ZCMD/sscanf - Memoryz - 21.07.2011

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
You can use OnPlayerCommandReceived instead of OnPlayerCommandText for regular commands.
So after I include zcmd, I can just copy paste the strtok commands into OnPlayerCommandReceived and they will still be functional, as well as zcmds ?


Re: Tool to convert strtok to ZCMD/sscanf - MadeMan - 21.07.2011

Just change the name: Text to Received


Re: Tool to convert strtok to ZCMD/sscanf - Memoryz - 21.07.2011

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Just change the name: Text to Received
Alright I have done this however whenever I use a command, it works, but then after it shows "SERVER: Unknown command"


Re: Tool to convert strtok to ZCMD/sscanf - MadeMan - 21.07.2011

Change this in zcmd.inc file:

pawn Код:
if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
to this
pawn Код:
if (zcmd_g_HasOPCS && CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))



Re: Tool to convert strtok to ZCMD/sscanf - Memoryz - 21.07.2011

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Change this in zcmd.inc file:

pawn Код:
if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
to this
pawn Код:
if (zcmd_g_HasOPCS && CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
Thank-you very much for your help, I really appreciate it!