Rentcar engine need help
#1

So i have this car rental system and an engine system and i want to mix those together, but my mind doesn't
go that far, because i'm beginner scripter.

At the moment when i go and sit in the rental car i can easily do /engine and drive away with the car, but what i want is that
you first have to rent a car, then you can do /engine and drive it.

Pictures:





And i also want the server to say i'm not in the car, when i'm onfoot and using /engine, at the moment it says
the same stuff like i'm in car and starting it.

I know it's hard to understand this problem, but please try understanding.
And also ask for the script if you can tell me what to add there.
Reply
#2

Post here your engine script + your rent car script.
Reply
#3

I don't know if you can understand the language or it isn't important


Engine script
pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#if defined FILTERSCRIPT

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define COLOR_GREEN 0x008000FF

#define COLOR_RED 0xFF0000FF
#define COLOR_WHITE 0xFFFFFFFF

#define COLOR_YELLOW 0xFFFF00FF

new Engine[MAX_VEHICLES];

forward EngineTimer(playerid);

public OnFilterScriptInit()
{
        print("Engine System loaded.");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#endif

public OnGameModeInit()
{
        return 1;
}

public OnGameModeExit()
{
        return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
        return 1;
}

public OnPlayerConnect(playerid)
{
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
        return 1;
}

public OnPlayerSpawn(playerid)
{
        return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
        return 1;
}

public OnVehicleSpawn(vehicleid)
{
        return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
        return 1;
}

public OnPlayerText(playerid, text[])
{
        return 1;
}



public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
        TogglePlayerControllable(playerid,1);
        return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if(newstate == PLAYER_STATE_DRIVER)
                {
                    new vehicleid = GetPlayerVehicleID(playerid);
                    if(Engine[vehicleid] == 0)
                        {
                        TogglePlayerControllable(playerid, 0);
                        SendClientMessage(playerid, COLOR_WHITE, "Et mootorit kдivitada, kirjuta /mootor");
                        }
                        else if(Engine[vehicleid] == 1)
                        {
                        SendClientMessage(playerid, COLOR_GREEN, "Kдivitasid sхidukimootori");
                        }
}
        return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
        return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
        return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
        return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
        return 1;
}

public OnRconCommand(cmd[])
{
        return 1;
}

public OnPlayerRequestSpawn(playerid)
{
        return 1;
}

public OnObjectMoved(objectid)
{
        return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
        return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
        return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
        return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
        return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
        return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
        return 1;
}

public OnPlayerExitedMenu(playerid)
{
        return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
        return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInAnyVehicle(playerid))
        {
        if(Engine[vehicleid] == 0)
        {
        if(newkeys & KEY_SECONDARY_ATTACK)
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else if(newkeys & KEY_JUMP)
        {
        SetTimerEx("EngineTimer", 0, 0, "i", playerid);
        }
        }
}
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
        return 1;
}

public OnPlayerUpdate(playerid)
{
        return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
        return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
        return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
        return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
        return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        dcmd(exitveh, 7, cmdtext);
        dcmd(mootor, 6, cmdtext);
        return 0;
}

public EngineTimer(playerid)
{
    new rand = random(2);

    if(rand == 0)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Kдivitasid sхidukimootori");
        new vehicleid = GetPlayerVehicleID(playerid);
        Engine[vehicleid] = 1;
        TogglePlayerControllable(playerid, 1);
        }

}

dcmd_mootor(playerid, params[])
{
        #pragma unused params
        new vehicleid = GetPlayerVehicleID(playerid);
        if(Engine[vehicleid] == 0)
        {
        SendClientMessage(playerid, COLOR_WHITE, "Mootor ei kдivitunud, proovi uuesti");
        SetTimerEx("EngineTimer", 0, 0, "i", playerid);
        }
        (Engine[vehicleid] == 1);
        {
        Engine[vehicleid] = 0;
        SendClientMessage(playerid, COLOR_WHITE, "Suretasid sхidukimootori");
        TogglePlayerControllable(playerid,0);
        }
        return 1;
}

dcmd_exitveh(playerid, params[])
{
        #pragma unused params
        if(IsPlayerInAnyVehicle(playerid))
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else
        {
        SendClientMessage(playerid, COLOR_RED, "Sa ei ole sхidukis!");
        }
        return 1;
}
Rent script
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT
new euros;
new admiral;
new greenwood;
new greenwood2;
new faggio;
new faggio2;
#define red 0xff0000ff
#define green 0x008000FF
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Veh Rent by Patch");
    print("--------------------------------------\n");
    euros = AddStaticVehicle(587,196.6160,-155.2688,1.6705,180.4649,1,1);
    admiral = AddStaticVehicle(445,199.6100,-155.4582,1.6705,179.6963,1,1);
    greenwood = AddStaticVehicle(492,219.1497,-173.2821,1.6704,89.2326,1,1);
    faggio = AddStaticVehicle(462,219.1508,-170.8611,1.6705,89.8024,1,1);
    greenwood2 = AddStaticVehicle(492,219.1279,-178.1658,1.6705,91.1571,1,1);
    faggio2 = AddStaticVehicle(462,219.1530,-180.6567,1.6705,90.2493,1,1);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}





#endif





public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/rendi", cmdtext, true, 10) == 0)
{
    new Vehicle = GetPlayerVehicleID(playerid);
    if(Vehicle == euros)
{
    new Money = GetPlayerMoney(playerid);
    if(Money <= 299)
{
        SendClientMessage(playerid,red,"Sul ei ole piisavalt raha, Eurose rentimine maksab 300SAK'i!");
}
    else
{
        SendClientMessage(playerid,green,"Sa rentisid endale Eurose.");
        TogglePlayerControllable(playerid,0);
        GivePlayerMoney(playerid,-300);
}
}
    if(Vehicle == greenwood)
{
    new Money = GetPlayerMoney(playerid);
    if(Money <= 199)
{
        SendClientMessage(playerid,red,"Sul ei ole piisavalt raha, Greenwoodi rentimine maksab 200SAK'i!!");
}
    else
{
        SendClientMessage(playerid,green,"Sa rentisid endale Greenwood'i.");
        TogglePlayerControllable(playerid,0);
        GivePlayerMoney(playerid,-200);
}
}
    if(Vehicle == admiral)
{
    new Money = GetPlayerMoney(playerid);
    if(Money <= 249)
{
        SendClientMessage(playerid,red,"Sul ei ole piisavalt raha, Admirali rentimine maksab 250SAK'i!");
}
    else
{
        SendClientMessage(playerid,green,"Sa rentisid endale Admirali.");
        TogglePlayerControllable(playerid,0);
        GivePlayerMoney(playerid,-250);
}
}
    if(Vehicle == faggio)
{
    new Money = GetPlayerMoney(playerid);
    if(Money <= 99)
{
        SendClientMessage(playerid,red,"Sul ei ole piisavalt raha, Faggio rentimine maksab 100SAK'i!");
}
    else
{
        SendClientMessage(playerid,green,"Sa rentisid endale Faggio.");
        TogglePlayerControllable(playerid,0);
        GivePlayerMoney(playerid,-100);
}
}
    if(Vehicle == greenwood2)
{
    new Money = GetPlayerMoney(playerid);
    if(Money <= 199)
{
        SendClientMessage(playerid,red,"Sul ei ole piisavalt raha, Greenwood'i rentimine maksab 200SAK'i!");
}
    else
{
        SendClientMessage(playerid,green,"Sa rentisid endale Greenwood'i.");
        TogglePlayerControllable(playerid,0);
        GivePlayerMoney(playerid,-200);
}
}
    if(Vehicle == faggio2)
{
    new Money = GetPlayerMoney(playerid);
    if(Money <= 99)
{
        SendClientMessage(playerid,red,"Sul ei ole piisavalt raha, Faggio rentimine maksab 100SAK'i!");
}
    else
{
        SendClientMessage(playerid,green,"Sa rentisid endale Faggio.");
        TogglePlayerControllable(playerid,0);
        GivePlayerMoney(playerid,-100);
}
}
    return 1;
}
if (strcmp("/vдlju", cmdtext, true, 10) == 0)
{
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid,1);
        return 1;
}
return 0;
}


public OnPlayerExitVehicle(playerid, vehicleid)
{
    new Vehicle = GetPlayerVehicleID(playerid);
    if(Vehicle == euros)
    {
        SetVehicleHealth(vehicleid,0);
    }
    if(Vehicle == admiral)
    {
        SetVehicleHealth(vehicleid,0);
    }
    if(Vehicle == greenwood)
    {
        SetVehicleHealth(vehicleid,0);
    }
    if(Vehicle == greenwood2)
    {
        SetVehicleHealth(vehicleid,0);
    }
    if(Vehicle == faggio)
    {
        SetVehicleHealth(vehicleid,0);
    }
    if(Vehicle == faggio2)
    {
        SetVehicleHealth(vehicleid,0);
    }
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
    new Vehicle = GetPlayerVehicleID(playerid);
    if(Vehicle == euros)
    {
    SendClientMessage(playerid,red,"Selle sхiduki rentimine maksab 300SAK'i, kirjuta /rendi. Kui sa ei soovi seda sхidukit rentida, kirjuta /vдlju");
    TogglePlayerControllable(playerid,0);
    }
    if(Vehicle == admiral)
    {
    SendClientMessage(playerid,red,"Selle sхiduki rentimine maksab 250SAK'i, kirjuta /rendi. Kui sa ei soovi seda sхidukit rentida, kirjuta /vдlju");
    TogglePlayerControllable(playerid,0);
    }
    if(Vehicle == greenwood)
    {
    SendClientMessage(playerid,red,"Selle sхiduki rentimine maksab 200SAK'i, kirjuta /rendi. Kui sa ei soovi seda sхidukit rentida, kirjuta /vдlju");
    TogglePlayerControllable(playerid,0);
    }
    if(Vehicle == faggio)
    {
    SendClientMessage(playerid,red,"Selle sхiduki rentimine maksab 100SAK'i, kirjuta /rendi. Kui sa ei soovi seda sхidukit rentida, kirjuta /vдlju");
    TogglePlayerControllable(playerid,0);
    }
    if(Vehicle == greenwood2)
    {
    SendClientMessage(playerid,red,"Selle sхiduki rentimine maksab 200SAK'i, kirjuta /rendi. Kui sa ei soovi seda sхidukit rentida, kirjuta /vдlju");
    TogglePlayerControllable(playerid,0);
    }
    if(Vehicle == faggio2)
    {
    SendClientMessage(playerid,red,"Selle sхiduki rentimine maksab 100SAK'i, kirjuta /rendi. Kui sa ei soovi seda sхidukit rentida, kirjuta /vдlju");
    TogglePlayerControllable(playerid,0);
    }

    }
    return 1;
}
Reply
#4

Help, someone?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)