new rentcar[20];
new newcar;
new rentkey[MAX_PLAYERS];
rentcar[0] = AddStaticVehicleEx(510,1560.93286133,-2309.08129883,13.24319458,91.99993896,-1,-1,5); //Mountain Bike
rentcar[1] = AddStaticVehicleEx(510,1560.88171387,-2311.87597656,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[2] = AddStaticVehicleEx(510,1561.00732422,-2315.56152344,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[3] = AddStaticVehicleEx(510,1561.11535645,-2318.67944336,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[4] = AddStaticVehicleEx(510,1561.23120117,-2321.97534180,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[5] = AddStaticVehicleEx(510,1561.34765625,-2325.31958008,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[6] = AddStaticVehicleEx(510,1561.46789551,-2328.74047852,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[7] = AddStaticVehicleEx(510,1561.57324219,-2331.73730469,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[8] = AddStaticVehicleEx(510,1561.69628906,-2335.23388672,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
rentcar[9] = AddStaticVehicleEx(468,-1330.38940430,-284.64837646,13.90843773,0.00000000,-1,-1,15); //Sanchez
rentcar[10] = AddStaticVehicleEx(468,-1331.91455078,-285.06213379,13.90843773,0.00000000,-1,-1,5); //Sanchez
rentcar[11] = AddStaticVehicleEx(462,1305.86437988,1278.80163574,10.49053192,0.00000000,-1,-1,5); //Faggio
rentcar[12] = AddStaticVehicleEx(462,1308.87707520,1278.86083984,10.49053192,0.00000000,-1,-1,5); //Faggio
rentcar[13] = AddStaticVehicleEx(462,1311.88745117,1278.89587402,10.49053192,0.00000000,-1,-1,5); //Faggio
rentcar[14] = AddStaticVehicleEx(462,1314.59558105,1278.92578125,10.49053192,0.00000000,-1,-1,5); //Faggio
rentcar[15] = AddStaticVehicleEx(462,1317.93640137,1278.68676758,10.49053192,0.00000000,-1,-1,5); //Faggio
rentcar[16] = AddStaticVehicleEx(481,1282.74865723,1290.92309570,10.42908859,272.00000000,-1,-1,5); //BMX
rentcar[17] = AddStaticVehicleEx(481,1282.62097168,1293.31713867,10.42908859,271.99951172,-1,-1,5); //BMX
rentcar[18] = AddStaticVehicleEx(481,1282.70117188,1296.41113281,10.42908859,271.99951172,-1,-1,5); //BMX
rentcar[19] = AddStaticVehicleEx(481,1282.96948242,1299.54357910,10.42908859,271.99951172,-1,-1,5); //BMX
public IsARentableCar(carid)
{
for(new i = 0; i < sizeof(rentcar); i++)
{
if(carid == rentcar[i]) return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsARentableCar(newcar))
{
if(GetPlayerVehicleSeat(playerid) == 1)
{
if(rentkey[playerid] == 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"You do not have a rent card.Go buy one.");
}
if(rentkey[playerid] == 1)
{
SendClientMessage(playerid,COLOR_RED,"Watch out,When you exit the vehicle you wont be able to ride it again.");
}
}
}
return 1;
}
Now when I get into any vehicle
it doesnt says/does anything.
I can ride the vehicle free.
What can I do about it ?
Thanks alot.
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if( newstate == PLAYER_STATE_DRIVER )
{
if(IsARentableCar(newcar))
{
if(GetPlayerVehicleSeat(playerid) == 1)
{
if(rentkey[playerid] == 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"You do not have a rent card.Go buy one.");
}
if(rentkey[playerid] == 1)
{
SendClientMessage(playerid,COLOR_RED,"Watch out,When you exit the vehicle you wont be able to ride it again.");
}
}
}
}
return 1;
}
pawn Code:
|
if( newstate == PLAYER_STATE_DRIVER )
GetPlayerVehicleSeat(playerid) == 1)
new
rentcar_Last,
rentcar_First,
bool: rentkey[MAX_PLAYERS];
//OnGameModeInit
rentcar_First = AddStaticVehicleEx(510,1560.93286133,-2309.08129883,13.24319458,91.99993896,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1560.88171387,-2311.87597656,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1561.00732422,-2315.56152344,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1561.11535645,-2318.67944336,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1561.23120117,-2321.97534180,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1561.34765625,-2325.31958008,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1561.46789551,-2328.74047852,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1561.57324219,-2331.73730469,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(510,1561.69628906,-2335.23388672,13.24319458,91.99951172,-1,-1,5); //Mountain Bike
AddStaticVehicleEx(468,-1330.38940430,-284.64837646,13.90843773,0.00000000,-1,-1,15); //Sanchez
AddStaticVehicleEx(468,-1331.91455078,-285.06213379,13.90843773,0.00000000,-1,-1,5); //Sanchez
AddStaticVehicleEx(462,1305.86437988,1278.80163574,10.49053192,0.00000000,-1,-1,5); //Faggio
AddStaticVehicleEx(462,1308.87707520,1278.86083984,10.49053192,0.00000000,-1,-1,5); //Faggio
AddStaticVehicleEx(462,1311.88745117,1278.89587402,10.49053192,0.00000000,-1,-1,5); //Faggio
AddStaticVehicleEx(462,1314.59558105,1278.92578125,10.49053192,0.00000000,-1,-1,5); //Faggio
AddStaticVehicleEx(462,1317.93640137,1278.68676758,10.49053192,0.00000000,-1,-1,5); //Faggio
AddStaticVehicleEx(481,1282.74865723,1290.92309570,10.42908859,272.00000000,-1,-1,5); //BMX
AddStaticVehicleEx(481,1282.62097168,1293.31713867,10.42908859,271.99951172,-1,-1,5); //BMX
AddStaticVehicleEx(481,1282.70117188,1296.41113281,10.42908859,271.99951172,-1,-1,5); //BMX
rentcar_Last = AddStaticVehicleEx(481,1282.96948242,1299.54357910,10.42908859,271.99951172,-1,-1,5); //BMX
//IsARentableCar(vehicleid) - Should be somewhere above
#define IsARentableCar(%0) (rentcar_First <= (%0) <= rentcar_Last)
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if( newstate == PLAYER_STATE_DRIVER )
{
newstate = GetPlayerVehicleID(playerid);
if(IsARentableCar(newstate))
{
if(rentkey[playerid] == false)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"You do not have a rent card.Go buy one.");
} else {
SendClientMessage(playerid,COLOR_RED,"Watch out,When you exit the vehicle you wont be able to ride it again.");
}
}
}
return true;
}
because of
pawn Code:
pawn Code:
So, I rly hate it if guys use array for something like that pawn Code:
pawn Code:
pawn Code:
pawn Code:
|
new rentcar_Last,rentcar_First,bool: rentkey[MAX_PLAYERS];
#define IsARentableCar(%0) (rentcar_Last <= (%0) <= rentcar_First)
rentcar_First = AddStaticVehicleEx(510,1560.93286133,-2309.08129883,13.24319458,91.99993896,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1560.88171387,-2311.87597656,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1561.00732422,-2315.56152344,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1561.11535645,-2318.67944336,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1561.23120117,-2321.97534180,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1561.34765625,-2325.31958008,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1561.46789551,-2328.74047852,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1561.57324219,-2331.73730469,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(510,1561.69628906,-2335.23388672,13.24319458,91.99951172,-1,-1,5); //Mountain Bike AddStaticVehicleEx(468,-1330.38940430,-284.64837646,13.90843773,0.00000000,-1,-1,15); //Sanchez AddStaticVehicleEx(468,-1331.91455078,-285.06213379,13.90843773,0.00000000,-1,-1,5); //Sanchez AddStaticVehicleEx(462,1305.86437988,1278.80163574,10.49053192,0.00000000,-1,-1,5); //Faggio AddStaticVehicleEx(462,1308.87707520,1278.86083984,10.49053192,0.00000000,-1,-1,5); //Faggio AddStaticVehicleEx(462,1311.88745117,1278.89587402,10.49053192,0.00000000,-1,-1,5); //Faggio AddStaticVehicleEx(462,1314.59558105,1278.92578125,10.49053192,0.00000000,-1,-1,5); //Faggio AddStaticVehicleEx(462,1317.93640137,1278.68676758,10.49053192,0.00000000,-1,-1,5); //Faggio AddStaticVehicleEx(481,1282.74865723,1290.92309570,10.42908859,272.00000000,-1,-1,5); //BMX AddStaticVehicleEx(481,1282.62097168,1293.31713867,10.42908859,271.99951172,-1,-1,5); //BMX AddStaticVehicleEx(481,1282.70117188,1296.41113281,10.42908859,271.99951172,-1,-1,5); //BMX rentcar_Last = AddStaticVehicleEx(481,1282.96948242,1299.54357910,10.42908859,271.99951172,-1,-1,5); //BMX
public OnPlayerStateChange( playerid, newstate, oldstate ) { if( newstate == PLAYER_STATE_DRIVER ) { newstate = GetPlayerVehicleID(playerid); if(IsARentableCar(newstate)) { if(rentkey[playerid] == false) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,COLOR_RED,"You do not have a rent card.Go buy one."); } else { SendClientMessage(playerid,COLOR_RED,"Watch out,When you exit the vehicle you wont be able to ride it again."); } } } return true; }