Enum Information returns C?
#21

Quote:
Originally Posted by knackworst
Посмотреть сообщение
O.o
Now that's what I call professional structure...
I do not fully understand lol

um, the string variable is under the commandtext callback
There is nothing professional in that :/
It is just sad that I always see in "/admin" commands a count variable which is totally unnecessary

pawn Код:
// indentation
    if(strcmp("/mission", cmdtext, true, 8) == 0) { // command
        // the string variable must be empty
        new
            i = 0, // loop variable
            type = strval(cmdtext[8]); // number behind "/mission"
        for( ; i != sizeof Mission; ++i) { // loop through the array
            if(Mission[i][mission_type] == type) { // check if the type match
                format(string, sizeof string, "Mission: \"%s\" Person: \"%s\"", Mission[i][mission_name], Mission[i][person_name]);
                SendClientMessage(playerid, COLOR_YELLOW_LABEL, string);
            }
        }
        if(string[0]) { // if the string isnt empty, format was used which means that the type got found
            return true; // if found we stop here, if not maybe some other command like "/missions" get executed
        }
    }
To make that work we need to avoid the mission number 0 because strval would return 0 if there isnt a number like in "/missions" the "s"

Also make your array constant
pawn Код:
new const Mission[6][DMissions] =
Reply


Messages In This Thread
Enum Information returns C? - by knackworst - 01.10.2011, 18:50
Re: Enum Information returns C? - by [MWR]Blood - 01.10.2011, 19:01
Re: Enum Information returns C? - by kacper55331 - 01.10.2011, 19:07
Re: Enum Information returns C? - by knackworst - 01.10.2011, 19:10
Re: Enum Information returns C? - by [MWR]Blood - 01.10.2011, 19:12
Re: Enum Information returns C? - by knackworst - 01.10.2011, 19:14
Re: Enum Information returns C? - by [MWR]Blood - 01.10.2011, 19:16
Re: Enum Information returns C? - by knackworst - 01.10.2011, 19:18
Re: Enum Information returns C? - by [MWR]Blood - 01.10.2011, 19:23
Re: Enum Information returns C? - by knackworst - 01.10.2011, 19:34
Re: Enum Information returns C? - by MadeMan - 01.10.2011, 19:40
Re: Enum Information returns C? - by knackworst - 01.10.2011, 19:47
Re: Enum Information returns C? - by [MWR]Blood - 01.10.2011, 19:49
Re: Enum Information returns C? - by knackworst - 01.10.2011, 19:55
Re: Enum Information returns C? - by MadeMan - 01.10.2011, 19:56
Re: Enum Information returns C? - by knackworst - 01.10.2011, 20:27
Re: Enum Information returns C? - by MadeMan - 01.10.2011, 20:42
Re: Enum Information returns C? - by knackworst - 01.10.2011, 20:57
AW: Enum Information returns C? - by Nero_3D - 01.10.2011, 21:19
Re: Enum Information returns C? - by knackworst - 01.10.2011, 21:27
AW: Re: Enum Information returns C? - by Nero_3D - 01.10.2011, 21:40
Re: Enum Information returns C? - by knackworst - 01.10.2011, 21:47
AW: Re: Enum Information returns C? - by Nero_3D - 01.10.2011, 22:20
Re: Enum Information returns C? - by knackworst - 01.10.2011, 22:26
AW: Re: Enum Information returns C? - by Nero_3D - 01.10.2011, 22:48
Re: Enum Information returns C? - by knackworst - 01.10.2011, 22:51
Re: Enum Information returns C? - by knackworst - 02.10.2011, 00:31
AW: Re: Enum Information returns C? - by Nero_3D - 02.10.2011, 01:46
Re: Enum Information returns C? - by knackworst - 02.10.2011, 01:48
AW: Re: Enum Information returns C? - by Nero_3D - 02.10.2011, 02:03

Forum Jump:


Users browsing this thread: 15 Guest(s)