[HELP] Adding new car to faction.
#1

Its my first time to work in a gamemode like this because here the cars for faction like fbi pd and other its loaded from cars.cfg and in gm i only find some few things there no models id for that car is fbi or pd so when i try to add an carr in gamemode and make it to work only for that faction its not possible i tryed too many times i know i have some wrong somewhere, thats why i need your help.


Let say this is faction FBI (isafbicar) - default in GM.
pawn Код:
IsAFBICar(carid)
{
    for(new i = 0; i < sizeof(CarInfo); i++)
    {
        if(CarInfo[i][cID] == carid)
        {
            if (CarInfo[i][cFaction] == CAR_FACTION_FBI)
            {
                return true;
            }
        }
    }
    return false;
}
So i add cars in other way not in the file cars.cfg i add them in gamemode.
pawn Код:
stock IsAnFbiCar(carid)
{
     if(carid == FBI1 || carid == FBI2 || carid == FBI3 || carid == FBI4)
     {
         return 1;
     }
     return 0;
}
And the cars:
pawn Код:
FBI1 = AddStaticVehicleEx(507,252.3000000,-1631.5000000,33.1000000,52.0000000,70,89,15); //Elegant
    FBI2 = AddStaticVehicleEx(490,284.7000100,-1632.0000000,33.6000000,82.0000000,-1,-1,15); //FBI Rancher
    FBI3 = AddStaticVehicleEx(490,298.7000100,-1633.6999500,33.6000000,83.9960000,-1,-1,15); //FBI Rancher
    FBI4 = AddStaticVehicleEx(507,247.0000000,-1610.4000200,33.0000000,30.0000000,70,89,15); //Elegant
So i change the car restriction like if you fbi you can drive if not you cant.

Default in GM:
Код:
			if (CarInfo[i][cFaction] == CAR_FACTION_FBI)
			{
                if(PlayerInfo[playerid][pMember] != 2 && PlayerInfo[playerid][pLeader] != 2)
				{
			        RemovePlayerFromVehicle(playerid);
			        SendClientMessage(playerid, COLOR_RED,"Niste clan FBI organizacije.");
				}
			}
I change to:

Код:
			if (CarInfo[i][cFaction] == CAR_FACTION_FBI && model != IsAnFbiCar(model))
			{
                if(PlayerInfo[playerid][pMember] != 2 && PlayerInfo[playerid][pLeader] != 2)
				{
			        RemovePlayerFromVehicle(playerid);
			        SendClientMessage(playerid, COLOR_RED,"Niste clan FBI organizacije.");
				}
			}
There is a system for vehicle engine and i add there the (IsAnFBiCar)

pawn Код:
IsAVehicleForEngine(vehicle)
{
    for(new i = 0; i < sizeof(CarInfo); i++)
    {
        if(CarInfo[i][cID] == vehicle)
        {
            if( IsATruck(vehicle) ||
                IsANormal(vehicle) ||
                IsAEvent(vehicle) ||
                IsACopCar(vehicle) ||
                IsAFBICar(vehicle) ||
                IsANewsCar(vehicle) ||
                IsADoctorCar(vehicle) ||
                IsAFishBoat(vehicle) ||
                IsAKarting(vehicle) ||
                IsAPizzaBoy(vehicle) ||
                IsAIceCreamTruck2(vehicle) ||
                IsAMayorVeh(vehicle) ||
                IsALicenseVeh(vehicle) ||
                IsASRCar(vehicle) ||
                IsAGradjevinarCar(vehicle) ||
                IsASweeper2(vehicle) ||
                IsAFactionHarvest(vehicle) ||
                IsAKamion2(vehicle) ||
                IsABus2(vehicle) ||
                IsATestCar(vehicle) ||
                IsATaxi2(vehicle) ||
                IsATestBoat(vehicle) ||
                IsATow2(vehicle)  ||
                IsAnFbiCar(vehicle))
            {
                return true;
            }
        }
    }
    return false;
}
So the problem is there cars in the gamemode but everyone can drive them i try and other way in (newstate == PLAYER_STATE_DRIVER) i put this:

pawn Код:
if(IsAnFbiCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2) { }
            else {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY,"Nemate kljuceve od ovog vozila.");}
        }
But now the commands like /lockfcar not work because the car is not loaded like the basic other cars its loaded in other way also this cars FBI when i try to start /engine on they not work they need toolkit to broke the lock and to can start engine but for Elegant cars they dont need engine they allredy started ? Here down is basic from the cars.cfg but i dont know how they are loaded and how i can add static cars for organization like pd fbi and if i want to add elegant or sultan maybe will says something other not like what i want.

pawn Код:
420,0,2,0,1778.677368,-1933.161010,13.253190,359.263488,-1,-1,300,0,26,0,0,0,349
438,0,2,0,1777.065673,-1895.066284,13.165300,268.102996,-1,-1,300,0,26,0,0,0,350
438,0,2,0,1777.049926,-1898.426269,13.168100,269.598114,-1,-1,300,0,26,0,0,0,351
438,0,2,0,1777.249755,-1902.347900,13.165800,271.104309,-1,-1,300,0,26,0,0,0,352
438,0,2,0,1777.308837,-1906.208740,13.166296,269.123901,-1,-1,300,0,26,0,0,0,353
438,0,2,0,1777.443481,-1909.882690,13.167098,271.085388,-1,-1,300,0,26,0,0,0,354
525,0,2,0,1604.2959,-1836.9579,13.3856,270.2015,1,2,120,16,7,0,0,0,355
525,0,2,0,1603.8812,-1824.9948,13.3497,269.3648,1,2,120,16,7,0,0,0,356
525,0,2,0,1599.3904,-1814.6191,13.3069,268.1912,1,3,120,16,7,0,0,0,357
525,0,2,0,1599.5531,-1791.1028,13.2348,268.9581,1,3,120,16,7,0,0,0,358
551,0,1,0,1197.764526,-1830.885498,13.061200,270.231994,-1,-1,600,11,0,1,0,0,359
551,0,1,0,1250.628540,-1804.741943,13.167490,127.289100,-1,-1,600,11,0,1,0,0,360
Reply
#2

uhh what?

pawn Код:
if(IsAnFbiCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2) { }
            else {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY,"Nemate kljuceve od ovog vozila.");}
        }
isnt it better like:
pawn Код:
if(IsAnFbiCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] != 2||PlayerInfo[playerid][pMember] != 2)
            {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY,"Nemate kljuceve od ovog vozila.");
            return 1;
            }
        }
Reply
#3

Quote:
Originally Posted by kamzaf
Посмотреть сообщение
uhh what?

pawn Код:
if(IsAnFbiCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2) { }
            else {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY,"Nemate kljuceve od ovog vozila.");}
        }
isnt it better like:
pawn Код:
if(IsAnFbiCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] != 2||PlayerInfo[playerid][pMember] != 2)
            {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY,"Nemate kljuceve od ovog vozila.");
            return 1;
            }
        }
I know i tryed and this before but its same read up..
Reply
#4

add this

forward IsAFBICar(carid);
Reply
#5

Quote:
Originally Posted by morocco
Посмотреть сообщение
add this

forward IsAFBICar(carid);
Please read the subject and read the post and then answer because you really don't know what i really need so just read then ..... I don't need the forward because i use system for that and really that is not the problem everything works and its fine btw my question was how to add cars in cars.cfg to specific organization and how to fix the problem if is possible to put an car i tryed and i can put but then how to make it to work with /lockfcar.


pawn Код:
if(strcmp(cmd, "/lockfcar", true) == 0)
    {
        if (PlayerInfo[playerid][pMember] > 0 || PlayerInfo[playerid][pLeader] > 0)
        {
            for(new c = 0; c < sizeof(CarInfo); c++)
            {
                new Float:x,Float:y,Float:z;
                new carid = CarInfo[c][cID];
                GetVehiclePos(carid, x, y, z);
                GetPlayerName(playerid, sendername, sizeof(sendername));

                if(IsPlayerInRangeOfPoint(playerid,3, x, y, z))
                {
                    if(PlayerInfo[playerid][pMember] == CarInfo[c][cFaction] || PlayerInfo[playerid][pLeader] == CarInfo[c][cFaction])
                    {
                        if (CarInfo[c][cUsage] == CAR_USAGE_FACTION)
                        {
                            if(CarInfo[c][cLock] == 0)
                            {
                                foreach(Player, i)
                                {
                                    LockCar(CarInfo[c][cID]);
                                }
                                GameTextForPlayer(playerid, "~w~Auto organizacije~n~~r~zakljucan", 10000, 6);
                                CarInfo[c][cLock] = 1;
                                format(string, sizeof(string), "* %s zakljucava automobil.", sendername);
                                ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                return 1;
                            }
                            else if(CarInfo[c][cLock] == 1)
                            {
                                foreach(Player, i)
                                {
                                    UnLockCar(CarInfo[c][cID]);
                                }
                                GameTextForPlayer(playerid, "~w~Auto organizacije~n~~g~otkljucan", 10000, 6);
                                CarInfo[c][cLock] = 0;
                                format(string, sizeof(string), "* %s otkljucava automobil.", sendername);
                                ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                return 1;
                            }
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "Nemozete kljucati auto druge organizacije.");
                        return 1;
                    }
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Niste clan organizacije.");
            return 1;
        }
        return 1;
    }
If anyone know please answer here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)