SA-MP Forums Archive
/Destroycars - 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: /Destroycars (/showthread.php?tid=98997)



/Destroycars - Lia - 25.09.2009

im using West Coast Roleplay script.. and i /destroycars... MOST Of the cars in server dissappear? and only a few left.. and i seen something in the gamemode called.. : new CreatedCars[100]; and the /destroycars is this:

Quote:

if(strcmp(cmd, "/destroycars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
return 1;
}
for(new i = 0; i < sizeof(CreatedCars); i++)
{
if(i != 0)
{
DestroyVehicle(i);
}
}
SendClientMessage(playerid, COLOR_GREY, " Created Vehicles destroyed !");
}
return 1;
}

And rthis : for(new i = 0; i < sizeof(CreatedCars); i++) delete the 100 created cars? or? if so? change 100 to 0? or what?

Please Help,


Re: /Destroycars - Toribio - 25.09.2009

pawn Код:
if(strcmp(cmd, "/destroycars", true) == 0)
{
    if(IsPlayerConnected(playerid)) //it's lol, but, it's you code, so...
    {
        if(PlayerInfo[playerid][pAdmin] < 4)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
            return 1;
        }
        for(new i = 0; i < sizeof(CreatedCars); i++)
        {
            if(CreatedCars[i] != 0) //if vehicleid is valid, unnecessary... if 0, DestroyVehicle will fail
            {
                DestroyVehicle(CreatedCars[i]); //it's the vehicleid stored in CreatedCars, not "i".
                CreatedCars[i] = 0; //no more vehicleid stored
            }
        }
        SendClientMessage(playerid, COLOR_GREY, "  Created Vehicles destroyed !");
    }
    return 1;
}