Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Recommended Posts

Posted

Salut, va rog ajutațima cu comanda Spawncar! Am tot căutat tutoriale sa creez comanda dar nu găsesc. As fi foarte recunoscător dacă m-ați ajuta !

  • 2 years later...
Posted

Fara admin:

CMD:spawncar(playerid, params[])

{

    new carid;

 

    if (sscanf(params, "i", carid))

    {

        if (IsPlayerInRangeOfPoint(playerid, 5.0, spawnX, spawnY, spawnZ))

        {

            if (GetPlayerMoney(playerid) >= carSpawnCost[carid] || PlayerInfo[playerid][pAdmin] >= 1)

            {

                if (IsValidCarID(carid))

                {

                    new Float:x, Float:y, Float:z;

 

                    GetPlayerPos(playerid, x, y, z);

                    CreateVehicle(carid, x, y, z, 0.0, -1, -1, 100);

                    

                                       if (PlayerInfo[playerid][pAdmin] < 1)

                    {

                        GivePlayerMoney(playerid, -carSpawnCost[carid]);

                        SendClientMessage(playerid, COLOR_GREEN, "You have spawned the car.");

                    }

                    else

                    {

                        SendClientMessage(playerid, COLOR_GREEN, "You have spawned the car as an admin.");

                    }

                }

                else

                {

                    SendClientMessage(playerid, COLOR_RED, "Invalid car ID. Use /carlist to see available cars.");

                }

            }

            else

            {

                SendClientMessage(playerid, COLOR_RED, "You don't have enough money or permission to spawn this car.");

            }

        }

        else

        {

            SendClientMessage(playerid, COLOR_RED, "You are not near the spawn point.");

        }

    }

    else

    {

        SendClientMessage(playerid, COLOR_GREY, "Usage: /spawncar [carid]");

    }

 

    return 1;

}

Cu admin:

CMD:spawncar(playerid, params[])

{

    new carid;

 

    if (PlayerInfo[playerid][pAdmin] >= 1) // poti modifica suma de admin

    {

        if (IsPlayerInRangeOfPoint(playerid, 5.0, spawnX, spawnY, spawnZ))

        {

            carid = GetRandomCarID();

 

            if (IsValidCarID(carid))

            {

                new Float:x, Float:y, Float:z;

 

                GetPlayerPos(playerid, x, y, z);

                CreateVehicle(carid, x, y, z, 0.0, -1, -1, 100);

 

                SendClientMessage(playerid, COLOR_GREEN, "You have spawned a car.");

            }

            else

            {

                SendClientMessage(playerid, COLOR_RED, "Failed to spawn a car. Please contact an admin.");

            }

        }

        else

        {

            SendClientMessage(playerid, COLOR_RED, "You are not near the spawn point.");

        }

    }

    else

    {

        SendClientMessage(playerid, COLOR_RED, "You don't have permission to use this command.");

    }

 

    return 1;

}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.