SA-MP Forums Archive
Gun pickup - 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: Gun pickup (/showthread.php?tid=493208)



Gun pickup - iBots - 07.02.2014

I have made a /dropgun but,when i pick it,it gives me the gun,but if i have another weapons,i cant change weapons,i mean i will only can change to fist and the gun i picked up,if i changed into the next gun,it sets the gun that i am holding to the picked gun,any idea why?


Re: Gun pickup - amirab - 07.02.2014

what's in /dropgun?!


Re: Gun pickup - iBots - 07.02.2014

pawn Код:
if(strcmp(cmd, "/dropgun", true) == 0)
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
        new GunID = GetPlayerWeapon(playerid);
        new GunAmmo = GetPlayerAmmo(playerid);
        if(GunID > 0 && GunAmmo != 0)
        {
            new f = MAX_OBJ+1;
            for(new a = 0; a < MAX_OBJ; a++)
            {
                if(dGunData[a][ObjPos][0] == 0.0)
                {
                    f = a;
                    break;
                }
            }
            if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "You can not throw weapons at the moment, try back later!");
            RemovePlayerWeapon(playerid, GunID);
            dGunData[f][ObjData][0] = GunID;
            dGunData[f][ObjData][1] = GunAmmo;
            GetPlayerPos(playerid, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]);
            dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, 120.0);
            new buffer[50];
            format(buffer, sizeof(buffer), "You threw %s", GunNames[dGunData[f][ObjData][0]]);
            SendClientMessage(playerid, 0x33AA3300, buffer);
        }
        return 1;
    }



Re: Gun pickup - iBots - 08.02.2014

anyone?