new TempoFaltando[MAX_PLAYERS];
new Str[256];
new Timer;
CMD:teste(playerid)
{
if(TempoFaltando[playerid] != 0)
{
format(Str, 256, "Ainda faltam %i segundos para vocк poder usar este comando novamente", TempoFaltando[playerid]);
return SendClientMessage(playerid, -1, Str);
}
// FUNЗХES DO COMANDO
TempoFaltando[playerid] = 40;
Timer = SetTimerEx("DiminuirTempo", 1000, true, "i", playerid);
return 1;
}
forward DiminuirTempo(playerid);
public DiminuirTempo(playerid)
{
TempoFaltando[playerid]--;
if(TempoFaltando == 0) KillTimer(Timer);
return 1;
}
if( !strcmp( cmdtext, "/consertar", true ))
{
if( pInfo[ playerid ][ Prof ] == MECANICO || aInfo[ playerid ][ Admin ] == 1 || aInfo[ playerid ][ Moderador ] == 1 )
{
if( !IsPlayerInAnyVehicle( playerid ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк nгo estб em um veнculo !" );
return 1;
}
SendClientMessage( playerid, COLOR_AMARELO, "[ > ] Veнculo consertado !" );
new
v = GetPlayerVehicleID( playerid )
;
SetVehicleHealth( v, 1000 );
RepairVehicle( v );
PlayerPlaySound( playerid, 1057, 0.0, 0.0, 10.0 );
}
else
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк nгo й um(a) Mecвnico(a) !" );
}
return 1;
}
|
Olha ai o comando
Код:
if( !strcmp( cmdtext, "/consertar", true ))
{
if( pInfo[ playerid ][ Prof ] == MECANICO || aInfo[ playerid ][ Admin ] == 1 || aInfo[ playerid ][ Moderador ] == 1 )
{
if( !IsPlayerInAnyVehicle( playerid ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк nгo estб em um veнculo !" );
return 1;
}
SendClientMessage( playerid, COLOR_AMARELO, "[ > ] Veнculo consertado !" );
new
v = GetPlayerVehicleID( playerid )
;
SetVehicleHealth( v, 1000 );
RepairVehicle( v );
PlayerPlaySound( playerid, 1057, 0.0, 0.0, 10.0 );
}
else
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк nгo й um(a) Mecвnico(a) !" );
}
return 1;
}
|
new TempoFaltando[MAX_PLAYERS];
new Str[256];
new Timer;
if (!strcmp(cmdtext, "/consertar", true))
{
if(TempoFaltando[playerid] != 0)
{
format(Str, 256, "Ainda faltam %i segundos para vocк poder usar este comando novamente", TempoFaltando[playerid]);
return SendClientMessage(playerid, -1, Str);
}
if (pInfo[playerid][Prof] == MECANICO || aInfo[playerid][Admin] == 1 || aInfo[playerid][Moderador] == 1)
{
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_ERRO, "[ x ] Vocк nгo estб em um veнculo !");
return 1;
}
SendClientMessage(playerid, COLOR_AMARELO, "[ > ] Veнculo consertado !");
new
v = GetPlayerVehicleID(playerid);
SetVehicleHealth(v, 1000);
RepairVehicle(v);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 10.0);
TempoFaltando[playerid] = 40;
Timer = SetTimerEx("DiminuirTempo", 1000, true, "i", playerid);
}
else
{
SendClientMessage(playerid, COLOR_ERRO, "[ x ] Vocк nгo й um(a) Mecвnico(a) !");
}
return 1;
}
forward DiminuirTempo(playerid);
public DiminuirTempo(playerid)
{
TempoFaltando[playerid]--;
if(TempoFaltando == 0) KillTimer(Timer);
return 1;
}
if(TempoFaltando[playerid] == 0) KillTimer(Timer), KillTimer(DiminuirTempo);