gamemode to convert strcmp to zcmd - 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)
+--- Thread: gamemode to convert strcmp to zcmd (
/showthread.php?tid=418072)
gamemode to convert strcmp to zcmd -
toi - 23.02.2013
I wanted to convert all commands from strcmp to zcmd, some things I know but I do not know if you just change the rows or if I have to appoint new strings:
then change this:
from
Код:
if(strcmp("/battleground", cmdtext, true) == 0)
to
Код:
CMD:battleground(playerid, params[])
and these will have to change?
Код:
new string[256];
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
new tmp[256];
new giveplayer[MAX_PLAYER_NAME];
new giveplayerid;
GetPlayerName(playerid,nome,sizeof(nome));
format(string, sizeof(string), "{54da00}[CMDS-DIRETTO:]{ffffff} %s (%d) ha usato: {ff0000}%s", nome,playerid,cmdtext);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(scmds[i] == 1 && playerid != i)
{
SendClientMessage(i, COLOR_GREY, string);
}
}
}
tanks
Re: gamemode to convert strcmp to zcmd -
MMAS09 - 23.02.2013
OT: Why you want to do that ? Sorry i am a newbie
Re: gamemode to convert strcmp to zcmd -
ross8839 - 23.02.2013
I don't think so mate. They shouldn't have to change and that should work. Been a long time since I scripted but that should work. Try it, if you get errors, post them and we can try and fix them... no harm in trying, that'll give you your answer
Re: gamemode to convert strcmp to zcmd -
Scenario - 23.02.2013
Quote:
Originally Posted by MMAS09
OT: Why you want to do that ? Sorry i am a newbie
|
ZCMD is the fastest command processor around right now, if you have less than 100 commands. Otherwise y_commands is the fastest!
@OP: You'll have to change cmdtext to params, and perhaps even modify strtok a little. I don't use that shit function, and never have, so, don't quote me on that!
BUT, you will definitely have to change cmdtext to params. :P