/freeze command help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /freeze command help (
/showthread.php?tid=417339)
/freeze command help -
Goldino - 20.02.2013
Hey guys, just finished making my freeze/unfreeze/auto-unfreeze functions for my server. The problem is, when I freeze someone, unfreeze them ( or they get automatically un frozen ), and then freeze them, it says they are already frozen. For example:
-I freeze a player
-I unfreeze them, or they get automatically unfrozen
-I freeze them again, it says "This person is already frozen".
I have done it properly. Look:
Код:
CMD:unfreeze( playerid, params[ ] )
{
if ( pInfo[ playerid ][ Adminlevel ] < 2 )
return SendClientMessage(playerid, RED, "You are not authorised to use this command");
new
id;
if ( sscanf( params, "u", id ) )
return SendClientMessage( playerid, RED, "USAGE : /unmute [id/name]" );
if ( id == INVALID_PLAYER_ID )
return SendClientMessage( playerid, RED, "That player is not connected." );
if ( !playerFrozen{ id } ) // Player is not muted
return SendClientMessage( playerid, RED, "ERROR: That player is not frozen." );
new
str6[ 128 ];
format( str6, sizeof ( str6 ), "[UNMUTE] Administrator %s has unfrozen %s.", GetName( playerid ), GetName( id ) );
SendClientMessageToAll( RED, str6 );
playerMuted{ id } = false;
TogglePlayerControllable(id,1);
return 1;
}
See, it turns it to false when you un freeze them.
Same here,
Код:
forward FreezeTimer( playerid );
public FreezeTimer( playerid )
{
if ( !playerFrozen{ playerid } )
return 1;
new
str[ 128 ];
format( str, sizeof ( str ), "[AUTO - UNFREEZE] %s has been automatically unfrozen.", GetName( playerid ) );
SendClientMessageToAll(RED, str);
playerMuted{ playerid } = false;
TogglePlayerControllable(playerid,1);
return 1;
}
^^^ See, it turns false meaning he is not frozen anymore.
The problem is here:
Код:
CMD:freeze( playerid, params[] )
{
if ( pInfo[ playerid ][ Adminlevel ] < 2 )
return SendClientMessage( playerid, RED, "You are not authorised to use this command" );
new
id,
minutes,
reason[ 128 ];
if ( sscanf( params, "uis", id, minutes, reason ) )
return SendClientMessage( playerid, RED, "USAGE: /freeze [id/name] [minutes] [reason]" );
if ( id == INVALID_PLAYER_ID )
return SendClientMessage( playerid, RED, "That player is not connected" );
if ( playerFrozen{ id } )
return SendClientMessage( playerid, RED, "That player is already frozen." );
new
time = ( minutes * 60000 ); // 1000 ms = 1 sec || 60k ms = 1 min ( 60 sec )
SetTimerEx( "FreezeTimer", time, false, "i", id );
new
str[ 128 ];
format( str, sizeof ( str ), "[FREEZE] Administrator %s has muted %s for %i minutes. Reason: %s",
GetName( playerid ), GetName( id ), minutes, reason );
SendClientMessageToAll( RED, str );
playerFrozen{ id } = true;
TogglePlayerControllable(id,0);
return 1;
}
I don't see a problem with the script, Please help!
Re: /freeze command help -
ryansheilds - 20.02.2013
You used 'playerMuted' in the unfreeze public and CMD. Shouldn't it be 'playerFrozen'?
Re: /freeze command help -
Goldino - 21.02.2013
Ty sooo much. Rep for u