SA-MP Forums Archive
Cars enterable for certain Scores Only - 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: Cars enterable for certain Scores Only (/showthread.php?tid=133056)



Cars enterable for certain Scores Only - laser50 - 10.03.2010

Hey, i got 2 questions about the title:

1. How do i do it?
2. I got like 15 vehicles witch are all enterable for different Scores, do i have to do New, New, New, New for all the 15 vehicles or is their a more simple thing to use?


Re: Cars enterable for certain Scores Only - Carlton - 10.03.2010

Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
   if(newstate == 2) {
   if(GetPlayerVehicleID(playerid) == THE_VEHICLE_VARIABLE_YOU_PLACED) {
   if(GetPlayerScore(playerid) < THE_SCORE_YOU_WANT_FOR_THE_VEHICLE +1) return RemovePlayerFromVehicle(playerid);
   }
   }
   
   return 1;
}



Re: Cars enterable for certain Scores Only - 02manchestera - 10.03.2010

Код:
if (GetVehicleModel(vehicleidx) == 432)
				{
					if(rank[playerid] >= 2) //what ever rank u want it to be.
					{
			    	IsInRhino[playerid] = vehicleidx;
			  	}
		   		else
					{
					  new Float:X, Float:Y, Float:Z;
						GetPlayerPos(playerid, X, Y, Z);
						SetPlayerPos(playerid, X+2.0, Y, Z+2.0);
						SendClientMessage(playerid, COLOR_RED, "You arent rank 2!");
				 	}
				}



Re: Cars enterable for certain Scores Only - Fedee! - 10.03.2010

Quote:
Originally Posted by Carlton
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
   if(newstate == 2) {
   if(GetPlayerVehicleID(playerid) == THE_VEHICLE_VARIABLE_YOU_PLACED) {
   if(GetPlayerScore(playerid) < THE_SCORE_YOU_WANT_FOR_THE_VEHICLE +1) return RemovePlayerFromVehicle(playerid);
   }
   }
   
   return 1;
}
This will consume too much CPU ussage, best is like this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(GetPlayerScore(playerid) < 5 && GetPlayerVehicleID(playerid) == Vehicles[1] || Vehicles[2])//And so on...
  {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this vehicle!");
    SetPlayerPos(playerid, x, y, z+1.5);
  }
  return 1;
}
EDIT:
Lol, I forgotted something , now ill work.


Re: Cars enterable for certain Scores Only - Torran - 10.03.2010

Quote:
Originally Posted by laser50
2. I got like 15 vehicles witch are all enterable for different Scores, do i have to do New, New, New, New for all the 15 vehicles or is their a more simple thing to use?
pawn Код:
new Vehicles[15];

Vehicles[1] = Vehicle..
Vehicles[2] = Vehicle..
Vehicles[3] = Vehicle..
Vehicles[4] = Vehicle..
Vehicles[5] = Vehicle..
And so on..


Re: Cars enterable for certain Scores Only - 02manchestera - 10.03.2010

i just got it if ever car has different score to enter then i tihnk yes.


Re: Cars enterable for certain Scores Only - Carlton - 10.03.2010

Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by Carlton
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
   if(newstate == 2) {
   if(GetPlayerVehicleID(playerid) == THE_VEHICLE_VARIABLE_YOU_PLACED) {
   if(GetPlayerScore(playerid) < THE_SCORE_YOU_WANT_FOR_THE_VEHICLE +1) return RemovePlayerFromVehicle(playerid);
   }
   }
   
   return 1;
}
This will consume too much CPU ussage, best is like this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(GetPlayerScore(playerid) < 5 && GetPlayerVehicleID(playerid) == Vehicles[1] || Vehicles[2])//And so on...
  {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SendClientMessage(playerid,COLOR_RED,"You are not allowed to use this vehicle!");
    SetPlayerPos(playerid, x, y, z+1.5);
  }
  return 1;
}
EDIT:
Lol, I forgotted something , now ill work.
You're saying a example as if someone's computer is 20mb ram or something. It won't be that much, and if you read what he laser50 said, he said each vehicles has their own score needed to enter the vehicle.


Re: Cars enterable for certain Scores Only - Fedee! - 10.03.2010

Quote:
Originally Posted by Carlton
You're saying a example as if someone's computer is 20mb ram or something. It won't be that much, and if you read what he laser50 said, he said each vehicles has their own score needed to enter the vehicle.
My bad, I tought it was OnPlayerUpdate
Sorry,


Re: Cars enterable for certain Scores Only - Carlton - 10.03.2010

Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by Carlton
You're saying a example as if someone's computer is 20mb ram or something. It won't be that much, and if you read what he laser50 said, he said each vehicles has their own score needed to enter the vehicle.
My bad, I tought it was OnPlayerUpdate
Sorry,
It's ok, everyone makes mistakes :P


Re: Cars enterable for certain Scores Only - laser50 - 10.03.2010

Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by laser50
2. I got like 15 vehicles witch are all enterable for different Scores, do i have to do New, New, New, New for all the 15 vehicles or is their a more simple thing to use?
pawn Код:
new Vehicles[15];

Vehicles[1] = Vehicle..
Vehicles[2] = Vehicle..
Vehicles[3] = Vehicle..
Vehicles[4] = Vehicle..
Vehicles[5] = Vehicle..
And so on..
\

that Vehicle.. means, the CreateVehicle??