buggy stock, please help
#10

It's a function, not a stock, don't use the keyword stock, the keyword stock is used to silence that function, stock is used in includes, not gamemodes/ filterscripts.
Instead of making a function like this, simply make an array, and make a little function that returns the rank name from the array.
Also, the errors and warnings are coming up because of something different, encourage and promote 'productive' code writing. Check lines above 260.
Your code:
PHP Code:
stock GetPDRank(playerid)
{
    new 
ranks PlayerInfo[playerid][pRank];
    new 
rankname[37];
    switch(
ranks)
    {
        case 
1rankname "Chief of Police";
        case 
2rankname "Assistant Chief of Police";
        case 
3rankname "Deputy Chief of Police";
        case 
4rankname "Lieutenant";
        case 
5rankname "Captain";
        case 
6rankname "Commander";
        case 
7rankname "Police Sergeant II";
        case 
8rankname "Police Sergeant I";
        case 
9rankname "Detective III";
        case 
10rankname "Detective II";
        case 
11rankname "Detective I";
        case 
12rankname "LIO/SLO";
        case 
13rankname "Police Officer III";
        case 
14rankname "Police Officer II";
        case 
15rankname "Polife Officer I";
        case 
16rankname "Academy Student";
        case 
17rankname "Suspended Officer";
    }
    return 
rankname;

My code:
PHP Code:
enum e_fGovernment
{
    
RankName[37]
};
new const 
fGovernment[][e_fGovernment] =
{
    
"-"// enums and arrays start from 0, rank 0 is nothing
    
"Mayor"// rank 1
    
"Deputy Mayor" // rank 2 and so on...
};
GetGovRank(playerid) return fGovernment[PlayerInfo[playerid][pRank]][RankName]; 
My code is secured as I am using constant array, faster and better.
Reply


Messages In This Thread
buggy stock, please help - by ImTouchk - 14.12.2016, 08:23
Re: buggy stock, please help - by iLearner - 14.12.2016, 08:28
Re: buggy stock, please help - by ImTouchk - 14.12.2016, 08:30
Re: buggy stock, please help - by iLearner - 14.12.2016, 08:33
Re: buggy stock, please help - by ImTouchk - 14.12.2016, 08:35
Re: buggy stock, please help - by iLearner - 14.12.2016, 08:35
Re: buggy stock, please help - by ImTouchk - 14.12.2016, 08:37
Re: buggy stock, please help - by iLearner - 14.12.2016, 08:57
Re: buggy stock, please help - by Airblog - 14.12.2016, 11:18
Re: buggy stock, please help - by Logic_ - 14.12.2016, 11:29
Re: buggy stock, please help - by ImTouchk - 14.12.2016, 16:15
Re: buggy stock, please help - by ImTouchk - 17.12.2016, 18:51
Re: buggy stock, please help - by Konstantinos - 17.12.2016, 18:58

Forum Jump:


Users browsing this thread: 2 Guest(s)