SA-MP Forums Archive
How to get the result from multiple variable - 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: How to get the result from multiple variable (/showthread.php?tid=618730)



How to get the result from multiple variable - Jonggol - 09.10.2016

Help me to answer this questions.

I'm confused how to get the result from multiple variable, like how to make fish system to get weight of fish.
i write this code as example:

Код:
//-------
static 
    fishgrams[MAX_PLAYERS][5];

//------

public OnPlayerConnect(playerid)
{
    for(new i; i < 5; i++) {
        fishgrams[playerid][i] = random(100);
    }
    return 1;
}

//------

CMD:fishgrams(playerid, params[])
{
    //How can i get all variable value from fishgrams?
    //Like this?

    static 
        count = 0;
    for(new i; i < 5; i++) {
        count += fishgrams[playerid][i];
    }
    printf("You have weight %d lbs of fish.", count);
    return 1;
}
Or anyone have other method to get the result?.


Re: How to get the result from multiple variable - Jonggol - 09.10.2016

bump.


Re: How to get the result from multiple variable - Skimmer - 09.10.2016

I don't see any issue there. What's your problem? Can you print what your count variable contains?