help warn
#1

why it showing me the warn...

pawn Код:
(11126) : warning 225: unreachable code
pawn Код:
CMD:unloadarmory(playerid, params[])
{
    new vehicleid;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsAARMY(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You aren't a law to use this command.");
    if(!IsPlayerInRangeOfPoint(playerid, 2.7,256.2174,77.3295,1004.0344)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near armory equipment unloading place.");
    if(GetVehicleModel(vehicleid) == 515 || GetVehicleModel(vehicleid) == 509) return SendClientMessage(playerid, COLOR_GREY, "You are not in a roadtrain.");
    if(PlayerInfo[playerid][pArmoryRefilled] == 1)
    {
    PlayerInfo[playerid][pArmoryRefilled] = 0;
    return SendClientMessage(playerid, COLOR_GREY, "You refilled the armory equipment.");
    Armory[MP5] = 15; // this line that giving me the warn
    Armory[M4] = 15;
    Armory[COMBAT] = 15;
     }
    return 1;
    }
this how i define
pawn Код:
#define DEF_MP5COUNT 15
#define DEF_COMBATCOUNT 15
#define DEF_M4COUNT 15
enum armassets
{
MP5,
COMBAT,
M4
}

new Armory[armassets];
Reply
#2

pawn Код:
CMD:unloadarmory(playerid, params[])
{
    new vehicleid;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsAARMY(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You aren't a law to use this command.");
    if(!IsPlayerInRangeOfPoint(playerid, 2.7,256.2174,77.3295,1004.0344)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near armory equipment unloading place.");
    if(GetVehicleModel(vehicleid) == 515 || GetVehicleModel(vehicleid) == 509) return SendClientMessage(playerid, COLOR_GREY, "You are not in a roadtrain.");
    if(PlayerInfo[playerid][pArmoryRefilled] == 1)
    {
        PlayerInfo[playerid][pArmoryRefilled] = 0;
        SendClientMessage(playerid, COLOR_GREY, "You refilled the armory equipment.");
        Armory[MP5] = 15;
        Armory[M4] = 15;
        Armory[COMBAT] = 15;
    }
    return 1;
}
Reply
#3

thanks
Reply
#4

this work ?.

pawn Код:
new vehicleid;

if(GetVehicleModel(vehicleid) == 515 || GetVehicleModel(vehicleid) == 509) return SendClientMessage(playerid, COLOR_GREY, "You are not in a roadtrain.");


pawn Код:
GetPlayerVehicleModel(GetPlayerVehicleID(playerid) == 55)
{
}

// ?

new vehicleid = GetPlayerVehicleID(playerid);
pawn Код:
CMD:unloadarmory(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsAARMY(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You aren't a law to use this command.");
    if(!IsPlayerInRangeOfPoint(playerid, 2.7,256.2174,77.3295,1004.0344)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near armory equipment unloading place.");
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 515 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 509) return SendClientMessage(playerid, COLOR_GREY, "You are not in a roadtrain.");
    if(PlayerInfo[playerid][pArmoryRefilled] == 1)
    {
        PlayerInfo[playerid][pArmoryRefilled] = 0;
        SendClientMessage(playerid, COLOR_GREY, "You refilled the armory equipment.");
        Armory[MP5] = 15;
        Armory[M4] = 15;
        Armory[COMBAT] = 15;
    }
    return true;
}
Reply
#5

Quote:
Originally Posted by JuanStone
Посмотреть сообщение
this work ?.

pawn Код:
new vehicleid;

if(GetVehicleModel(vehicleid) == 515 || GetVehicleModel(vehicleid) == 509) return SendClientMessage(playerid, COLOR_GREY, "You are not in a roadtrain.");


pawn Код:
GetPlayerVehicleModel(GetPlayerVehicleID(playerid) == 55)
{
}

// ?

new vehicleid = GetPlayerVehicleID(playerid);
He was going to put just the same, you're absolutely right that does not work

use what he says, equals vehicleid = GetPlayerVehicleID(playerid);
Reply
#6

He was just trying to get rid of the warning.
Reply
#7

its giving me errors now..
Reply
#8

Quote:
Originally Posted by Rabea
Посмотреть сообщение
its giving me errors now..
Show the error plus code
Reply
#9

Which error ?. You only had to replace the line lol.

By:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 515 || GetVehicleModel(GetPlayerVehicleID(playerid) == 509)) return Send..
And delete:
pawn Код:
new vehicleid;
Reply
#10

fixed lel.
i added two ( "" )
thanks anyway people <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)