SA-MP Forums Archive
how to make this - 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: how to make this (/showthread.php?tid=221914)



how to make this - dot - 06.02.2011

how to make the cars not to be drivable without payment ? like when someone gets into a car it will ask him to pay for it..if he doesn't accept the character will automatically get out of the car


Re: how to make this - fangoth1 - 06.02.2011

here ill give your a basic idea
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
              ShowPlayerDialog(playerid, dialogid, style, "something here", "Accept" , "Decline");
        }
        return 1;
}
now you got to have response to the dialog you just made
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(response)
        {
        switch(dialogid)
        {
        case 1:
        {

        case 0:
        {
        if(GetPlayerMoney(playerid) > 500)
        {
              SendClientMessage(playerid, COLOR, "You Dont Have Enough Money");
              RemovePlayerFromVehicle(playerid);
        }
        else if(GetPlayerMoney(playerid) < 500)
        {
                GivePlayerMoney(playerid, -500);
                SendClientMessage(playerid, COLOR, "You Have Rented This Vehicle");
        }
      }
    }
  }
  return 1;
}
There ya go, that should work, but if you get out of the vehicle you would more then likely have to rent it again, you would have to set a timer , and sorry for bad indent dont like forums cant hit tab


Re: how to make this - alpha500delta - 06.02.2011

Why are you using a switch statement for that, it works fine without switch and is faster to, And why using a dialog? you can also just send him a message that he rented the vehicle, and if not remove him. No dialog needed


Re: how to make this - fangoth1 - 06.02.2011

so he could confirm if he wanted to rent the vehicle


Re: how to make this - admantis - 06.02.2011

Quote:
Originally Posted by fangoth1
Посмотреть сообщение
so he could confirm if he wanted to rent the vehicle
I don't think if he typed it in a command it would be an accident.


Re: how to make this - fangoth1 - 06.02.2011

he wants it to pop something up when the enter the vehicle thus this will work