16.08.2015, 17:37
Код:
new cmd[256], idx; cmd = strtok(cmdtext, idx); if (strcmp("/answer", cmd, true) == 0) { new tmp[256], cmdid, string[256], pname[MAX_PLAYER_NAME]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid,COL_RED, "USAGE: /Answer [answer]"); cmdid = strval(tmp); if(cmdid < answer || cmdid > answer) { SendClientMessage(playerid,COL_RED, "Wrong answer!"); } if(cmdid == answer && answered == 0) { GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "%s has won %d score for answering the math question '%d'!", pname, score, cmdid); SendClientMessageToAll(COL_GREEN, string); GivePlayerMoney(playerid, 10000); answered = 1; SetPlayerScore(playerid, GetPlayerScore(playerid) + score); score = 0; return 1; } else if(cmdid == answer && answered == 1) { SendClientMessage(playerid,COL_RED, "To late!"); } return 1; } if (strcmp("/stopmaths", cmd, true) == 0) { if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid,COL_RED, "You are not an RCON admin"); KillTimer(timer); SendClientMessage(playerid,COLOR_YELLOW, "Maths stopped"); return 1; }
any ideas ?