Array Problem
#6

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


Messages In This Thread
Array Problem - by NoteND - 02.03.2019, 19:26
Re: Array Problem - by TheToretto - 02.03.2019, 19:46
Re: Array Problem - by NoteND - 02.03.2019, 19:55
Re: Array Problem - by TheToretto - 02.03.2019, 20:03
Re: Array Problem - by Private200 - 02.03.2019, 21:14
Re: Array Problem - by TheToretto - 02.03.2019, 21:38
Re: Array Problem - by Private200 - 02.03.2019, 21:44
Re: Array Problem - by TheToretto - 02.03.2019, 22:20
Re: Array Problem - by Private200 - 03.03.2019, 11:59
Re: Array Problem - by TheToretto - 03.03.2019, 12:04

Forum Jump:


Users browsing this thread: 2 Guest(s)