SA-MP Forums Archive
help warn - 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: help warn (/showthread.php?tid=558126)



help warn - Rabea - 16.01.2015

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];



Re: help warn - Ironboy - 16.01.2015

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;
}



Re: help warn - Rabea - 16.01.2015

thanks


Respuesta: help warn - JuanStone - 16.01.2015

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;
}



Respuesta: help warn - Cerealguy - 16.01.2015

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);


Re: help warn - Ironboy - 16.01.2015

He was just trying to get rid of the warning.


Re: help warn - Rabea - 16.01.2015

its giving me errors now..


Re: help warn - Ironboy - 16.01.2015

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


Respuesta: help warn - JuanStone - 16.01.2015

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;



Re: help warn - Rabea - 16.01.2015

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