Quote:
Originally Posted by Private200
pawn Код:
public isBike(int vehicleModel) { for (int i = 0; i < sizeof(Bikes); i++) { if (Bikes[i] == vehicleModel) { return true; } } return false; }
Or simply use this function. Implement it to your code:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) { if(isBike(GetVehicleModel(pVeh[playerid]))) { PutPlayerInVehicle(playerid, pVeh[playerid], 0); } } return 1; }
This way you can also use it on different occasions.
|
Код:
public isBike(int vehicleModel)
What is that? Just use a plain function... Plus it's pawn, not C++ or any other programming language, you don't need to add the "int". And why using braces for just a "return true" :c ?