eehm got little problem with onentercar
#1

hey guys,
i have made this kind of dialog that when a player enters a car they get a little dialog msg box which says that they have to pay road tax to drive on the roads and it works fine but now i found a little bugg and i dont know how to fix it...
everytime u enter a car u get a dialog which says if u want to pay or not pay and that part is working fine but then when ur driving or walking and someone else gets in a car then he gets the dialog too but the one who is walking gets it too... how can i make it that only the player who enters the car gets the dialog and not everyone when 1 player enters a car...
this are my codes:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SetTimer("CarDialog", 3000, false);
    return 1;
}
public CarDialog(playerid)
{
    ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_MSGBOX, "Car Tax", "to drive this vehicle you have to pay $10000 for the Road Tax!", "Pay", "Don't Pay");
    return 1;
}
pawn Код:
if(dialogid == 12345){
        if(response){
        GivePlayerMoney(playerid, -10000);
        }
        else{
            RemovePlayerFromVehicle(playerid);
        }
    }
eehm can someone help me pls
niels
Reply
#2

Why do you use a timer, when you can use OnPlayerStateChange? Like this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
       ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_MSGBOX, "Car Tax", "to drive this vehicle you have to pay $10000 for the Road Tax!", "Pay", "Don't Pay");
    }
    return 1;
}
Reply
#3

eehm and thsi is working...? this isnt doing wut i had as bugg? and i used the timer becuz then the dialog appears when the player is sitting in the car and not have to sit in teh car anyway thnx i will test now if it works..
hmm could u else join my server now to test it with me together?: 86.88.158.170:7777
Reply
#4

It will work. If you use a global timer instead of a local one (SetTimerEx), it will mix it between players. Try the one I posted, it will work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)