HELP HELP
#1

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
pawn Код:
Time =params;
the error:
pawn Код:
error 006: must be assigned to an array
HELP!
Reply
#2

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

thanks Jimmy0wns for your reply, but sorry, that's not the right way i want it
i just want it like it was
pawn Код:
time = params
and want remove that error. tell me what to use strlen or strval, something that solve problem.
Any more replies please ?
Reply
#4

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

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
pawn Код:
time = params
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)