ZCMD Command
#1

Hello Everyone!
I want to make a /time command but I don't know how with isnull
pawn Код:
if(isnull(params) || !(0 < strval(params) < 24)) SendClientMessage(playerid, COLOR_RED, "[ERROR]: Syntax: /Time [0 - 24]");
is it possible to make it. I have it with ShowPlayerDialog but I don't want it anymore to search on the list just /time 12 for example
Reply
#2

pawn Код:
if ( isnull ( params ) ) return SendClientMessage( playerid, -1, #[ERROR]: Syntax: /Time [0 - 24] );
// if the parameters string are null return the above message
if ( strval ( params ) > 24 || strval ( params ) < 0 ) return SendClientMessage( playerid -1, #[ERROR]: 0 - 24 );
// strval converts a string to an integer, if params higher then 24 or lower then 0 return the above message
Reply
#3

Smit, How can I add the time because I tried something and Pawno crashed
pawn Код:
SetPlayerTime(playerid, 0, 0);
SetPlayerTime(playerid, 1, 0);
/*More*/
SetPlayerTime(playerid, 12, 0);
/*More*/
SetPlayerTime(playerid, 24, 0);
Reply
#4

pawn Код:
if ( isnull ( params ) ) return SendClientMessage( playerid, -1, #[ERROR]: Syntax: /Time [0 - 24] );

if ( strval ( params ) > 24 || strval ( params ) < 0 ) return SendClientMessage( playerid -1, #[ERROR]: 0 - 24 );

SetPlayerTime( playerid, strval ( params ), 0 );
Reply
#5

1 Error
pawn Код:
error 035: argument type mismatch (argument 2)
pawn Код:
CMD:time(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "[ERROR]: Syntax: /Time [0-24]");
    if(strval(params) > 24 || strval (params) < 0) return SendClientMessage(playerid -1, "[ERROR]: 0 - 24");//This Line
    SetPlayerTime(playerid,strval(params), 0);
    SetPlayerTime(playerid,strval(params), 1);
    SetPlayerTime(playerid,strval(params), 2);
    SetPlayerTime(playerid,strval(params), 3);
    SetPlayerTime(playerid,strval(params), 4);
    SetPlayerTime(playerid,strval(params), 5);
    SetPlayerTime(playerid,strval(params), 6);
    SetPlayerTime(playerid,strval(params), 7);
    SetPlayerTime(playerid,strval(params), 8);
    SetPlayerTime(playerid,strval(params), 9);
    SetPlayerTime(playerid,strval(params), 10);
    SetPlayerTime(playerid,strval(params), 11);
    SetPlayerTime(playerid,strval(params), 12);
    SetPlayerTime(playerid,strval(params), 13);
    SetPlayerTime(playerid,strval(params), 14);
    SetPlayerTime(playerid,strval(params), 15);
    SetPlayerTime(playerid,strval(params), 16);
    SetPlayerTime(playerid,strval(params), 17);
    SetPlayerTime(playerid,strval(params), 18);
    SetPlayerTime(playerid,strval(params), 19);
    SetPlayerTime(playerid,strval(params), 20);
    SetPlayerTime(playerid,strval(params), 21);
    SetPlayerTime(playerid,strval(params), 22);
    SetPlayerTime(playerid,strval(params), 23);
    SetPlayerTime(playerid,strval(params), 24);
    return 1;
}
Edit: You forgot the comma ","
pawn Код:
playerid -1,
Instead of
pawn Код:
playerid, -1,
Reply
#6

Change with this:
Код:
CMD:time( playerid, params[ ] )
{
	if( isnull( params ) ) 
		return SendClientMessage( playerid, -1, "[ERROR]: Syntax: /Time [0-24]" );
	
	if( strval( params ) > 24 || strval ( params ) < 0 ) 
		return SendClientMessage( playerid, -1, "[ERROR]: 0 - 24" );

	SetPlayerTime( playerid, strval( params ), 0 );
	return 1;
}
Reply
#7

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Change with this:
Код:
CMD:time( playerid, params[ ] )
{
	if( isnull( params ) ) 
		return SendClientMessage( playerid, -1, "[ERROR]: Syntax: /Time [0-24]" );
	
	if( strval( params ) > 24 || strval ( params ) < 0 ) 
		return SendClientMessage( playerid, -1, "[ERROR]: 0 - 24" );

	SetPlayerTime( playerid, strval( params ), 0 );
	return 1;
}
Yes, I saw it after trying to fix it and I saw that you noticed it first.
Reply
#8

https://sampforum.blast.hk/showthread.php?tid=280476

it easier.
Reply
#9

Quote:
Originally Posted by Rudo2
Посмотреть сообщение
From this Tutorial I learnt ZCMD, but I never used isnull thats why I asked for help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)