SetPlayerTime -
Salsa - 15.07.2013
Getting errors on this command
Код:
if (strcmp(cmdtext, "/setmytime", true) == 0)
{
new string1[128];
SetPlayerTime(playerid, time, 0);
SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime [Time(Hour)"
SendClientMessage(playerid, COLOR_PINK, "Function: Will set your Time");
format(string1,sizeof(string1),"His time has Changed to: %d:00", time);
SendClientMessage(playerid,COLOR_Yellow,string1);
return 1;
}
Error's
Код:
D:\Others\101SSCAM\samp03x_svr_R1-2_win32\gamemodes\TheHacker.pwn(5225) : error 017: undefined symbol "time"
D:\Others\101SSCAM\samp03x_svr_R1-2_win32\gamemodes\TheHacker.pwn(5226 -- 5227) : error 001: expected token: ",", but found "-identifier-"
D:\Others\101SSCAM\samp03x_svr_R1-2_win32\gamemodes\TheHacker.pwn(5228) : error 017: undefined symbol "time"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Re: SetPlayerTime -
Passout - 15.07.2013
Yours > SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime [Time(Hour)"
Mine > SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime [Time(Hour)");
Don't forget to close with " ); " - thats error 5226
Try this put it in the cmd
Код:
new tmp[256];
tmp = strtok(cmdtext, idx);
new time;
time = strval(tmp);
Re: SetPlayerTime -
PrinceKumar - 15.07.2013
You need to put ");" in the last of this line.
pawn Код:
SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime[Time(Hour)"
Re: SetPlayerTime -
Areax - 15.07.2013
Just download ZCMD Command Procesor from here..
pawn Код:
CMD:setmytime(playerid, params[])
{
new string1[128]; new time;
SetPlayerTime(playerid, time, 0);
SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime [Time(Hour)");
SendClientMessage(playerid, COLOR_PINK, "Function: Will set your Time");
format(string1,sizeof(string1),"His time has Changed to: %d:00", time);
SendClientMessage(playerid,COLOR_Yellow,string1);
return 1;
}
Re: SetPlayerTime -
Konstantinos - 15.07.2013
Quote:
Originally Posted by Areax
Just download ZCMD Command Procesor from here..
pawn Код:
CMD:setmytime(playerid, params[]) { new string1[128]; new time; SetPlayerTime(playerid, time, 0); SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime [Time(Hour)"); SendClientMessage(playerid, COLOR_PINK, "Function: Will set your Time"); format(string1,sizeof(string1),"His time has Changed to: %d:00", time); SendClientMessage(playerid,COLOR_Yellow,string1); return 1; }
|
And you assign nothing to "time". Sscanf or even isnull + isnumeric would be useful for that command.
People must understand that using strcmp to compare string for commands is not an efficient way and it's slow/outdated, strtok too.
Re: SetPlayerTime -
Areax - 15.07.2013
Quote:
Originally Posted by _Zeus
And you assign nothing to "time". Sscanf or even isnull + isnumeric would be useful for that command.
People must understand that using strcmp to compare string for commands is not an efficient way and it's slow/outdated, strtok too.
|
ZCMD is more easier then strtok...
pawn Код:
CMD:setmytime(playerid, params[])
{
new string1[128]; new time;
if(sscanf(params, "i", time))
{
SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime [Time(Hour)");
SendClientMessage(playerid, COLOR_PINK, "Function: Will set your Time");
}
SetPlayerTime(playerid, time, 0);
format(string1, sizeof(string1), "His time has Changed to: %d:00", time);
SendClientMessage(playerid, -1, string1);
return 1;
}
Here is the code!
Re: SetPlayerTime -
Konstantinos - 15.07.2013
Quote:
Originally Posted by Areax
ZCMD is more easier then strtok...
|
Compare sscanf with strtok, not with ZCMD.
I said, people use strcmp and strtok for commands when both of them are slow and outdated.
Re: SetPlayerTime -
Areax - 15.07.2013
Quote:
Originally Posted by _Zeus
Compare sscanf with strtok, not with ZCMD.
I said, people use strcmp and strtok for commands when both of them are slow and outdated.
|
Well..I am not good in strtok and strcmp xD That's why I gave him in ZCMD and SSCANF!
Re: SetPlayerTime -
Salsa - 15.07.2013
Quote:
Originally Posted by Areax
ZCMD is more easier then strtok...
pawn Код:
CMD:setmytime(playerid, params[]) { new string1[128]; new time; if(sscanf(params, "i", time)) { SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime [Time(Hour)"); SendClientMessage(playerid, COLOR_PINK, "Function: Will set your Time"); } SetPlayerTime(playerid, time, 0); format(string1, sizeof(string1), "His time has Changed to: %d:00", time); SendClientMessage(playerid, -1, string1); return 1; }
Here is the code!
|
Can i use ZCMD + Strcmp commands in one Fs/Gm ?
which one is faster you said ? zcmd some peoples say YCMD_ is more faster then all and strock commands is slowest one
Re: SetPlayerTime -
Areax - 15.07.2013
Nvm...