/Joinrace loop command [HELP] PLEAZZ!
#1

Heu Guys im trying to make a /joinrace command that when a player types the command it sends him to the race park in a car but i want to make a loop that if someone is already in one of the race cars it sends him to another one and if all 6 of them are taken by players it tells the player that the race is already full. I hope you understand me, and guys any help please would be Indorsed THANX !!!
Reply
#2

I'm gonna give it a shot, 1 sec

EDIT: It's not a loop, but it will get the job done.

pawn Код:
#include <a_samp>
//Start under ^^
new Rcar;
new Rcar2;
new Rcar3;
//Need to define the cars, so we can check to see if someone is in them
public OnGameModeInit()
{
    Rcar=AddStaticVehicle(560,2485.6999500,-1667.9000200,13.1000000,0.0000000,32,79); //Sultan
    Rcar2=AddStaticVehicle(560,2490.6999500,-1667.9000200,13.1000000,0.0000000,32,79); //Sultan
    Rcar3=AddStaticVehicle(560,2495.6999500,-1667.9000200,13.1000000,0.0000000,32,79); //Sultan
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/joinrace", cmdtext, true, 10) == 0)
    {
        if (IsPlayerInVehicle(playerid, Rcar))
        {
            if (IsPlayerInVehicle(playerid, Rcar2))
            {
                if (IsPlayerInVehicle(playerid, Rcar3))
                {
                    SendClientMessage(playerid, 0xFFFF00FF , "The Race is FULL.");
                    return 1;
                }
                else
                {
                    PutPlayerInVehicle(playerid, Rcar3, 0);
                    return 1;
                }
            }
            else
            {
                PutPlayerInVehicle(playerid, Rcar2, 0);
                return 1;
            }
        }
        else
        {
            PutPlayerInVehicle(playerid, Rcar, 0);
            return 1;
        }
    }
    return 0;
}
Reply
#3

There^^ Sorry
Reply
#4

Thanx Bro ill Give it a Try!!
Reply
#5

Quote:
Originally Posted by chubz
Посмотреть сообщение
Thanx Bro ill Give it a Try!!
Tell me how it went. Is that what you were looking for? I know it's only 3 cars there, so I could add on 3 more cars to it.
Reply
#6

Yh it didnt end up working every time someone typed in the command it would spawn three more cars on top of the others already there. Ill keep trying see what i can do.
Reply
#7

Quote:
Originally Posted by chubz
Посмотреть сообщение
Yh it didnt end up working every time someone typed in the command it would spawn three more cars on top of the others already there. Ill keep trying see what i can do.
That's probably because you put the car spawns inside the command itself. Put the car spawns under OnGameModeInIt and the command where the commands go lol
Reply
#8

Nah Thats not it i have the cars under gamemode not in the actual command!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)