Posts: 512
Threads: 121
Joined: Sep 2013
PHP код:
new time;
if( sscanf( params, "i", time ) ) return SendClientMessage( playerid, yellow, "Usage: /time <0-24>" );
if( time > 24 || time < 0 ) return SendClientMessage( playerid, red, ">> Available Hours: <0-24>" );
SetPlayerTime(playerid,time, 0);
I want to make it like a dialog input where you put the Digit or Time in the input dialog box. how?
Posts: 512
Threads: 121
Joined: Sep 2013
Quote:
Originally Posted by Konstantinos
pawn Код:
// command: ShowPlayerDialog( playerid, 463, DIALOG_STYLE_INPUT, "Time", "Enter the time below:", "Change!", "Cancel" );
// OnDialogResponse, check if the dialogid is 463 by using if statement or swictch (recommended for more cases - it's faster!) if( response ) { if( !IsNumeric( inputtext ) ) return ShowPlayerDialog( playerid, 463, DIALOG_STYLE_INPUT, "Time", "You must input a number. Re-enter the time below:", "Change!", "Cancel" ); new time = strval( inputtext ) ; if( time > 24 || time < 0 ) return SendClientMessage( playerid, red, ">> Available Hours: <0-24>" ); SetPlayerTime( playerid, time, 0 ); }
// IsNumeric (to prevent false values from strval if the text contains letters or other chars excluding 0-9) stock IsNumeric(const string[]) { for (new i = 0, j = strlen(string); i < j; i++) { if (string[i] > '9' || string[i] < '0') return 0; } return 1; }
|
Omg! Save me time. Thank you very much brother! +repppp