[PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Chis - 27.01.2012
Olб
To criando um emprego de caminhгo, vai funcionar assim, a pessoa entra no caminhгo (ID 514) e automaticamente aparece um CheckPoint para ela ir pegar a carga, e quando chegar no CheckPoint da carga automaticamente aparecera outro CheckPoint para ir entregar a carga, chegando la ela ganha a grana 2000. Nгo tenho ideia de como fazer. +REP para quem ajudar.
Nгo sei se vai precisar mais tai
pawn Код:
Caminhoneiro[0] = CreateVehicle(514,(...)
Caminhoneiro[1] = CreateVehicle(514,(...)
Coordenada que poderia ser o CheckPoint pra pegar a carga
1635.424316 1594.583496 10.820312
E o para entregar a carga
2754.956787 -2407.125488 13.458230
Respuesta: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Chis - 27.01.2012
Up...
Re: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Enderman - 27.01.2012
Qual vбriavel define a profissгo? new profissгo? ..new org....
Respuesta: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Chis - 27.01.2012
Re: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Enderman - 27.01.2012
Testei aqui e funcionou
Espero ter ajudado
pawn Код:
new bool:PegarCarga[MAX_PLAYERS];
new bool:EntregarCarga[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new carros = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i = 0; i < sizeof(Caminhoneiro); i ++)
{
if(carros == Caminhoneiro[i])
{
if(Empregos[playerid] == CAMINHONEIRO )
{
SendClientMessage(playerid,-1,"Vб atй o CheckPoint para pegar a carga");
SetPlayerCheckpoint(playerid, 1635.424316,1594.583496,10.820312, 8.0);
PegarCarga[playerid] = true;
}
}
}
}
return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(EntregarCarga[playerid])
{
DisablePlayerCheckpoint(playerid);
EntregarCarga[playerid] = false;
SendClientMessage(playerid,-1,"Vocк entregou a carga, bom trabalho , vocк ganhou 2000R$ pelo serviзo");
GivePlayerMoney(playerid,2000);
}
if(PegarCarga[playerid])
{
SendClientMessage(playerid,-1,"Vocк pegou sua carga, agora vб atй o ponto de entrega");
DisablePlayerCheckpoint(playerid);
PegarCarga[playerid] = false;
SetPlayerCheckpoint(playerid, 2754.956787,-2407.125488,13.458230, 8.0);
EntregarCarga[playerid] = true;
}
return true;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PegarCarga[playerid] || EntregarCarga[playerid])
{
SendClientMessage(playerid,-1,"Vocк saiu do caminhгo , vocк falhou na missгo");
PegarCarga[playerid] = false;
EntregarCarga[playerid] = false;
DisablePlayerCheckpoint(playerid);
}
return true;
}
Respuesta: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Chis - 27.01.2012
(106) : error 021: symbol already defined: "OnPlayerStateChange"
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{ //LINHA ERRO
new carros = GetPlayerVehicleID(playerid);
Re: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Enderman - 27.01.2012
Vocк jб tem uma public OnPlayerStateChange'-'
Respuesta: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Chis - 27.01.2012
fail kk vou arrumar aqui
Respuesta: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Chis - 27.01.2012
Me ajuda a colocar isso aqui
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new carros = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i = 0; i < sizeof(Caminhoneiro); i ++)
{
if(carros == Caminhoneiro[i])
{
if(Empregos[playerid] == CAMINHONEIRO )
{
SendClientMessage(playerid,-1,"Vб atй o CheckPoint para pegar a carga");
SetPlayerCheckpoint(playerid, 1635.424316,1594.583496,10.820312, 8.0);
PegarCarga[playerid] = true;
}
}
}
}
return true;
}
Aqui dentro
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new car = GetPlayerVehicleID(playerid);//armazena na vбriavel car o carro em q ele estб.
if(newstate == PLAYER_STATE_DRIVER)//se O Player entrar como motorista
{
for(new i = 0; i < sizeof(Caminhoneiro); i ++)
{//realizara um loop na Array cars
if(car == Caminhoneiro[i])
{//se o carro em que vocк estб for igual б algum da array
if(Emprego[playerid] != CAMINHONEIRO)
{//se a profissгo do cara for diferente da citada acima
SendClientMessage(playerid, COR_MARROMCLARO, "[ERRO] Vocк nгo й um caminhoneiro!");
RemovePlayerFromVehicle(playerid);//irб removelo do carro e mandar a mensagem.
}
}
}
}
return true;
}
To tentando aqui mais esse return ta me confundindo um pouco
Re: [PEDIDO]Entrar no veiculo e ir em ChecckPoint -
Enderman - 27.01.2012
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new car = GetPlayerVehicleID(playerid);//armazena na vбriavel car o carro em q ele estб.
if(newstate == PLAYER_STATE_DRIVER)//se O Player entrar como motorista
{
for(new i = 0; i < sizeof(Caminhoneiro); i ++)
{//realizara um loop na Array cars
if(car == Caminhoneiro[i])
{//se o carro em que vocк estб for igual б algum da array
if(Emprego[playerid] != CAMINHONEIRO)
{//se a profissгo do cara for diferente da citada acima
SendClientMessage(playerid, COR_MARROMCLARO, "[ERRO] Vocк nгo й um caminhoneiro!");
RemovePlayerFromVehicle(playerid);//irб removelo do carro e mandar a mensagem.
}
else
{
SendClientMessage(playerid,-1,"Vб atй o CheckPoint para pegar a carga");
SetPlayerCheckpoint(playerid, 1635.424316,1594.583496,10.820312, 8.0);
PegarCarga[playerid] = true;
}
}
}
}
return true;
}