PDA

View Full Version : How to make faction cars ?


Andron
22/11/2008, 03:55 PM
Can somone explain how make faction cars ? Like PD,DMV,Ambulance etc ..

AiVAMAN
22/11/2008, 04:14 PM
sorry, but i don't understood you... more detailed please?

Andron
22/11/2008, 04:23 PM
Like example ..

If I want make new taxi cab you know.. So , with that new taxi cab driver can be only Taxi driver , and another players who try to drive with it get eject from car with message "You are not taxi driver" .. or like this .

Dark_Kostas
22/11/2008, 04:51 PM
First add this command

if(strcmp(cmd, "/carid", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new car = GetPlayerVehicleID(playerid);
format(string, sizeof(string), "Your car id is: %d",car);
SendClientMessage(playerid, COLOR_GREY, string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You must be in a vehicle");
}
}
return 1;
}

And when you are in game,in the car that you added type /carid.You will see a number.

Then search for

if(newcar == 82 || newcar == 84 || newcar == 85 || newcar == 94)
{
if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10) { }
else
{
SendClientMessage(playerid,COLOR_GREY," You are not a Taxi Driver !");
RemovePlayerFromVehicle(playerid);
}
}

And add the number next to "newcar == 94"

Ex when you type /carid.If you see "Your car id is: 123456"
Add this
if(newcar == 82 || newcar == 84 || newcar == 85 || newcar == 94 || newcar == 123456)

AND ASK THE GODFATHER QUESTIONS TO THE GODFATHER THREAD

MenaceX^
22/11/2008, 04:52 PM
Is it for GF?

Dark_Kostas
22/11/2008, 04:57 PM
Is it for GF?


Faction cars,DMV,taxi,PD and exactly THAT message is from GF

AiVAMAN
22/11/2008, 04:59 PM
who cares?? GF, not GF...

Zoopaman
22/11/2008, 07:18 PM
btw, wouldn't it be better to add the car's modelid (400-611) and just set a couple of exceptions when/if needed? IMO makes the code lighter and allows to swap cars w/o worrying about remembering to change the IDs...

Danut
22/11/2008, 07:22 PM
who cares?? GF, not GF...


not who cares X( you have a GodFather Topic (http://forum.sa-mp.com/index.php?topic=24634.6150)

AiVAMAN
23/11/2008, 06:12 AM
lol GodFather sucks... xD

herbjr
23/11/2008, 06:27 AM
Can somone explain how make faction cars ? Like PD,DMV,Ambulance etc ..


I think i get what you saying. But basically, what you want to do is either set it in your script that when a player gets in a vehicle, the vehicles id or model id is being check. If it is a faction car, then have the script do something accordingly. Here is an example:


forward CopCar(carid); //first

public CopCar(carid) //tells which cars are police cars
{
if((carid >= 1 && carid <= 18) || (carid >= 36 && carid <= 39))
{
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) //if player isnt a passenger then warns them
{
if(!ispassenger)
{
if(CopCar(vehicleid) && gTeam[playerid] != 1)
{
SendClientMessage(playerid,grey,"This is a Faction Vehicle. It is not allowed to take these.");
}
}
}

if(CopCar(car)) //kicks them out the car
{
RemovePlayerFromVehicle(playerid);
return 1;
}

silvan
23/11/2008, 02:41 PM
well i don't use GF but i still need this :P tnx ppl but the " RemovePlayerFromVehicle " its a little bugged it just remove the skin.... and the camera stay there... and guys how shall i define " newcar " ?

herbjr
23/11/2008, 11:57 PM
well i don't use GF but i still need this :P tnx ppl but the " RemovePlayerFromVehicle " its a little bugged it just remove the skin.... and the camera stay there... and guys how shall i define " newcar " ?


This is where keeping your script organized comes into play. When you add a car into a script, it takes on its own carid. So when you add five cars in the script, their ids will be 1 - 5. Here is an small example:

car1(code) - ID 1
car2(code) - ID 2
car3(code) - ID 3
car4(code) - ID 4
car5(code) - ID 5

So in that particular order will be their ids. As for your problem, you can send that part to me via PM and i can help you with that.

pickford78
24/11/2008, 04:36 AM
heres a cop car system with registry i just made.

you need dini and dcmd and they can be found on the forums

http://rapidshare.com/files/166815636/copsystem.pwn.html

MenaceX^
24/11/2008, 04:45 AM
Is it a GF stuff?


Anyway, That's what you need


// forward the vehicle
forward Car(carid);




// Make a public with vehicle ID's.

public Car (carid)
{
if(carid==1||carid==2||carid==3) // Vehicle ID's by game. if you have godfather there is a command - /oldcar
{
return 1;
}
return 0;
}



// Now make the car the keys.
on OnPlayerStateChange



else if(Car(newcar))
{
if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1) { } // pMemeber and pLeader are able to get in to these vehicles.
else {
SendClientMessage(playerid, COLOR_RED, "This vehicle belongs to someone !"); // ClientMessage when someone else getting to 'Car' vehicles.
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); // A cool cound like an alarm.
RemovePlayerFromVehicle(playerid); }// Removes the player from the vehicle
}




Hf.

Omega90210
11/02/2009, 08:30 PM
is there a document thats recorded the vehicles ive spawned into the game, ive spawned over 300 so far and i dont remember which number specific vehicles are in the game that i wish to lock. for /oldcar it keeps saying Oldcar: 310, and when i /gotocar i need the number again, so is there a list of cars that ive spawned along with their numbers?

[RP]Rav
11/02/2009, 08:35 PM
// somewhere on top
new taxis[3];

// OnGameModeInit
taxis[0] = AddStaticVehicle(.....);
taxis[1] = AddStaticVehicle(.....);
taxis[2] = AddStaticVehicle(.....);

// OnPlayerStateChange
if (newstate == PLAYER_STATE_DRIVER)
{
new vid = GetPlayerVehicleID(playerid);
if (player isn't a taxi driver) // replace this with your own code
for (new i = 0; i < sizeof(taxis); i++)
if (vid == taxis[i])
RemovePlayerFromVehicle(playerid);
}

Omega90210
17/02/2009, 08:32 PM
btw, wouldn't it be better to add the car's modelid (400-611) and just set a couple of exceptions when/if needed? IMO makes the code lighter and allows to swap cars w/o worrying about remembering to change the IDs...

thats what ive been wanting to do but cant figure out the damn code

CrazyChoco
10/04/2012, 08:17 PM
Well if someone figured it out please tell me, i need it thanks