Jump to content
  • 0

Question

Posted

Problema intalnita (descriere):Am o problema cu comanda /setonline imi urca orele dar cand vreau sa imi scad sau sa imi dau 0 nu imi scade 0.o
Ero(area / rile) / warning-(ul / urile):N/a
Liniile de cod / sursa / script-ul(obligatoriu):

CMD:setonline( playerid, params[ ] )
{
	new Player, sTime[ 3 ];

    if ( !IsPlayerAdmin( playerid ) )
		return SendError( playerid, "You need to be logged as RCON admin before use this command!" );

	if ( sscanf( params, "udD(-1)D(-1)", Player, sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] ) )
		return SendClientMessage( playerid, COLOR_ULTRARED, "{FF0000}USAGE: /setonline [PlayerID] [Hours] [Minutes] [Secounds]" );

	PlayerInfo[ Player ][ hours ] += sTime[ 0 ];

	if( sTime[ 1 ] != -1 )
		PlayerInfo[ Player ][ mins ] += sTime[ 1 ];

	if( sTime[ 2 ] != -1 )
		PlayerInfo[ Player ][ secs ] += sTime[ 2 ];

	if( sTime[ 1 ] != -1 && sTime[ 2 ] != -1 )
	{
		FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - minutes | %d - seconds", PlayerName( Player ), sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] );
		FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - minutes | %d - seconds", PlayerName( playerid ), sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] );
	}
	if( sTime[ 1 ] != -1 && sTime[ 2 ] == -1 )
	{
		FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - minutes", PlayerName( Player ), sTime[ 0 ], sTime[ 1 ] );
		FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - minutes", PlayerName( playerid ), sTime[ 0 ], sTime[ 1 ] );
	}
	if( sTime[ 1 ] == -1 && sTime[ 2 ] != -1 )
	{
		FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - seconds", PlayerName( Player ), sTime[ 0 ], sTime[ 2 ] );
		FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - seconds", PlayerName( playerid ), sTime[ 0 ], sTime[ 2 ] );
	}
	else
	{
		FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours", PlayerName( Player ), sTime[ 0 ] );
		FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours", PlayerName( playerid ), sTime[ 0 ] );
	}
	return ( 1 );
}

Imagini / Video (optional):N/a
Ati incercat sa rezolvati singur?:Da dar nmk

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

Incearca:

 

CMD:setonline( playerid, params[ ] )
{
new Player, sTime[ 3 ];
 
    if ( !IsPlayerAdmin( playerid ) )
return SendError( playerid, "You need to be logged as RCON admin before use this command!" );
 
if ( sscanf( params, "udD(-1)D(-1)", Player, sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] ) )
return SendClientMessage( playerid, COLOR_ULTRARED, "{FF0000}USAGE: /setonline [PlayerID] [Hours] [Minutes] [Secounds]" );
 
PlayerInfo[ Player ][ hours ] = sTime[ 0 ];
 
if( sTime[ 1 ] != -1 )
PlayerInfo[ Player ][ mins ] = sTime[ 1 ];
 
if( sTime[ 2 ] != -1 )
PlayerInfo[ Player ][ secs ] = sTime[ 2 ];
 
if( sTime[ 1 ] != -1 && sTime[ 2 ] != -1 )
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - minutes | %d - seconds", PlayerName( Player ), sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - minutes | %d - seconds", PlayerName( playerid ), sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] );
}
if( sTime[ 1 ] != -1 && sTime[ 2 ] == -1 )
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - minutes", PlayerName( Player ), sTime[ 0 ], sTime[ 1 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - minutes", PlayerName( playerid ), sTime[ 0 ], sTime[ 1 ] );
}
if( sTime[ 1 ] == -1 && sTime[ 2 ] != -1 )
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - seconds", PlayerName( Player ), sTime[ 0 ], sTime[ 2 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - seconds", PlayerName( playerid ), sTime[ 0 ], sTime[ 2 ] );
}
else
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours", PlayerName( Player ), sTime[ 0 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours", PlayerName( playerid ), sTime[ 0 ] );
}
return ( 1 );
}
Edited by #Teddy
  • Upvote 1

Ocupation: Youtube, Mined Bitcoin's, Scripting & Mapping SA:MP

  • 0
Posted

Cand vrei ca sa iti scada, foloseste:

/setonline [PlayerID] [-Numar]

242086.png

  • 0
Posted

Cand vrei ca sa iti scada, foloseste:

/setonline [PlayerID] [-Numar]

Nu merge

 

 

Incearca:

 

CMD:setonline( playerid, params[ ] )
{
new Player, sTime[ 3 ];
 
    if ( !IsPlayerAdmin( playerid ) )
return SendError( playerid, "You need to be logged as RCON admin before use this command!" );
 
if ( sscanf( params, "udD(-1)D(-1)", Player, sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] ) )
return SendClientMessage( playerid, COLOR_ULTRARED, "{FF0000}USAGE: /setonline [PlayerID] [Hours] [Minutes] [Secounds]" );
 
PlayerInfo[ Player ][ hours ] = sTime[ 0 ];
 
if( sTime[ 1 ] != -1 )
PlayerInfo[ Player ][ mins ] = sTime[ 1 ];
 
if( sTime[ 2 ] != -1 )
PlayerInfo[ Player ][ secs ] = sTime[ 2 ];
 
if( sTime[ 1 ] != -1 && sTime[ 2 ] != -1 )
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - minutes | %d - seconds", PlayerName( Player ), sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - minutes | %d - seconds", PlayerName( playerid ), sTime[ 0 ], sTime[ 1 ], sTime[ 2 ] );
}
if( sTime[ 1 ] != -1 && sTime[ 2 ] == -1 )
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - minutes", PlayerName( Player ), sTime[ 0 ], sTime[ 1 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - minutes", PlayerName( playerid ), sTime[ 0 ], sTime[ 1 ] );
}
if( sTime[ 1 ] == -1 && sTime[ 2 ] != -1 )
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours | %d - seconds", PlayerName( Player ), sTime[ 0 ], sTime[ 2 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours | %d - seconds", PlayerName( playerid ), sTime[ 0 ], sTime[ 2 ] );
}
else
{
FormatMSG( playerid, COLOR_ABLUE, "You set %s online time to: %d - hours", PlayerName( Player ), sTime[ 0 ] );
FormatMSG( Player, COLOR_ABLUE, "%s has set your online time to: %d - hours", PlayerName( playerid ), sTime[ 0 ] );
}
return ( 1 );
}

 

Tyy

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.