SA-MP Forums Archive
Problem with Max_VEHICLES - 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)
+--- Thread: Problem with Max_VEHICLES (/showthread.php?tid=359011)



Problem with Max_VEHICLES - lewismichaelbbc - 12.07.2012

Код:
new car[MAX_VEHICLES];

if(strcmp(cmd, "/ic", true) == 0)
{
    for(new i=1; i < MAX_VEHICLES; i++)
    {  
        if(car[i] != 1)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "This car slot is free (1)");
            car[vehicleid] = 1;
            return 1;
        }
        if(car[i] != 2)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "This car slot is free (2)");
            car[vehicleid] = 2;
            return 1;
        }
     }
}
That is a bit of the code that i have created.

I am typing a cmd /ic which gives the car a value. If the car slot is free, I want the server to sendclientmessage saying that it is free. BUT, the problem is, is that everytime i type /ic on a car, it says this slot is free (1) every single time... and I only want 1 car in each car slot... so how can i fix this?

Thanks


Re: Problem with Max_VEHICLES - clarencecuzz - 12.07.2012

Change car[vehicleid] to car[i]

Example:
pawn Код:
car[i] = 2;