30.11.2013, 00:57
Eai galera, Hoje venho aqui pedir a vcs, um sistema de procurar carro por id, Tipo o cara digita /lcarro [iddocarro] ai o carro e marcado no mapa, se alguйm ai pode me ajudar, agradeзo vlw
CMD:procurarcarro(playerid, params[])
{
new VeiculoID, Float:Pos_Veiculo[2];
if(sscanf(params, "d", VeiculoID)) return SendClientMessage(playerid, -1, "Use: /procurarcarro [veiculoid]");
GetVehiclePos(VeiculoID, Pos_Veiculo[0], Pos_Veiculo[1], Pos_Veiculo[2]);
SetPlayerCheckpoint(playerid, Pos_Veiculo[0], Pos_Veiculo[1], Pos_Veiculo[2], 3.0);
return 1;
}
vehicleX[playerid] = COLOQUE_AQUI_A_VARIAVEL_ID_DO_CREATE_VEHICLE
#define T_LOCALIZAR_PLAYER (0)
new P_TIMER[50][ MAX_PLAYERS];
forward GetPlayerLocate( playerid, vehiclelocate );
YCMD:locatev( playerid, params[], help )
{
for( new v = 0, p = 0; v < MAX_VEHICLES & p < MAX_PLAYERS; v++, p++ )
{
if( (v == INVALID_VEHICLE_ID ) | (p == INVALID_PLAYER_ID))
continue;
if( vehicleX[ v ] == GetPlayerVehicleID( p ) )
return GetPLocate( p, v );
}
return true;
}
public GetPLocate( playerlocate, vehiclelocate ) {
P_TIMER[ T_LOCALIZAR_PLAYER ][ playerid ] = SetTimerEx( "GetPlayerLocate", true, 800, "ii", playerlocate, vehiclelocate );
return 0;
}
public GetPlayerLocate( playerid, vehid )
{
new Float: fDistance, pPos[3], vPos[3];
GetVehiclePos( vehid, vPos[0], vPos[1], vPos[2] );
fDistance = GetVehicleDistanceFromPoint( vehid, vPos[0], vPos[1], vPos[2] ),
if( fDistance <= 10.0 )
return KillTimer( P_TIMER[ T_LOCALIZAR_PLAYER ][ playerid ] ),
DisablePlayerCheckpoint( playerid );
SetPlayerCheckpoint( playerid, vPos[0], vPos[1], vPos[2] , 5.0 );
return 0;
}
public OnPlayerDisconnect(playerid)
{
KillTimer( P_TIMER[ T_LOCALIZAR_PLAYER ][ playerid ] );
return 1;
}