SA-MP Forums Archive
Need help with cars - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with cars (/showthread.php?tid=59855)



Need help with cars - ghost_in_dark - 30.12.2008

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


Re: Need help with cars - Khelif - 30.12.2008

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;
}



Re: Need help with cars - Nero_3D - 30.12.2008

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


Re: Need help with cars - Khelif - 30.12.2008

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


Re: Need help with cars - Nero_3D - 30.12.2008

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


Re: Need help with cars - SantarioLeone - 30.12.2008

What GM are you running



Re: Need help with cars - ghost_in_dark - 01.01.2009

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


Re: Need help with cars - introzen - 01.01.2009

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;
}



Re: Need help with cars - ghost_in_dark - 01.01.2009

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

thanks for your help again

topic can be closed


Re: Need help with cars - Peter_Corneile - 11.04.2009

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