SA-MP Forums Archive
Stock Function - 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: Stock Function (/showthread.php?tid=567985)



Stock Function - JaKe Elite - 18.03.2015

Hey guys,

I am trying to create a stock function which returns the current mission, Well it is hard to explain, I am trying to attempt to create a function similar to that GetPlayerName, where in the Player's Name is stored to the assign string of that function.

However, i am having errors on doing so on my own one, Can someone help me? It gives me error.

PHP код:
stock GetMission(const mission[], len)
{
    switch(
curMission)
    {
        case 
0:
        {
            
format(missionlen"Minigun Madness");
        }
    }
    return 
mission;




AW: Stock Function - Kaliber - 18.03.2015

If you want sth like GetPlayerName, do it like this:

Код:
stock GetMission(mission[], len) 
{ 
    switch(curMission) 
    { 
        case 0: format(mission, len, "Minigun Madness"); 
    } 
    return 1; 
}
But if you want the direct string, you can do this:

PHP код:
stock GetCurMission() {
    new 
string[32];
    switch(
curMission) {
        case 
0string "Minigun Madness";
    }
    return 
string;
}
//and then:
printf("Current Mission: %s",GetCurMission()); 
Greekz


Re: Stock Function - JaKe Elite - 18.03.2015

Did not knew about it, Thanks! xD