CMD:mytime( playerid, params[] ) { new Time; if ( P_DATA[ playerid ][ P_Logged ] == 0 ) return SendError( playerid, "You must be logged in to change your time! ~n~Type ~b~~h~/login."); if ( sscanf( params, "i", Time ) ) return SendUsage( playerid, "/mytime <hour>"); if ( Time < 0 || Time > 24 ) return SendError( playerid, "~n~Numbers must be from ~b~~h~0 ~w~to ~b~~h~24"); P_DATA[ playerid ][ P_Time ] = Time; SetPlayerTime( playerid, Time, 0 ); new String[ 160 ]; format( String, sizeof String, "You have changed your time to ~b~~h~%d~w~:~b~~h~00~w~. It has been saved into your account, on next login this time will be applied.", Time ); Info( playerid, String, 5000); new iUID = BUD::GetNameUID( PlayerName2( playerid ) ); BUD::SetIntEntry(iUID, "Time", params[ 0 ] ); return 1; }
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mytime", cmdtext, true, 6) == 0)
{
new Time;
if ( P_DATA[ playerid ][ P_Logged ] == 0 )
return SendError( playerid, "You must be logged in to change your time! ~n~Type ~b~~h~/login.");
if ( sscanf( cmdtext[7], "i", Time ) ) //If it doesn't work try changing it to 'cmdtext[8]'
return SendUsage( playerid, "/mytime <hour>");
if ( Time < 0 || Time > 24 )
return SendError( playerid, "~n~Numbers must be from ~b~~h~0 ~w~to ~b~~h~24");
P_DATA[ playerid ][ P_Time ] = Time;
SetPlayerTime( playerid, Time, 0 );
new String[ 160 ];
format( String, sizeof String, "You have changed your time to ~b~~h~%d~w~:~b~~h~00~w~. It has been saved into your account, on next login this time will be applied.", Time );
Info( playerid, String, 5000);
new iUID = BUD::GetNameUID( PlayerName2( playerid ) );
BUD::SetIntEntry(iUID, "Time", Time);
return 1;
}
return 0;
}
pawn Код:
|
//Near the top of your script
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mytime", cmdtext, true, 6) == 0)
{
new Time;
if ( P_DATA[ playerid ][ P_Logged ] == 0 )
return SendError( playerid, "You must be logged in to change your time! ~n~Type ~b~~h~/login.");
if ( isnull( cmdtext[7] ) ) //If it doesn't work try changing it to 'cmdtext[8]'
return SendUsage( playerid, "/mytime <hour>");
Time = strval( cmdtext[7] ); //Again change it to 'cmdtext[8]' if it doesn't work.
if ( Time < 0 || Time > 24 )
return SendError( playerid, "~n~Numbers must be from ~b~~h~0 ~w~to ~b~~h~24");
P_DATA[ playerid ][ P_Time ] = Time;
SetPlayerTime( playerid, Time, 0 );
new String[ 160 ];
format( String, sizeof String, "You have changed your time to ~b~~h~%d~w~:~b~~h~00~w~. It has been saved into your account, on next login this time will be applied.", Time );
Info( playerid, String, 5000);
new iUID = BUD::GetNameUID( PlayerName2( playerid ) );
BUD::SetIntEntry(iUID, "Time", Time);
return 1;
}
return 0;
}