#include <a_samp>
#define FILTERSCRIPT
#pragma tabsize 0
#if defined FILTERSCRIPT
#endif
//Cores
#define VERDE 0x33AA33AA
#define VERMELHO 0xFF000096
#define PRETO 0x000000FF
#define AZUL 0x2641FEAA
#define ROXO 0xC2A2DAAA
#define AMARELO 0xFFFF00AA
#define CINZA 0xAFAFAFAA
#define Verde 0x00D700AA
new Engine[MAX_VEHICLES];
forward EngineTimer(playerid);
public OnFilterScriptInit()
{
print("[HTS][LIGADO]Sistema De Ligar E Desligar Veiculo Feito Por: Tomboy e Caio Cartaxo![HTS].");
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 0)
{
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, Verde, "[Brasil Softer]Pressione (4) ou digite /ligarv para ligar seu veiculo");
SendClientMessage(playerid, Verde, "[Brasil Softer]Pressione (Espaзo) ou digite /desligarv Para desligar seu veiculo");
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(newkeys == 8192)
{
if(Engine[vehicleid] == 1)
Engine[vehicleid] = 0;
TogglePlayerControllable(playerid, 0);
}
}
if(Engine[vehicleid] == 0)
{
if(newkeys == 128) // Jump
{
SetTimerEx("EngineTimer", 1000, 0, "i", playerid);
TogglePlayerControllable(playerid, 1);
}
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/ligarv", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 0)
{
SendClientMessage(playerid, VERDE, "[Brasil Softer]Ligando veiculo...");
SetTimerEx("EngineTimer", 1000, 0, "i", playerid);
}
else if(Engine[vehicleid] == 1)
{
SendClientMessage(playerid, AMARELO, "[Brasil Softer]Seu veiculo ja estб ligado!.");
}
return 1;
}
if(strcmp(cmdtext, "/desligarv", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
Engine[vehicleid] = 0;
TogglePlayerControllable(playerid, 0);
}
return 1;
}
return 0;
}
}
public EngineTimer(playerid)
{
new rand = random(2);
if(rand == 0)
{
SendClientMessage(playerid, Verde, "[Brasil Softer]Veiculo ligado!. Para desligar o veiculo use /desligarv ou aperte ALT");
new vehicleid = GetPlayerVehicleID(playerid);
Engine[vehicleid] = 1;
}
if(rand == 1)
{
SendClientMessage(playerid, Verde, "[Brasil Softer]Veiculo ligado!. Para desligar o veiculo use /desligarv ou aperte ALT");
new vehicleid = GetPlayerVehicleID(playerid);
Engine[vehicleid] = 1;
}
if(rand == 2)
{
SendClientMessage(playerid, Verde, "[Brasil Softer]Veiculo ligado!. Para desligar o veiculo use /desligarv ou aperte ALT");
new vehicleid = GetPlayerVehicleID(playerid);
Engine[vehicleid] = 1;
}
}
C:\Program Files\Rockstar Games\GTA San Andreas\Server\filterscripts\Motor.pwn(95) : warning 209: function "OnPlayerCommandText" should return a value |
} |
A funзгo OnPlayerCommandText precisa retornar algum valor, coloque return 1; antes da ъltima chave
ex: Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/talzinho", true)) { if(talzinho == 1) { SendClientMessage(playerid, -1, "Talzinho foi ativado, agora ele й um pinto no lixo"); } } return 1; } |
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/ligarv", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 0)
{
SendClientMessage(playerid, VERDE, "[Brasil Softer]Ligando veiculo...");
SetTimerEx("EngineTimer", 1000, 0, "i", playerid);
}
else if(Engine[vehicleid] == 1)
{
SendClientMessage(playerid, AMARELO, "[Brasil Softer]Seu veiculo ja estб ligado!.");
}
return 1;
}
if(strcmp(cmdtext, "/desligarv", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
Engine[vehicleid] = 0;
TogglePlayerControllable(playerid, 0);
}
return 1;
}
return 0;
}
// Cade o return aqui?
}