SetPlayerTime
#1

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.
Reply
#2

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);
Reply
#3

You need to put ");" in the last of this line.
pawn Код:
SendClientMessage(playerid, COLOR_GREY, "Usage: /setmytime[Time(Hour)"
Reply
#4

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;
}
Reply
#5

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.
Reply
#6

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!
Reply
#7

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.
Reply
#8

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!
Reply
#9

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
Reply
#10

Nvm...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)