01.10.2011, 21:40
Quote:
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 |
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
}
}
Also make your array constant
pawn Код:
new const Mission[6][DMissions] =