SA-MP Forums Archive
ZCMD Command - 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: ZCMD Command (/showthread.php?tid=296468)



ZCMD Command - Kostas' - 11.11.2011

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


Re: ZCMD Command - SmiT - 11.11.2011

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



Re: ZCMD Command - Kostas' - 11.11.2011

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);



Re: ZCMD Command - SmiT - 11.11.2011

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 );



Re: ZCMD Command - Kostas' - 11.11.2011

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,



Re: ZCMD Command - IstuntmanI - 11.11.2011

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;
}



Re: ZCMD Command - Kostas' - 11.11.2011

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.


Re: ZCMD Command - Rudo2 - 11.11.2011

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

it easier.


Re: ZCMD Command - Kostas' - 11.11.2011

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