Jump to content

Comanda Spawncar


IosifR

Recommended Posts

  • 2 years later...

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;

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.