SA-MP Forums Archive
What is wrong here? - 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: What is wrong here? (/showthread.php?tid=235911)



What is wrong here? - pantelimonfl - 06.03.2011

I have this codes, but they don't work.
I don't know what should i do to make them work. ?
pawn Код:
public IsARentBike(carid)
{
    /*for(new i = 1; i < sizeof(CarInfo); i++)
    {
        if(CarInfo[i][cFaction] == 20)  return 1;
    }*/

    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        new vehid = GetPlayerVehicleID(i);
        if(vehid = 327)
        {
            return 1;
        }
    }
    return 0;
}
pawn Код:
public IsARentBike(carid)
{
    for(new i = 1; i < sizeof(CarInfo); i++)
    {
        if(CarInfo[i][cFaction] == 20)  return 1;
    }
    return 0;
}



Re: What is wrong here? - iMonk3y - 06.03.2011

Maybe instead of public, they should be stock declarations.. do you need an example of how they work?


Re: What is wrong here? - pantelimonfl - 06.03.2011

The others functions like IsACopCar, IsAnOwnableCar etc. are working.


Re: What is wrong here? - Shadow™ - 06.03.2011

pawn Код:
stock IsARentBike(carid)
{
    for(new i = 1; i < sizeof(CarInfo); i++)
    {
        if(CarInfo[i][cFaction] == 20)
        {
                return 1;
        }
    }
    return 0;
}
What's wrong with that code?

*EDIT*


Re: What is wrong here? - iMonk3y - 06.03.2011

Ouh.. I just realized.. those codes are screwed up badly!

EDIT:
Diss me all you want, but I shrank your codes almost to total oblivion.. That code will work fine.
pawn Код:
stock IsARentBike(carid)
{
    if(carid = 327 || carid == 20 ) return 1;
    return 0;
}



Re: What is wrong here? - alpha500delta - 06.03.2011

Shouldn't
pawn Код:
IsARentBike(carid)
Be
pawn Код:
IsARentBike(vehicleid)
?


Re: What is wrong here? - pantelimonfl - 06.03.2011

I have isacopcar(carid), isataxi(carid) etc.. and they work.


Re: What is wrong here? - iMonk3y - 06.03.2011

@alpha500delta Nope, doesn't really matter in a stock declaration..

Mr pantelimonfl, look up my previous response


Re: What is wrong here? - Shadow™ - 06.03.2011

iMonkey, your code will only work if the rentcar is vehicleid 20 whereas the faction in the enum vFaction should be 20, I think at least.


Re: What is wrong here? - iMonk3y - 06.03.2011

Shouldn't it work as follows:
pawn Код:
if(IsARentBike(CarInfo[i][cFaction]))