[HELP] put player in a random car
#1

Hello, I created 10 vehicles and have defined a variable with 10 cells:

PHP код:
    InfernusKillers[0] = AddStaticVehicle(425,-1300.9480,-290.2778,26.3185,292.4985,66,96); // hunter1
    
InfernusKillers[1] = AddStaticVehicle(425,-1287.3361,-323.9620,25.9810,288.4971,58,2); // hunter2
    
InfernusKillers[2] = AddStaticVehicle(425,-1409.2015,-265.1139,25.9793,319.5887,117,57); // hunter3
    
InfernusKillers[3] = AddStaticVehicle(425,-1382.6840,-292.6427,26.0340,303.7419,55,131); // hunter4
    
InfernusKillers[4] = AddStaticVehicle(425,-1405.6042,-186.3337,25.9784,341.1442,195,92); // hunter5
    
InfernusKillers[5] = AddStaticVehicle(425,-1437.6874,-167.3884,25.9794,336.5688,155,28); // hunter6
    
InfernusKillers[6] = AddStaticVehicle(520,-1220.2308,-70.8612,28.0706,131.7645,117,1); // hydra1
    
InfernusKillers[7] = AddStaticVehicle(520,-1179.5278,-115.4606,28.3935,143.3406,1,177); // hydra2
    
InfernusKillers[8] = AddStaticVehicle(520,-1221.7657,-12.6096,14.8726,45.9330,145,7); // hydra3
    
InfernusKillers[9] = AddStaticVehicle(520,-1185.9022,26.0009,14.8722,47.5623,165,70); // hydra4 
Now I want to do that every time a player will do the command / teleport is a random car will be launched from these ensembles I created, but I also want that if a player has a certain car, the player teleported Istgr not ride where there has been an actor. If all vehicles have players, is not Istgr nowhere and sent him a message he can not teleport that cars Available.

this what i made:
PHP код:
    for(new oMAX_PLAYERSo++)
{
    if(
IsPlayerConnected(o))
    {
        for(new 
isizeof(InfernusKillers); i++)
        {
            if(!
IsPlayerInVehicle(o,InfernusKillers[i]))
            {
                
PutPlayerInVehicle(playerid,InfernusKillers[i],0);
                if(
IsPlayerInVehicle(playerid,InfernusKillers[i])) continue;
            }
        }
    }

but it doesn't work good

Thanks for helpers
Sorry for bad english i used ****** translate
Reply
#2

pawn Код:
new slot = 0;
for(new o; o < MAX_PLAYERS; o++)
{
    if(!IsPlayerConnected(o) || IsPlayerInAnyVehicle(o)) continue;
    if(slot != 9)
    {
        PutPlayerInVehicle(playerid,InfernusKillers[slot],0);
        slot++;
    }
    else
    {
        SendClientMessage(o, 0xFFFFFF, "All vehicles are taken!");
    }
}
Something like that?
Reply
#3

but two player won't be in the same car?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)