Advanced Mechanic
#1

Hey guys iv been working on the mechanic system a bit and came up with a good idea. I need a bit of an example though coz im not sure where to start.)

What I want is, If the player is a mechanic then it checks if he is in a vehicle, if not then you need to be.
Then checks if they are a passenger and if not says you have to be.
Then checks if there is a driver, again if not there needs to be one to continue.
Then when there is a driver and your in the car as a passenger:
A dialog will show up for the mechanic with a list. level 1, level 2, level 3, level 4, level 5.
Mechanic chooses a level then a list will come up for which ever level you are. Levels only show up if you are atleast that level.
Then when the player chooses to repair or upgrade whatever, it asks the driver of the vehicle.
Thanks so much guys

Also what Iv got so far is:
Код:
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pJob] != JOB_MECHANIC && !PlayerInfo[playerid][pVIP]) return SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic.");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be in a vehicle to do that.");
	if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GREY, "You must be a passenger to use that command.");
I think its mainly the getting who is driving the vehicle part thats bothering me. If someone can atleast help with that then that would be amazing!
Reply
#2

Can someone help me please? Its mainly getting whos in the driver seat that I need. Thanks!
Reply
#3

Get rid of the eye-ache-inducing colored text then maybe people will be more inclined to help.

According to your avatar you like eyes - so spare a thought for mine.
Reply
#4

pawn Код:
#define DIALOG_FIX 0
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pJob] != JOB_MECHANIC && !PlayerInfo[playerid][pVIP]) return SendClientMessage(playerid, COLOR_GREY, "You are not a mechanic.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be in a vehicle to do that.");
    if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GREY, "You must be a passenger to use that command.");
    new vid = GetPlayerVehicleID(playerid);
    new found = -1;
    for(new i=0;i<MAX_PLAYERS;++i)
    {
        if(!IsPlayerConnected(i)) continue;
        if(!IsPlayerInVehicle(i,vid)) continue;
        if(GetPlayerVehicleSeat(i) == 0 && playerid!=i)
        {
        found = i;
        break;
        }
    }
    if(found == -1) return SendClientMessage(playerid,COLOR_GREY,"There is no driver in your car");

    switch(PlayerInfo[playerid][pJob][Level])//Assumimg level is stored like this
    {
        case 1:ShowPlayerDialog(playerid,DIALOG_FIX,DIALOG_STYLE_LIST,"FIX","Level 1","Fix","Cancel");
        case 2:ShowPlayerDialog(playerid,DIALOG_FIX,DIALOG_STYLE_LIST,"FIX","Level 1\nLevel 2","Fix","Cancel");
        case 3:ShowPlayerDialog(playerid,DIALOG_FIX,DIALOG_STYLE_LIST,"FIX","Level 1\nLevel \nLevel 3","Fix","Cancel");
        case 4:ShowPlayerDialog(playerid,DIALOG_FIX,DIALOG_STYLE_LIST,"FIX","Level 1\nLevel \nLevel 3\nLevel 4","Fix","Cancel");
        case 5:ShowPlayerDialog(playerid,DIALOG_FIX,DIALOG_STYLE_LIST,"FIX","Level 1\nLevel \nLevel 3\nLevel 4\nLevel 5","Fix","Cancel");
    }
Reply
#5

hey sorry MP2 it was colour-less to begin with didnt realise itd be a big problem, and ROXOR thanks for that Im going to check it out now!

Thanks this works good, but i need help with using who is in the driver seat and after choosing say repair in the dialog it asks that player.

After the code runs and gets the ID of the player in the driver seat iv made it :
ShowDialog(playerid, 9);
which is:
ShowPlayerDialog(playerid, 9, DIALOG_STYLE_LIST, "Mechanic Tools", "Repair Vehicle\nAdd/Remove Nitros\nAdd/Remove Hydraulics", "Choose", "Cancel");

Then under that:
Код:
	else if(dialogid == 9) //Mechanic
	{
	    if(response)
	    {
	        switch(listitem)
	        {
	            case 0: // Repair Vehicle
	            {

				}
This is where I want the mechanic to choose the repair and it will ask the ID of the driver in the seat if they'd like to accept/cancel.

Im a bit lost in what to do.
Iv got cmd:accept setup when accepting the mechanic.
but i was for use with the old mechanic way not how id like it to be now with the dialog..
Reply
#6

If figured out how to do all of what I wanted, now iv got a problem with this:
How would I make it so after you have types /mech and chosen to repair the vehicle
another dialog shows up to input a price, then the rest of the code continues after youv done that?
Iv created the dialogs for the input and repair etc. I just dont know how to make it so you enter the price
then the code uses that.
What happens at the moment is you enter the price but the rest of the code continues, disregarding the price you enter.
Thanks guys!

got everything working thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)