Stock Function
#1

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;

Reply
#2

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
Reply
#3

Did not knew about it, Thanks! xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)