Need Help with car spawner.
#2

You are assigning mycar to playerid and limiting him to spawn only 1 vehicle, aka you are storing same vehicle into same variable. Since you are making player be able to spawn multiple vehicles, you can do something like this
pawn Код:
SpawnVipVehicle(playerid,level,vehicleid )
{
            if(pInfo[playerid][Donator] < level )return SCM(playerid,COLOR_AQUA, "You are not authorized to use this command.");
            if(SpawnedVIP[playerid] == 1 && myCar[playerid] == VipVeh[playerid]) DestroyVehicle(myCar[playerid]) ,SpawnedVIP[playerid]=0;
            if(IsPlayerInAnyVehicle(playerid))return SCM(playerid,0x00FF00AA,NOT_INVEH_MSG);
            if(SpawnedCars[playerid] >= 11) return SCM(playerid,COLOR_RED,"You have spawned 10 vehicles already");
            new Float:pX,Float:pY,Float:pZ,Float:pw;
            SpawnedCars[playerid] += 1; //we are adding up on how many cars he spawned.
            GetPlayerPos(playerid, pX,pY,pZ);
            GetPlayerFacingAngle(playerid, pw);
            VipVeh[playerid] = GetPlayerVehicleID(playerid);
            SpawnedVIP[playerid]=1;
           
            if(SpawnedCars[playerid] == 1) { CarID[playerid][0] = CreateVehicle(vehicleid, pX, pY, pZ, pw, 0, 0, 0); }
            else if(SpawnedCars[playerid] == 2) { CarID[playerid][1] = CreateVehicle(vehicleid, pX, pY, pZ, pw, 0, 0, 0); }
            //etc etc etc
           
            return 1;
}


new
    SpawnedCars[MAX_PLAYERS], //save how many cars he spawned
    CarID[MAX_PLAYERS][10]; // its where we are going to store our vehicles. This way max 10 vehicles

This isnt really efficiant but it does the work
Reply


Messages In This Thread
Need Help with car spawner. - by MBilal - 27.11.2015, 23:51
Re: Need Help with car spawner. - by TwinkiDaBoss - 28.11.2015, 01:13
Re: Need Help with car spawner. - by MBilal - 28.11.2015, 01:18
Re: Need Help with car spawner. - by jlalt - 28.11.2015, 04:30

Forum Jump:


Users browsing this thread: 1 Guest(s)