SA-MP Forums Archive
Respawn all cars - 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: Respawn all cars (/showthread.php?tid=412976)



Respawn all cars - DerickClark - 03.02.2013

hi.it's not respawning cars.
Код:
CMD:respawnallcars(playerid, params[])
{
    #pragma unused params
    if(APlayerData[playerid][PlayerLevel] < 3)
    {
    SendClientMessage(playerid, 0xFF0000FF, "ERROR:You can't use this command!");
    }
    else
    {
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s has respawned all unoccupied vehicles", str);
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
            SendClientMessage(i, 0xFFFF00FF, str);
        }
    }
    return 1;
}



Re: Respawn all cars - Danyal - 03.02.2013

pawn Код:
CMD:respawnallcars(playerid, params[])
{
    #pragma unused params
    if(APlayerData[playerid][PlayerLevel] < 3)
    {
        SendClientMessage(playerid, 0xFF0000FF, "ERROR:You can't use this command!");
    }
    else
    {
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s has respawned all unoccupied vehicles", str);
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            if(IsVehicleOccupied(i) == 0)
            {
                SetVehicleToRespawn(i);
                PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
                SendClientMessage(i, 0xFFFF00FF, str);
            }
        }
    }
    return 1;
}
try this hope it works


Re: Respawn all cars - DerickClark - 03.02.2013

its work,but if the player go in the car it don't respawn how to make that?


Re: Respawn all cars - T0pAz - 03.02.2013

If you want to respawn all vehicles, do this.

pawn Код:
CMD:respawnallcars(playerid, params[])
{
    #pragma unused params
    if(APlayerData[playerid][PlayerLevel] < 3)
    {
        SendClientMessage(playerid, 0xFF0000FF, "ERROR:You can't use this command!");
    }
    else
    {
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s has respawned all unoccupied vehicles", str);
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            SetVehicleToRespawn(i);
            PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
            SendClientMessage(i, 0xFFFF00FF, str);
        }
    }
    return 1;
}



Re: Respawn all cars - DerickClark - 03.02.2013

...


If a player go in a car the car respawn by the admin.if i in a car it respawn that car.


Re: Respawn all cars - Danyal - 03.02.2013

you dont want your car to be respawned??


Re: Respawn all cars - DerickClark - 03.02.2013

Yes i wanna my cars to respawn but if i in a car i do /respawnallcars it respawn the car who in it
if a player not in the car it get respawned how to make that?


Re: Respawn all cars - T0pAz - 03.02.2013

Edit: The code by Danyal should work.


Re: Respawn all cars - DerickClark - 03.02.2013

If the player not in the car it can be respawn


Re: Respawn all cars - DerickClark - 03.02.2013

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
If you want to respawn all vehicles, do this.

pawn Код:
CMD:respawnallcars(playerid, params[])
{
    #pragma unused params
    if(APlayerData[playerid][PlayerLevel] < 3)
    {
        SendClientMessage(playerid, 0xFF0000FF, "ERROR:You can't use this command!");
    }
    else
    {
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s has respawned all unoccupied vehicles", str);
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            SetVehicleToRespawn(i);
            PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
            SendClientMessage(i, 0xFFFF00FF, str);
        }
    }
    return 1;
}
that wat i wanana but it not showing the me SendClientMessage