HELP HELP - 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: HELP HELP (
/showthread.php?tid=481262)
HELP HELP -
FakkChass - 14.12.2013
Hi please help in this code:
pawn Код:
dcmd_time(playerid,params[])
{
if(!strlen(params)) return SCM(playerid,-1,"[USAGE] {FFFFFF}/time [TIME]");
Time =params;
}
I get this error in this line
the error:
pawn Код:
error 006: must be assigned to an array
HELP!
Re: HELP HELP -
Jimmy0wns - 14.12.2013
Try this:
pawn Код:
dcmd_time(playerid,params[])
{
new id, time;
if( sscanf( params, "ui", id, time ) ) return SendClientMessage( playerid, -1, "Usage: /settime <ID/Part Of Name> <0-24>" );
if( time > 24 || time < 0 ) return SendClientMessage( playerid, -1, "Available Hours: 0-24" );
SetPlayerTime( id, time );
return 1;
}
Re: HELP HELP -
FakkChass - 14.12.2013
thanks Jimmy0wns for your reply, but sorry, that's not the right way i want it
i just want it like it was
and want remove that error. tell me what to use strlen or strval, something that solve problem.
Any more replies please ?
Re: HELP HELP -
Chenko - 14.12.2013
If you want to assign the value of params to the variable Time than you need to do:
Код:
Time = strval(params)
Because I assume time is an integer and params is a string so you need to use strval() to get the integer value from params.
Re: HELP HELP - Patrick - 14.12.2013
Quote:
Originally Posted by FakkChass
thanks Jimmy0wns for your reply, but sorry, that's not the right way i want it
i just want it like it was and want remove that error. tell me what to use strlen or strval, something that solve problem.
Any more replies please ?
|
It shows the erorr, because you defined or assigned Time incorrectly, Jimmy's code was perfect, I have no idea what you really want
pawn Код:
dcmd_time( playerid, params[] )
{
if( isnull ( params ) )
return SendClientMessage( playerid, -1, "[USAGE] /time [ time ] ");
if( 0 > time > 24 )
return SendClientMessage( playerid, -1, "Available Hours: 0-24" );
SetPlayerTime(playerid, params);
return 1;
}
or this
Quote:
Originally Posted by Chenko
If you want to assign the value of params to the variable Time than you need to do:
Код:
Time = strval(params)
Because I assume time is an integer and params is a string so you need to use strval() to get the integer value from params.
|