[Ajuda] Carro nгo explodir, Parar
#1

olб estou tentando colocar no meu GM para o caro parar antes de explodir, para que os mecanicos consertem-o
parei aqui:
forward CheckCarHealth();

public CheckCarHealth()
{
new string[256];
new sendername[MAX_PLAYER_NAME];
for (new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i),health);
if(health <= 400)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(i, 0);
SendClientMessage(i, COLOR_LIGHTBLUE, "Seu veiculo quebrou, tente ligar novamente ou ligue para um mecanico! (/sair para sair do veiculo)");
engineOn[GetPlayerVehicleID(i)] = false;
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* O veiculo de %s quebrou.", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
}
}
}
}

POREM deu este erro:
D:\Arquivos - Formatando\Sa-Mp\gamemodes\tlb.pwn(28387) : error: 017: undefined symbol "engineOn"
D:\Arquivos - Formatando\Sa-Mp\gamemodes\tlb.pwn(28387) : error: 001: expected token: ";", but found "]"
D:\Arquivos - Formatando\Sa-Mp\gamemodes\tlb.pwn(28387) : error: 029: invalid expression, assumed zero
D:\Arquivos - Formatando\Sa-Mp\gamemodes\tlb.pwn(28387) : error fatal: 107: too many error messages on one line
Reply
#2

Topo GM:
pawn Код:
new engineOn[MAX_PLAYERS];
Cуdigo:
pawn Код:
forward CheckCarHealth();

public CheckCarHealth()
{
new string[256];
new sendername[MAX_PLAYER_NAME];
for (new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i),health);
if(health <= 400)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(i, 0);
SendClientMessage(i, COLOR_LIGHTBLUE, "Seu veiculo quebrou, tente ligar novamente ou ligue para um mecanico! (/sair para sair do veiculo)");
engineOn[i] = false;
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* O veiculo de %s quebrou.", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
}
}
}
}
OnGameModeInit:
pawn Код:
SetTimer("CheckCarHealth",2000,true);

Agradeзa
Reply
#3

Obrigado (: porem ele nгo quer sair do carro digitando /sair, como arrumar isso? Obrigado
Reply
#4

Para o player sair do veiculo fassa o seguinte
Код:
if(strcmp(cmdtext,"/sair",true)==0)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
Reply
#5

Vlws veiu *-*
Reply
#6

Quote:
Originally Posted by [FeK]DraKiNs
Посмотреть сообщение
Topo GM:
pawn Код:
new engineOn[MAX_PLAYERS];
Cуdigo:
pawn Код:
forward CheckCarHealth();

public CheckCarHealth()
{
new string[256];
new sendername[MAX_PLAYER_NAME];
for (new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:health;
GetVehicleHealth(GetPlayerVehicleID(i),health);
if(health <= 400)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(i, 0);
SendClientMessage(i, COLOR_LIGHTBLUE, "Seu veiculo quebrou, tente ligar novamente ou ligue para um mecanico! (/sair para sair do veiculo)");
engineOn[i] = false;
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* O veiculo de %s quebrou.", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
}
}
}
}
OnGameModeInit:
pawn Код:
SetTimer("CheckCarHealth",2000,true);

Agradeзa
Nгo funfou aqui , compila sem erro mais nгo funfa T_T
Reply
#7

perdгo, sou novo aki, malz isso nao ira se repetir postei errado.
Sergio.
Reply
#8

Nenhuma parte do codigo funciona ae ?
Reply
#9

onde coloca o codigo pawno?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)