Need help with cars
#1

Hello everybody,

I need help. I want to create a new faction so can anyone help me with specifying the cars something like:

if player belongs to team... enter car
else case stop entering vehicle.

hope you understand iґm from germany.

thanks to beforehand
Reply
#2

I dont quite get what you mean. I did only example, dont know if it helps..

Код:
public OnPlayerEnterVehicle(playerid, vehicleid) {

	for(new i=0; i<MAX_PLAYERS; i++) {
	  if(Player[i][pTeam] != Grove) {
         RemovePlayerFromVehicle(i)
    }
  }
  return 1;
}
Reply
#3

there are rly much topics about that also search for it and Khelif your code wont work
Reply
#4

well it's just an example, ofcourse you need to define all that stuff to make it work lol
Reply
#5

Quote:
Originally Posted by Khelif
well it's just an example, ofcourse you need to define all that stuff to make it work lol
no the mainpart dont work, you just need to read the header "OnPlayerEnterVehicle" and function "RemovePlayerFromVehicle" than you noticed the player isnt in a vehicle he is just entering so the function RemovePlayerFromVehicle would fail
Reply
#6

What GM are you running
Reply
#7

Thanks for your help the first few posts have reached so I was able to do the faction cars by the car ids e.g.

carid infernus = only for yakuzas but the problem now is if any user wants to have an infernus as a housecar he cant drive it because its only for yakuza. So my last question: Is it able to ask not after the carid so e.g. infernus = 411 instead i would like to ask after the number the car is on the server so the number you can get with /oldcar

exactly im trying to ask after this



thanks to beforehand
Reply
#8

On top:
Код:
#define COLOR_DARKRED 0xAA3333AA
Somewhere:
Код:
forward ReservedCar(carid);
public ReservedCar(carid)
{
	if(carid == Car1 || carid == Car2 || carid == Car3 || carid == Car4 || carid == Car5 || carid == Car6) //change the ids to ids of the reserved vehicles
	{
		return 1;
	}
	return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new newcar = GetPlayerVehicleID(playerid);
	if(ReservedCar(newcar))
	{
 		if(gTeam[playerid] == 30) { } //you can drive it if you are a faction member Member of the choosen faction
 		else //this will happen if someone else enters the vehicle and if he is not in the faction
 		{
    	RemovePlayerFromVehicle(playerid);
    	SendClientMessage(playerid, COLOR_DARKRED,".: [RESERVED VEHICLE] You can't drive this vehicle :.");
 		}
	}
	return 1;
}
Reply
#9

thanks the mistake was in the newcar definition but i fixed it.

thanks for your help again

topic can be closed
Reply
#10

Can you help me , if i use this code my Inrozen then would this be a problem ? The car that i added as the Team car , if it is the same as some other faction too then will it be able to be driven by them too ? :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)