Car spawn help
#1

Hi all. Trying to create command, that spawns cars. And now I have a question. How to do, that one player can spawn a lot of cars? Now if i spawn first car ant type /scar second time, first car disappears. I want to spawn a lot of cars. Also I need that, if I have spawned 3 cars for example and first car destroys, other 2 stays.

Код:
new sCar[MAX_PLAYERS];
Код:
if(!strcmp(cmdtext, "/scar", false, 5))
{
    if(!strlen(cmdtext[5]) return SendClientMessage(playerid, red, "Usage: /scar [Model ID]");
    new veh = strval(cmdtext[5]);
    if(veh < 400 || veh > 611) return SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a);
    sCar[playerid] = CreateVehicle(veh, x,y,z, a, -1, -1, -1);
    return 1;
}
Код:
public OnVehicleDeath(vehicleid)
{
    for(new x; x<MAX_PLAYERS; x++)
    {
        if(sCar[x] != 0) continue;
        if(sCar[x] == vehicleid) 
        {
            DestroyVehicle(vehicleid);
            break;
        }
    }
    return 1;
}
Reply


Messages In This Thread
Car spawn help - by ,TomY' - 14.01.2018, 15:31
Re: Car spawn help - by ,TomY' - 14.01.2018, 17:09
Re: Car spawn help - by KayJ - 15.01.2018, 12:33
Re: Car spawn help - by andrejc999 - 15.01.2018, 12:43

Forum Jump:


Users browsing this thread: 1 Guest(s)