mSelection. Wrong Picture Shows! [HELP]
#1

Hello guys my new problem is. i configured now how to show the right picture on Selection. but everytime i click the picture. it doesn't give me the weapon that i chosen. can anyone help me? code show's below

OnPlayerModelSelectionEx
pawn Код:
#define VWEAPONS 1

public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
{
    if(extraid == VWEAPONS)
    {
        if(response)
        {
            SendClientMessage(playerid, COLOR_GREEN,"VIP Weapon Recieved");
            GivePlayerWeapon(playerid, modelid, 250);
        }
        else SendClientMessage(playerid, COLOR_RED_ERROR,"Canceled weapon selection");
        return 1;
    }
    return 1;
}
Commands
pawn Код:
CMD:vweapons(playerid)
{
    new weapons[12];
    weapons[0] = 333;
    weapons[1] = 335;
    weapons[2] = 336;
    weapons[3] = 346;
    weapons[4] = 347;
    weapons[5] = 348;
    weapons[6] = 349;
    weapons[7] = 350;
    weapons[8] = 351;
    weapons[9] = 352;
    weapons[10] = 353;
    weapons[11] = 355;
    ShowModelSelectionMenuEx(playerid, weapons, 12, "Select Weapon", VWEAPONS, 16.0, 0.0, -55.0);
    return 1;
}
Reply
#2

Bump. almost 1 day no one replied. help please
Reply
#3

Try :

pawn Код:
GivePlayerWeapon(playerid, weaponid, 250);
Reply
#4

Error
pawn Код:
error 017: undefined symbol "weaponid"
The error caused because there is no any defined weaponid on the callback.

pawn Код:
public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
Reply
#5

That's weird, I haven't had that problem yet.
try using some print function. Maybe it does get a response, but just won't execute that code.
Look if it gets stuck somewhere.
Reply
#6

You can't use the modelid in GivePlayerWeapon, you need to use the weaponid. Create an second array with all the weapon ids or use something with switch/case. This is probably what SilverKitten tried to tell you without telling anything.
Reply
#7

You have to use the weaponID in the GivePlayerWeapon function. Using the ObjectModelID won't work

Here a small script to convert modelid to weaponid
pawn Код:
GetWeaponIDByModelID(modelid) // D0erfler
{
switch(modelid)
{
case 331: return 1;
case 333: return 2;
case 334: return 3;
case 335: return 4;
case 336: return 5;
case 337: return 6;
case 338: return 7;
case 339: return 8;
case 341: return 9;
case 321: return 10;
case 322: return 11;
case 323: return 12;
case 324: return 13;
case 325: return 14;
case 326: return 15;
case 342: return 16;
case 343: return 17;
case 344: return 18;
case 346: return 22;
case 347: return 23;
case 348: return 24;
case 349: return 25;
case 350: return 26;
case 351: return 27;
case 352: return 28;
case 353: return 29;
case 355: return 30;
case 356: return 31;
case 372: return 32;
case 357: return 33;
case 358: return 34;
case 359: return 35;
case 360: return 36;
case 361: return 37;
case 362: return 38;
case 363: return 39;
case 364: return 40;
case 365: return 41;
case 366: return 42;
case 367: return 43;
case 368: return 44;
case 369: return 45;
case 371: return 46;
default: return 0;
}
return 0;
}
And now replace
pawn Код:
GivePlayerWeapon(playerid, modelid, 250);
with
pawn Код:
GivePlayerWeapon(playerid, GetWeaponIDByModelID(modelid), 250);
Reply
#8

@Strawhats the command works. and when i click the weapon works. i tried debugging it. and it works. it just didn't give me the weapon i choosen

@Basssiiie Can you show me what you mean?

@D0erfler Trying it now

Edit
Question:
how to put a price on the selection? like a textdraw shows the price of weapon but using the mSelection.
D0erfler - Thanks Alot Man! It Works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)