Help I don't understand why...
#1

I don't understand If I choose one of this weapons Rocket Launcher,Heat-Seeker,Flamethrower and Minigun.

It always say Invalid Weapon ID



pawn Код:
if(dialogid == DUELDIAG+5) //Weapon slots
    {
            if(response)
                {
                        SetPVarInt(playerid, "dWSlot", listitem);
                        ShowPlayerDialog(playerid, DUELDIAG+6, DIALOG_STYLE_LIST, "Choose a weapon", "Brass Knuckles\nGolf Club\nNite Stick\nKnife\nBaseball Bat\nShovel\nPool Cue\nKatana\nChainsaw\nDildo\nVibrator\nFlowers\nCane\nGrenade\nMolotov\nColt 45\nSilenced Pistol\nDeagle\nShotgun\nSawn-Off\nSpas\nUzi\nMP5\nAK47\nM4\nTec9\nRifle\nSniper\nRocket Launcher\nHeat-Seeker\nFlamethrower\nMinigun", "Select", "Back");
                }
                else ShowDuelSettingsDialog(playerid);
    }
    if(dialogid == DUELDIAG+6)
    {
            if(response)
            {
                new key[7];
                format(key, sizeof(key), "dWep%d", GetPVarInt(playerid, "dWSlot"));
                switch(listitem)
                {
                    case 40:
                    {
                        ShowPlayerDialog(playerid, DUELDIAG+6, DIALOG_STYLE_LIST, "Choose a weapon", "Brass Knuckles\nGolf Club\nNite Stick\nKnife\nBaseball Bat\nShovel\nPool Cue\nKatana\nChainsaw\nDildo\nVibrator\nFlowers\nCane\nGrenade\nMolotov\nColt 45\nSilenced Pistol\nDeagle\nShotgun\nSawn-Off\nSpas\nUzi\nMP5\nAK47\nM4\nTec9\nRifle\nSniper\nRocket Launcher\nHeat-Seeker\nFlamethrower\nMinigun", "Select", "Back");
                        return 1;
                    }
                }
                switch(listitem)
                {
                    case 0: SetPVarInt(playerid, key, 1);
                    case 1: SetPVarInt(playerid, key, 2);
                    case 2: SetPVarInt(playerid, key, 3);
                    case 3: SetPVarInt(playerid, key, 4);
                    case 4: SetPVarInt(playerid, key, 5);
                    case 5: SetPVarInt(playerid, key, 6);
                    case 6: SetPVarInt(playerid, key, 7);
                    case 7: SetPVarInt(playerid, key, 8);
                    case 8: SetPVarInt(playerid, key, 9);
                    case 9: SetPVarInt(playerid, key, 10);
                    case 10: SetPVarInt(playerid, key, 11);
                    case 11: SetPVarInt(playerid, key, 14);
                    case 12: SetPVarInt(playerid, key, 15);
                    case 13: SetPVarInt(playerid, key, 16);
                    case 14: SetPVarInt(playerid, key, 18);
                    case 15: SetPVarInt(playerid, key, 22);
                    case 16: SetPVarInt(playerid, key, 23);
                    case 17: SetPVarInt(playerid, key, 24);
                    case 18: SetPVarInt(playerid, key, 25);
                    case 19: SetPVarInt(playerid, key, 26);
                    case 20: SetPVarInt(playerid, key, 27);
                    case 21: SetPVarInt(playerid, key, 28);
                    case 22: SetPVarInt(playerid, key, 29);
                    case 23: SetPVarInt(playerid, key, 30);
                    case 24: SetPVarInt(playerid, key, 31);
                    case 25: SetPVarInt(playerid, key, 32);
                    case 26: SetPVarInt(playerid, key, 33);
                    case 27: SetPVarInt(playerid, key, 34);
                    case 28: SetPVarInt(playerid, key, 35);
                    case 29: SetPVarInt(playerid, key, 36);
                    case 30: SetPVarInt(playerid, key, 37);
                    case 31: SetPVarInt(playerid, key, 38);
                   
                }
                ShowDuelSettingsDialog(playerid);

pawn Код:
stock weaponNames(weaponid)
{
    new str[25];
    switch(weaponid)
    {
        case 0: str = "Fist";
        case 1: str = "Brass Knuckles";
        case 2: str = "Golf Club";
        case 3: str = "Night Stick";
        case 4: str = "Knife";
        case 5: str = "Baseball Bat";
        case 6: str = "Shovel";
        case 7: str = "Pool Cue";
        case 8: str = "Katana";
        case 9: str = "Chainsaw";
        case 10: str = "Purple Dildo";
        case 11: str = "Vibrator";
        case 12: str = "Vibrator";
        case 13: str = "Vibrator";
        case 14: str = "Flowers";
        case 15: str = "Cane";
        case 16: str = "Grenade";
        case 17: str = "Teargas";
        case 18: str = "Molotov";
        case 19: str = " ";
        case 20: str = " ";
        case 21: str = " ";
        case 22: str = "Colt 45";
        case 23: str = "Silenced Pistol";
        case 24: str = "Deagle";
        case 25: str = "Shotgun";
        case 26: str = "Sawn-Off";
        case 27: str = "Spas";
        case 28: str = "Uzi";
        case 29: str = "MP5";
        case 30: str = "AK47";
        case 31: str = "M4";
        case 32: str = "Tec9";
        case 33: str = "County Rifle";
        case 34: str = "Sniper Rifle";
        case 35: str = "Rocket Launcher";
        case 36: str = "Heat-Seeker";
        case 37: str = "Flamethrower";
        case 38: str = "Minigun";
        case 39: str = "Satchel Charge";
        case 40: str = "Detonator";
        case 41: str = "Spray Can";
        case 42: str = "Fire Extinguisher";
        case 43: str = "Camera";
        case 44: str = "Night Vision Goggles";
        case 45: str = "Infrared Goggles";
        case 46: str = "Parachute";
        case 47: str = "Fake Pistol";
        case 48: str = "None"; //For duel msgs
    }
    return str;
}
Код:
if(ReturnWeaponIDOrName(gWeap) == -1) return SendClientMessage(playerid, WHITE, "{FF0000}>> Slot 1: Invalid Weapon ID or Name");
                if(!strlen(gWeap2)) format(gWeap2, sizeof(gWeap2), "48");
                if(!strlen(gWeap3)) format(gWeap3, sizeof(gWeap3), "48");
Код:
stock ReturnWeaponIDOrName(idname[])
{
	if(!IsNumeric(idname))
	{
	    new gWeap = GetWeaponModelIDFromName(idname);
	    if(IsValidWeapon(gWeap)) return gWeap;
	}
	else if(IsNumeric(idname))
	{
	    new gWeap = strval(idname);
		if(IsValidWeapon(gWeap)) return gWeap;
	}
 	return -1;
}
Reply
#2

Just so GivePlayerWeapon ?
Reply
#3

Quote:
Originally Posted by Socan
Посмотреть сообщение
Just so GivePlayerWeapon ?
I've already that
Код:
	GivePlayerWeapon(playerid, wep1, 50000);
	GivePlayerWeapon(playerid, wep2, 50000);
	GivePlayerWeapon(playerid, wep3, 50000);
Anyone have any Idea?
Reply
#4

I canґt actually see you defining or doing anything with "wep1, wep2, wep3" , thats why you get the wrong ID I guess.
Reply
#5

Quote:
Originally Posted by daastle
Посмотреть сообщение
I canґt actually see you defining or doing anything with "wep1, wep2, wep3" , thats why you get the wrong ID I guess.
But why is that other weapons are working and I can use sniper and the rest. Except those that I have mentioned?


Ohh you mean this?
pawn Код:
stock AddToDuel(playerid, Float:X, Float:Y, Float:Z, Float:A, interior, world, wep1, wep2, wep3)
{
    IsPlayerInDM[playerid] = 1;
    KillTimer(DuelTimer[playerid]);
    SetPlayerArmour(playerid, 0);
    SetPVarInt(playerid, "CMDDisabled", 3);
    SetPVarInt(playerid, "CDTick", 0);
    SetPVarInt(playerid, "InDuel", 1);
    SetPVarInt(playerid, "ArmourReport", 1);
    SetPVarInt(playerid, "DInvited", 0);
    SetPlayerPosEx(playerid, X, Y, Z, A, interior, world);
    SetPlayerHealth(playerid, 100);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, wep1, 50000);
    GivePlayerWeapon(playerid, wep2, 50000);
    GivePlayerWeapon(playerid, wep3, 50000);
    TogglePlayerControllable(playerid, 0);
    SetCameraBehindPlayer(playerid);
    DuelTimer[playerid] = SetTimerEx("DuelCDUpdate", 1000, 1, "i", playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)