Spawning car rows in front of the player
#4

pawn Код:
CMD:eveh(playerid, params[])
{
    new vehid;
   
    if(sscanf(params, "i", vehid)) SendClientMessage(playerid, Red, "Use: /eveh <car id>");
    else
    {
        new
            Float:x, Float:y, Float:z, Float: a;
           
        GetPlayerFacingAngle(playerid, a);
       
        //second parameter is distance, use negative velue to get pos behind playerid
        GetXYZInFrontOfPlayer(playerid, 2, x, y, z);
       
        CreateVehicle(vehid, x , y , z, a-180, 1,1, 60000);
        CreateVehicle(vehid, x , y , z, a-180, 2,2, 60000);
       
        GetXYZInFrontOfPlayer(playerid, 11, x, y, z);

        CreateVehicle(vehid, x, y , z, a-180, 3,3, 60000);
        CreateVehicle(vehid, x, y , z, a-180, 4,4, 60000);
       
        GetXYZInFrontOfPlayer(playerid, 17, x, y, z);

        CreateVehicle(vehid, x, y, z, a-180, 5,5, 60000);
        CreateVehicle(vehid, x, y, z, a-180, 6,6, 60000);

    }
    return 1;
}

stock TE::GetXYZInFrontOfPlayer(playerid, Float:range, &Float:x, &Float:y, &Float:z)
{
    new
        Float:fPX, Float:fPY, Float:fPZ,
        Float:fVX, Float:fVY, Float:fVZ;
    GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
    GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
    x = fPX + floatmul(fVX, range);
    y = fPY + floatmul(fVY, range);
    z = fPZ + floatmul(fVZ, range);
}
EDIT: I'm not sure about distances they may be too far away or too close together (i used your numbers). The respawn time for vehicles is done in seconds, so your making those vehicles respawn after 60000 (16 hours and 40 minutes). If you don't want them to respawn use -1 as respawn time parameter.
Reply


Messages In This Thread
Spawning car rows in front of the player - by MarinacMrcina - 04.06.2012, 18:32
Re: Spawning car rows in front of the player - by ViniBorn - 04.06.2012, 19:08
Re: Spawning car rows in front of the player - by MarinacMrcina - 04.06.2012, 19:17
Re: Spawning car rows in front of the player - by iggy1 - 05.06.2012, 09:25

Forum Jump:


Users browsing this thread: 1 Guest(s)