21.04.2012, 23:35
pawn Code:
cmd(cfg, playerid, params[ ] )
{
if ( !IsPlayerAdmin ( playerid ) ) return false;
if ( isnull ( params ) )
{
SendClientMessage ( playerid, 0xFF0000FF, "(ERRO) Uso correto: /cfg [param]" );
SendClientMessage ( playerid, 0xFF0000FF, "(ERRO) cp, weather." );
return true;
}
new type[ 15 ], start = strfind ( params, " " );
strmid ( type, params, 0, start == -1 ? ( strlen ( params ) ) : ( start ), sizeof type );
if ( !strcmp ( type, "cp", true ) )
{
new Float:dist;
if ( sscanf ( params, "'cp'f", dist ) )
{
return SendClientMessage ( playerid, 0xFF0000FF, "(ERRO) Uso correto: /cfg cp [distance]" );
}
new Float:ps[ 4 ];
GetPlayerPos ( playerid, ps[ 0 ], ps[ 1 ], ps[ 2 ] );
GetPlayerFacingAngle ( playerid, ps[ 3 ] );
SetPlayerCheckpoint ( playerid, ps[ 0 ] + ( dist * floatsin( -ps[ 3 ], degrees ) ), ps[ 1 ] + ( dist * floatcos( -ps[ 3 ], degrees ) ), ps[ 2 ], 2.50 );
} else
if ( !strcmp ( type, "weather", true ) )
{
new weather;
if ( sscanf ( params, "'weather'd", weather ) ) return SendClientMessage ( playerid, 0xFF0000FF, "(ERRO) Uso correto: /cfg weather [weather id]" );
if ( weather < 0 || weather > 9999 ) return SendClientMessage ( playerid, 0xFF0000FF, "(ERRO) Weather invбlido. Use um weather vбlido. (Ex: 30)" );
SetWeather ( weather );
}
return true;
}