Mechanic help.
#1

My friend scripted a mechanic impound and i scripted a /gate impound code for it But i want to link it with mechanic so only mechanic job can /gate impound any help?
Reply
#2

that shouldnt be hard.. can we see the code ?
Reply
#3

Quote:
Originally Posted by spd_sahil
Посмотреть сообщение
that shouldnt be hard.. can we see the code ?
Which code?
Reply
#4

Your script code...
Reply
#5

We need the code that tells the script if the player is a mechanic is not.
What you need to do is when the player does /gate it checks if the player is a mechanic or not, if the player isn't a mechanic send them a message and terminate the code.
Reply
#6

You need to show us the variable code of Mechanic.
Reply
#7

Код:
	if(strcmp(cmd, "/repair", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(PlayerInfo[playerid][pJob] != 7)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "   You are not a Car Mechanic!");
		        return 1;
		    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /repair [playerid/PartOfName] [price]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if(money < 1 || money > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Price not lower then 1, or above 99999!"); return 1; }
			if(IsPlayerConnected(playa))
			{
			    if(playa != INVALID_PLAYER_ID)
			    {
			        if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
					{
					    if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "   Can't do that!"); return 1; }
				    	GetPlayerName(playa, giveplayer, sizeof(giveplayer));

					    format(string, sizeof(string), "* You offerd %s to fix his car for $%d .",giveplayer,money);
						SendClientMessage(playerid, COLOR_WHITE, string);
						format(string, sizeof(string), "* Car Mechanic %s wants to repair your car for $%d, (type /accept repair) to accept.",sendername,money);
						SendClientMessage(playa, COLOR_WHITE, string);
						RepairOffer[playa] = playerid;
						RepairPrice[playa] = money;
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "   That player is not near you / not in a car.");
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   That player is offline.");
			}
		}
		return 1;
	}
Reply
#8

pawn Код:
if(strcmp(cmd, "/repair", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] != 7)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not a Car Mechanic!");
                return 1;
            }
            if(PlayerInfo[playerid][pJob] == 7)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /repair [playerid/PartOfName] [price]");
                    return 1;
                }
                new playa;
                new money;
                playa = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                money = strval(tmp);
                if(money < 1 || money > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Price not lower then 1, or above 99999!"); return 1; }
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
                        {
                            if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "   Can't do that!"); return 1; }
                            GetPlayerName(playa, giveplayer, sizeof(giveplayer));

                            format(string, sizeof(string), "* You offerd %s to fix his car for $%d .",giveplayer,money);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* Car Mechanic %s wants to repair your car for $%d, (type /accept repair) to accept.",sendername,money);
                            SendClientMessage(playa, COLOR_WHITE, string);
                            RepairOffer[playa] = playerid;
                            RepairPrice[playa] = money;
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   That player is not near you / not in a car.");
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   That player is offline.");
                }
            }
        }
        return 1;
    }

what i actullay did here is the code which is what the machanic does has been put under if the player's job is mechanic ( id 7 ) thats what i figured when i looked at the code.. this should work
Reply
#9

pawn Код:
if(PlayerInfo[playerid][pJob] != 7)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not a Mechanic!");
                return 1;
            }
It should be something like this, now you can use it at your gate code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)