CMD:usercp ( playerid, params[] )
{
new count = GetTickCount();
switch ( CPActive [ playerid ] )
{
case 0:
{
// It's not active - enable it.
TextDrawShowForPlayer ( playerid, UserCP_Title );
TextDrawShowForPlayer ( playerid, UserCP_TopLine );
TextDrawShowForPlayer ( playerid, UserCP_ChangePW );
TextDrawShowForPlayer ( playerid, UserCP_ChangeUsername );
TextDrawShowForPlayer ( playerid, UserCP_Resync );
TextDrawShowForPlayer ( playerid, UserCP_ViewMap );
TextDrawShowForPlayer ( playerid, UserCP_ViewAccInfo );
TextDrawShowForPlayer ( playerid, UserCP_BottomLine );
SelectTextDraw ( playerid, 0x7EBA1EFF );
CPActive [ playerid ] = 1;
SendClientMessage ( playerid, -1, ""#INT_CONSOLE"~ "#INT_SILVER"Type "#INT_YELLOW"/usercp "#INT_SILVER"again to disable the User Control Panel!" );
}
case 1:
{
// It's active - disable it.
TextDrawHideForPlayer ( playerid, UserCP_Title );
TextDrawHideForPlayer ( playerid, UserCP_TopLine );
TextDrawHideForPlayer ( playerid, UserCP_ChangePW );
TextDrawHideForPlayer ( playerid, UserCP_ChangeUsername );
TextDrawHideForPlayer ( playerid, UserCP_Resync );
TextDrawHideForPlayer ( playerid, UserCP_ViewMap );
TextDrawHideForPlayer ( playerid, UserCP_ViewAccInfo );
TextDrawHideForPlayer ( playerid, UserCP_BottomLine );
CancelSelectTextDraw ( playerid );
CPActive [ playerid ] = 0;
SendClientMessage ( playerid, -1, ""#INT_CONSOLE"~ "#INT_SILVER"Type "#INT_YELLOW"/usercp "#INT_SILVER"again to enable the User Control Panel!" );
}
}
printf("Time taken to execute /usercp: %d", GetTickCount() - count);
return true;
}
GetTickCount() - count
GetTickCount() - GetTickCount()
I don't know much about GetTickCount(), but as you do:
pawn Код:
pawn Код:
(It could be that I'm wrong, never worked with GetTickCount) |
for(new i=0;i<10000;i++){ TextDrawShowForPlayer ( playerid, UserCP_Title ); TextDrawShowForPlayer ( playerid, UserCP_TopLine ); TextDrawShowForPlayer ( playerid, UserCP_ChangePW ); TextDrawShowForPlayer ( playerid, UserCP_ChangeUsername ); TextDrawShowForPlayer ( playerid, UserCP_Resync ); TextDrawShowForPlayer ( playerid, UserCP_ViewMap ); TextDrawShowForPlayer ( playerid, UserCP_ViewAccInfo ); TextDrawShowForPlayer ( playerid, UserCP_BottomLine ); }