SA-MP Forums Archive
Weapon and Passenger bug fix help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Weapon and Passenger bug fix help (/showthread.php?tid=467083)



Weapon and Passenger bug fix help - Sliceofdeath - 01.10.2013

I want to make heavy weapons only for admins , How to do ?

pawn Код:
#include <a_samp>

#define DIALOGID 1337


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/w", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Lists", "Melee\nPistols\nSub-Machine Guns\nRifle's\nAssault\nShotgun's\nHeavy Weapons\nThrown\nMisc", "Select", "Cancel");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOGID)
    {
        if(response)
        {
            if(listitem == 0) // Meele
            {
                ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Select a Weapon", "Knuckle Dusters\nGolf Club\nNite Stick\nKnife\nBat\nShovel\nPool Cue\nKatana\nDildo\nSpray Can\nCane", "Select", "Cancel");
            }
            if(listitem == 1) // Pistols
            {
                ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Select a Weapon", "9mm\nSilenced 9mm\nDesert Eagle", "Select", "Cancel");
            }
            if(listitem == 2) // Sub-Machine Guns
            {
                ShowPlayerDialog(playerid, DIALOGID+3, DIALOG_STYLE_LIST, "Select a Weapon", "Uzi\nSMG\nTec9", "Select", "Cancel");
            }
            if(listitem == 3) // Rifles
            {
                ShowPlayerDialog(playerid, DIALOGID+4, DIALOG_STYLE_LIST, "Select a Weapon", "Country Rifle\nSniper Rifle", "Select", "Cancel");
            }
            if(listitem == 4) // Assault
            {
                ShowPlayerDialog(playerid, DIALOGID+5, DIALOG_STYLE_LIST, "Select a Weapon", "AK-47\nM4", "Select", "Cancel");
            }
            if(listitem == 5) // Shotguns
            {
                ShowPlayerDialog(playerid, DIALOGID+6, DIALOG_STYLE_LIST, "Select a Weapon", "Standard Shotgun\nSawnoff Shotgun\nCombat Shotgun", "Select", "Cancel");
            }
            if(listitem == 6) // Heavy Weaponry
            {
                ShowPlayerDialog(playerid, DIALOGID+7, DIALOG_STYLE_LIST, "Select a Weapon", "Rocket Laucher\nHeat Seaker\nMinigun\nChain Saw", "Select", "Cancel");
            }
            if(listitem == 7) // Thrown
            {
                ShowPlayerDialog(playerid, DIALOGID+8, DIALOG_STYLE_LIST, "Select a Weapon", "Granade\nTear Gas", "Select", "Cancel");
            }
            if(listitem == 8) // Misc
            {
                ShowPlayerDialog(playerid, DIALOGID+9, DIALOG_STYLE_LIST, "Select a Weapon", "Fire Extinguisher\nSatchel Charge\nParachute\nNightvision Goggles\nFlowers\nCamera", "Select", "Cancel");
            }
        }
        return 1;
    }

    if(dialogid == DIALOGID+1) // Meele
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 1, 1);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 2, 1);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 3, 1);
            }
            if(listitem == 3)
            {
                GivePlayerWeapon(playerid, 4, 1);
            }
            if(listitem == 4)
            {
                GivePlayerWeapon(playerid, 5, 1);
            }
            if(listitem == 5)
            {
                GivePlayerWeapon(playerid, 6, 1);
            }
            if(listitem == 6)
            {
                GivePlayerWeapon(playerid, 7, 1);
            }
            if(listitem == 7)
            {
                GivePlayerWeapon(playerid, 8, 1);
            }
            if(listitem == 8)
            {
                GivePlayerWeapon(playerid, 10, 1);
            }
            if(listitem == 9)
            {
                GivePlayerWeapon(playerid, 41, 500);
            }
            if(listitem == 10)
            {
                GivePlayerWeapon(playerid, 15, 1);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+2) // Pistols
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 22, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 23, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 24, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+3) // Sub's
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 28, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 29, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 32, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+4) // Rifle's
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 33, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 34, 500);
            }
        }
        return 1;
    }

    if(dialogid == DIALOGID+5) // Assault
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 30, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 31, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+6) // Shotguns
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 25, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 26, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 27, 500);
            }
        }
        return 1;
    }

    if(dialogid == DIALOGID+7) // Heavy Weapons
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 35, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 36, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 38, 500);
            }
            if(listitem == 3)
            {
                GivePlayerWeapon(playerid, 9, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+8) // Thrown
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 16, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 17, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+9) // Misc Fire Extinguisher\nSatchel Charge\nParachute\nNightvision Goggles\nFlowers
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 42, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 39, 500);
                GivePlayerWeapon(playerid, 40, 1);
   }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 46, 1);
            }
            if(listitem == 3)
            {
                GivePlayerWeapon(playerid, 44, 1);
            }
            if(listitem == 4)
            {
                GivePlayerWeapon(playerid, 14, 1);
            }
            if(listitem == 5)
            {
                GivePlayerWeapon(playerid, 43, 1);
            }
        }
        return 1;
    }
   
    return 0;
 }
2nd..

I have just updated my teleports and got a bug

Like i am driving a car and player type'd any command like /lsa..then my car and I go to that teleport how to fix ?

I am using teleport coding in this style

pawn Код:
CMD:pier(playerid, params[])
{
       SetPlayerPos(playerid, -1703.6888,1340.2097,7.1823);
       TogglePlayerControllable(playerid, 0);
       SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
       GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
       SetPlayerFacingAngle(playerid, 150.0);
       new string[128], pName[MAX_PLAYER_NAME];
       GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
       format(string, sizeof(string), "{FF0000}(/pier) {FFFF00}Player {FF0000}%s {FFFF00}has Teleported to {FF0000}Pier 69",pName);
       SendClientMessageToAll(playerid, string);
       SetPlayerInterior(playerid, 0);
       SetPlayerVirtualWorld(playerid, 0);
       new veh = GetPlayerVehicleID(playerid);
       SetVehiclePos(veh, -1703.6888,1340.2097,7.1823);
       SetVehicleZAngle(veh, 0.0);
       LinkVehicleToInterior(veh, 0);
       SetVehicleVirtualWorld(veh, 0);
       PutPlayerInVehicle(playerid, veh, 0);
       
   return SendClientMessage(playerid, 0xFF0000FF, "you have gone to Pier 69!");
}
Thanks in advance.


Re: Weapon and Passenger bug fix help - CesarLT - 01.10.2013

For the first, use that.

And for the second question, I didn't really understand what you want.


Re: Weapon and Passenger bug fix help - Sliceofdeath - 01.10.2013

Second -

Example - I am driving infernus with my friend = 2 players in car

I am still driving , and suddenly the 2nd player [Passenger] teleport to somewhere while sitting in car [like /sf /lv /lva etc]

Then with him/her i also getting teleported to the place he teleport..

I want something like - he only teleport to the place..not me. [Driver]


Re: Weapon and Passenger bug fix help - CesarLT - 01.10.2013

Oh, you can use that.

Once your TP cmd is called, check if the playing is in the vehicle, and if so return sendclientmessage "you're driving", and if not continue to the teleport.

Hope you'll figure that out. Good luck.


Re: Weapon and Passenger bug fix help - Sliceofdeath - 01.10.2013

And abit few more help I need can u ?

Whenever any player spawn he have only Deagle .. How to add more weapons on spawn ?


Re: Weapon and Passenger bug fix help - Konstantinos - 01.10.2013

In OnPlayerSpawn use GivePlayerWeapon or add weapons by AddPlayerClass.


Re: Weapon and Passenger bug fix help - CesarLT - 01.10.2013

OnPlayerSpawn, add those lines.

GivePlayerWeapon(playerid, weaponid, ammo);

Good luck.


Re: Weapon and Passenger bug fix help - Sliceofdeath - 01.10.2013

Is there any way to make unlimited slots ?


Re: Weapon and Passenger bug fix help - Konstantinos - 01.10.2013

I didn't understand. You want to make unlimited slots for what?


Re: Weapon and Passenger bug fix help - Sliceofdeath - 01.10.2013

Weapon slot - I mean ammo