Cars enterable for certain Scores Only
#1

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?
Reply
#2

Код:
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;
}
Reply
#3

Код:
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!");
				 	}
				}
Reply
#4

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.
Reply
#5

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..
Reply
#6

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

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.
Reply
#8

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,
Reply
#9

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
Reply
#10

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??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)