Respawn all cars
#1

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;
}
Reply
#2

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
Reply
#3

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

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;
}
Reply
#5

...


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

you dont want your car to be respawned??
Reply
#7

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?
Reply
#8

Edit: The code by Danyal should work.
Reply
#9

If the player not in the car it can be respawn
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)