SA-MP Forums Archive
(ask)create rent car - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: (ask)create rent car (/showthread.php?tid=224650)



(ask)create rent car - gondes - 12.02.2011

how to create system rentcar?


Re: (ask)create rent car - Unknown123 - 12.02.2011

With, zcmd or dcmd and of course PAWNO


Re: (ask)create rent car - gondes - 12.02.2011

example?


Re: (ask)create rent car - Unknown123 - 12.02.2011

Here is something i just mixed together (Untested)

You maybe need to add something like:
when he type /stoprent then the car respawns
pawn Код:
new RentsCar[MAX_PLAYERS];
new VehiclesToRent[5];

forward HasRentedCar();

public OnGameModeInit()
{
    VehiclesToRent[0] = AddStaticVehicleEx(...);
    VehiclesToRent[1] = AddStaticVehicleEx(...);
    VehiclesToRent[2] = AddStaticVehicleEx(...);
    VehiclesToRent[3] = AddStaticVehicleEx(...);
    VehiclesToRent[4] = AddStaticVehicleEx(...);
    SetTimer("HasRentedCar",10000, 1);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(rentcar, 7, cmdtext);
    dcmd(stoprent, 8, cmdtext);
    return 0;
}

dcmd_rentcar(playerid, params[])
{
    #pragma unused params
    RentsCar[playerid] = 1;
    return 1;
}

dcmd_stoprent(playerid, params[])
{
    #pragma unused params
    RentsCar[playerid] = 0;
    return 1;
}

public HasRentedCar()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && RentsCar[i] == 1)
        {
            SendClientMessage(i, 0xFF0000FF, "You payed for your rented car ($500)");
            GivePlayerMoney(i, -500);
        }
    }
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && VehiclesToRent[4])
    {
        if(RentsCar[playerid] == 1)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You entered the car you rented!");
            return 1;
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0xFF0000FF, "Type /rentcar to rent this car!");
            return 1;
        }
    }
    return 1;
}



Re: (ask)create rent car - Dan_Barocu - 15.04.2011

can you make it in pwn.?


Re: (ask)create rent car - alpha500delta - 15.04.2011

Dude just place it in pawno and save it then it's a freaking .pwn!