Detect the model of pickup, or?
#1

How could i detect the MODEL of Pickup like 977 or 888, cause i want to detect which weapon pickup he picks up and set a Pvar.
Reply
#2

You can't really detect the model without saving it as a variable of course. But here's a little code that could work out. I haven't really tested this, so i'm not sure if it'll work.

pawn Код:
new weapons[] =
{
        -1, // no fists
        331, // - Brass Knuckles
        333, // Golf Club
        334, // Night Stick
        335, // Knife
        336, // baseball bat
        337, // shovel
        338, // pool cue
        339, // katama
        341, // chainsaw
        321, // regular dildo
        322, // white dildo
        323, // Medium, white vibrator
        324, // smaill, silver vibrator
        325, // flowers
        326, // cane
        342, // grendade
        343, // tear gas
        344, // molotov
        -1, // RPG rocket - we can't pick up those, do we oO
        -1, // Heat-Seeking Rocket
        -1, // Hydra rocket
        346, // colt 45
        347, // colt 45 + silencer
        348, // deagle
        349, // shotgun
        350, // sawn-off
        351, // spaz
        352, // micro-uzi
        353, // mp5
        355, // ak47
        356, // m4
        372, // tec9
        357, // country rifle
        358, // sniper rifle
        359, // rocket launcher
        360, // heat-seeking rocket launcher
        361, // flamethrower
        362, // minigun
        363, // sachtel charges
        -1, // detonator
        365, // spray can
        366, // fire extinguisher
        367, // camera
        -1, // night-vision goggles
        -1, // heat-vision goggles
        371 // parachute
};

public OnGameModeInit() {
     CreatePickup(weapons[30], 1, 0, 0, 0, -1); // Creates a AK-47 pickup.
}

public OnPlayerPickUpPickup(playerid, pickupid) {
     SetPVarInt(playerid, "CurrentPickupModel", weapons[MyPickupModel]);
}
Reply
#3

Uh, I'm using an dropplayerweapons script, which basically drops player weapons as a pickup model of the weapon, and i want to DEFINE weaponid somehow so this should easily work:

pawn Код:
switch(weaponid)
    {
        case 0,1: slot = 0;
        case 2 .. 9: slot = 1;
        case 10 .. 15: slot = 10;
        case 16 .. 18, 39: slot = 8;
        case 22 .. 24: slot =2;
        case 25 .. 27: slot = 3;
        case 28, 29, 32: slot = 4;
        case 30, 31: slot = 5;
        case 33, 34: slot = 6;
        case 35 .. 38: slot = 7;
        case 40: slot = 12;
        case 41 .. 43: slot = 9;
        case 44 .. 46: slot = 11;
    }
    format(string,sizeof(string),"wslot%d",slot);
    SetPVarInt(playerid,string,weaponid);
I tried few options, but if doing this with like: stock Weapons(playerid) doesn't work, adding an extra: ,weaponid to the brackets should work but then i don't know what to write in the weaponid tab when i put the command in onpickuppickup.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)