Need Help
#1

I need help with the next problem:
I am making a fixcar but in a roleplay server. So if i am in a car and i typ /fixcar my bonnet goes open and a marker will appear. if you enter the marker you get a dialog and if you choose fix car you will fix the car.

But you are not in a vehicle so he don't know which vehicle he need to fix. So how can i save or something the vehicle id whichone i callback in the marker on repairing?

Can someone help me please?
Reply
#2

What about show the code?
Reply
#3

pawn Код:
new TrunkOpen[MAX_PLAYERS];
new BonnetOpen[MAX_PLAYERS];
new usetoolkit[MAX_PLAYERS];


new markertrunk;
new markerhood;

//COMMANDTEXT

    if(strcmp(cmd, "/opentrunk", true) == 0)
    {
        new Float:health;
        new veh;
        veh = GetPlayerVehicleID(playerid);
        GetVehicleHealth(veh, health);
        if(health >1000) return SendClientMessage(playerid,RED,"Doesn't need to fix your engine!");
        if (Toolkit[playerid] <=0) return SendClientMessage(playerid,RED,"You need a Toolkit to fix your car!");
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "  Step in a vehicle!");
        if(TrunkOpen[playerid] == 1) return SendClientMessage(playerid, 0xAFAFAFAA, "  The trunk is already open !");
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors,  bonnet, VEHICLE_PARAMS_ON, objective);
       

        new Float:playx, Float:playy, Float:playz, Float:angle, Float:x2, Float:y2;
        GetPlayerPos(playerid, playx, playy, playz);
        GetPlayerDistanceFromPoint(playerid, playx, playy-1, playz);
        GetPlayerFacingAngle(playerid, angle);
        GetXYBehindPoint(playx, playy, x2, y2, 0, 3);
        markertrunk = CreateDynamicCP(x2,y2,playz, 1.50, -1, -1, -1, -25);
        SendClientMessage(playerid, 0x33CCFFAA, "walk into the marker!");
        TrunkOpen[playerid] = 1;
        return 1;
    }


    if(strcmp(cmd, "/openbonnet", true) == 0)
    {
        if (usetoolkit[playerid] == 1)
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "  Step in a vehicle!");
        if(BonnetOpen[playerid] == 1) return SendClientMessage(playerid, 0xAFAFAFAA, "  The bonnet is already open !");
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors,  VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, objective);
   
        new Float:playx, Float:playy, Float:playz, Float:angle, Float:x2, Float:y2;
        GetPlayerPos(playerid, playx, playy, playz);
        GetPlayerDistanceFromPoint(playerid, playx, playy-1, playz);
        GetPlayerFacingAngle(playerid, angle);
        GetXYBehindPoint1(playx, playy, x2, y2, 0, 3);
        SendClientMessage(playerid, 0x33CCFFAA, "walk into the marker!");
        markerhood = CreateDynamicCP(x2,y2,playz, 1.50, -1, -1, -1, -25);
        BonnetOpen[playerid] = 1;
        return 1;
    }


    if(strcmp(cmd, "/closehoods", true)== 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "  Step in a vehicle!");
        if(TrunkOpen[playerid] == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "  The trunk is already closed !");
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors,  VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, objective);
        TrunkOpen[playerid] = 0;
        BonnetOpen[playerid] = 0;
        return 1;
    }


    if(dialogid == 104)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, 0xAFAFAFAA, "  step out of your vehicle!");
                if(usetoolkit[playerid] == 1) return SendClientMessage(playerid, 0xAFAFAFAA, "  You already took a toolkit!");
                if(TrunkOpen[playerid] == 0) return SendClientMessage(playerid, 0xAFAFAFAA, "  The trunk is closed!");
                if(TrunkOpen[playerid] == 1)
                {
                    SendClientMessage(playerid,0xAFAFAFAA,"you took a toolkit!");
                    usetoolkit[playerid] = 1;
                    DestroyDynamicCP(markertrunk);
                }
            }
        }
    }


// DIALOG'S
   
    if(dialogid == 105)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if (usetoolkit[playerid] == 1)
                {
                    Toolkit[playerid] --;
                    SetTimerEx("repairing", 3000, false, "i", playerid);
                    TogglePlayerControllable(playerid, 0);
                    Textrepair=TextDrawCreate(280.000000, 200.000000,"Repairing. . .");
                    TextDrawLetterSize(Textrepair, 0.679999, 1.500000);
                    TextDrawColor(Textrepair, 0xFFFFFFFF);
                    TextDrawSetOutline(Textrepair,1);
                    TextDrawFont(Textrepair,3);
                    TextDrawShowForPlayer(playerid, Textrepair);
                }
            }
        }
    }


//MARKERS

    if(checkpointid == markertrunk)
    {
        ShowPlayerDialog(playerid,104,DIALOG_STYLE_LIST,"TRUNK","Take Toolkit","Select","Cancel");
    }
   
    if(checkpointid == markerhood)
    {
        ShowPlayerDialog(playerid,105,DIALOG_STYLE_LIST,"BONNET","fix engine","Select","Cancel");
    }
   

//STOCKS

stock GetXYBehindPoint (Float:x,Float:y,&Float:x2,&Float:y2,Float:angle,Float:distance)
    {
        x2 = x - (distance * floatsin(-angle,degrees));
        y2 = y - (distance * floatcos(-angle,degrees));
        return 1;
    }

stock GetXYBehindPoint1 (Float:x,Float:y,&Float:x2,&Float:y2,Float:angle,Float:distance)
    {
        x2 = x + (distance * floatsin(-angle,degrees));
        y2 = y + (distance * floatcos(-angle,degrees));
        return 1;
    }
// public from repairing timer
public repairing(playerid)
{
   
    TogglePlayerControllable(playerid, 1);
    TextDrawDestroy(Textrepair);
    SetVehicleHealth(????,750);
    usetoolkit[playerid] = 0;
    SendClientMessage(playerid,GREEN,"You fixed your car for 75 percent!");
    SendClientMessage(playerid,GREEN,"Go back in your vehicle and typ /closehoods!");
    DestroyDynamicCP(markerhood);
}
Now by the timer i want to fix the car but i don't know how to fix the vehicle id in SetVehicleHealth(?,750);

how can i do that?
Reply
#4

Already fixed it with SetPVarInt(playerid, "vehid", GetPlayerVehicleID(playerid)); ty!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)