car command engine dindt start
#1

Hello there i need help with my givecar command .

When the car spawns it dont start the engine why ? i typed engine 1 but still didnt work

Quote:

//Not!!!:Admin seviyerleri bende olmadэрэ iзin silmek zorunda kaldэm. Eklemeyi unutma
COMMAND:givecar(playerid, params[])
{
// Check if the player's admin-level is at least 1
if (APlayerData[playerid][PlayerLevel] >= 1)

// Send the command to all admins so they can see it
SendAdminText(playerid, "/givecar", params);
new OldCardi[MAX_PLAYER_NAME] = 0;
new id, carid; new Float: x, Float: y, Float: z, Float: r, vehicle;
new vid;
new engine,lights,alarm,doors,bonnet,boot,objective;
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Also re-fuel the vehicle
AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
//start engine
// Get the vehicle-id of that player's vehicle
vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vid, 1, 1, alarm, doors, bonnet, boot, objective);
}

if(sscanf(params, "ui", id, carid)) return SendClientMessage(playerid, 0xFFFFFFF,"Hata! Komutun kullanymy: /givecar [Playerid] [Carid]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFFFFF,"Bцyle bir oyuncu bulunamady!");
if(carid < 400 || carid > 611) return SendClientMessage(playerid, 0xFFFFFFF, "Araз id leri 400 ile 611 arasynda olmalydyr.");
if(IsPlayerInAnyVehicle(id))
{
DestroyVehicle(GetPlayerVehicleID(id));
}

if(OldCardi[id] > 0)
{
DestroyVehicle(OldCardi[id]);
OldCardi[id] = 0;
}

GetPlayerPos(id, x, y, z);
GetPlayerFacingAngle(id,r);
vehicle = CreateVehicle(carid, x, y, z, r, 1, 1, 300);
PutPlayerInVehicle(id, vehicle, 0);

OldCardi[id] = GetPlayerVehicleID(id); //Player a araз verildiрi zaman id sini deрiюkene atэyor, bu sayede oyundan зэktэрэnda veya ona yeni bir araз verdiрimizde eski arabasэ silinicek
return 1;
}

Reply
#2

can nobody help pls
Reply
#3

Try this:
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
Reply
#4

Its works when i give it to myself but when i give it to an other player the engine didnt start and has no fuel
Reply
#5

Change this:
Код:
vid = GetPlayerVehicleID(playerid);
AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
To this:
Код:
vid = GetPlayerVehicleID(id);
AVehicleData[GetPlayerVehicleID(id)][Fuel] = MaxFuel;
And then put it before this:
pawn Код:
if(sscanf(params, "ui", id, carid)) return SendClientMessage(playerid, 0xFFFFFFF,"Hata! Komutun kullanymy: /givecar [Playerid] [Carid]");
Reply
#6

thank you for your effort but it dont work, now it doesnt start the engine anymore when i give it to myself
Reply
#7

pawn Код:
COMMAND:givecar(playerid, params[])
{
    if(APlayerData[playerid][PlayerLevel] >= 1)

    SendAdminText(playerid, "/givecar", params);

    new OldCardi[MAX_PLAYER_NAME] = 0;
    new id, carid; new Float: x, Float: y, Float: z, Float: r, vehicle;
    new engine,lights,alarm,doors,bonnet,boot,objective;

    if(sscanf(params, "ui", id, carid)) return SendClientMessage(playerid, 0xFFFFFFF,"Hata! Komutun kullanymy: /givecar [Playerid] [Carid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFFFFF,"Bцyle bir oyuncu bulunamady!");
    if(carid < 400 || carid > 611) return SendClientMessage(playerid, 0xFFFFFFF, "Araз id leri 400 ile 611 arasynda olmalydyr.");
    if(IsPlayerInAnyVehicle(id)) DestroyVehicle(GetPlayerVehicleID(id));

    if(OldCardi[id] > 0)
    {
        DestroyVehicle(OldCardi[id]);
        OldCardi[id] = 0;
    }

    GetPlayerPos(id, x, y, z);
    GetPlayerFacingAngle(id, r);
    vehicle = CreateVehicle(carid, x, y, z, r, 1, 1, 300);
    PutPlayerInVehicle(id, vehicle, 0);

    AVehicleData[vehicle][Fuel] = MaxFuel;
    GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicle, 1, 1, alarm, doors, bonnet, boot, objective);

    OldCardi[id] = GetPlayerVehicleID(id);
    return 1;
}
Reply
#8

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
pawn Код:
COMMAND:givecar(playerid, params[])
{
    if(APlayerData[playerid][PlayerLevel] >= 1)

    SendAdminText(playerid, "/givecar", params);

    new OldCardi[MAX_PLAYER_NAME] = 0;
    new id, carid; new Float: x, Float: y, Float: z, Float: r, vehicle;
    new engine,lights,alarm,doors,bonnet,boot,objective;

    if(sscanf(params, "ui", id, carid)) return SendClientMessage(playerid, 0xFFFFFFF,"Hata! Komutun kullanymy: /givecar [Playerid] [Carid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFFFFF,"Bцyle bir oyuncu bulunamady!");
    if(carid < 400 || carid > 611) return SendClientMessage(playerid, 0xFFFFFFF, "Araз id leri 400 ile 611 arasynda olmalydyr.");
    if(IsPlayerInAnyVehicle(id)) DestroyVehicle(GetPlayerVehicleID(id));

    if(OldCardi[id] > 0)
    {
        DestroyVehicle(OldCardi[id]);
        OldCardi[id] = 0;
    }

    GetPlayerPos(id, x, y, z);
    GetPlayerFacingAngle(id, r);
    vehicle = CreateVehicle(carid, x, y, z, r, 1, 1, 300);
    PutPlayerInVehicle(id, vehicle, 0);

    AVehicleData[vehicle][Fuel] = MaxFuel;
    GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicle, 1, 1, alarm, doors, bonnet, boot, objective);

    OldCardi[id] = GetPlayerVehicleID(id);
    return 1;
}
Thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)