08.09.2017, 05:46
I made a quiz command for my server when I used / answer \ then the puzzle would be correct without the answer I thought it was wrong in strcmp hoping someone could help me, sorry my english is very bad i am vietnamese
Код:
CMD:answer(playerid, params[]) { new CauTraLoi[32]; if (TonTaiCauDo == 1) { if (NguoiTaoCauDo == playerid) return SendClientMessageEx(playerid, COLOR_WHITE, "Ban khong the tra loi cau do cua ban than."); if (sscanf(params, "s[32]", CauTraLoi)) return SendClientMessageEx(playerid, COLOR_WHITE, "Su dung: /traloicaudo [noi dung]"); if (~strcmp(CauTraLoi, DapAn, true)) { new string[128]; format(string, sizeof(string), "{C0CEFF}** CAU DO **{FFFF00}: Dap an la '%s'", DapAn); SendClientMessageToAllEx(COLOR_YELLOW, string); new rand = random(3); switch (rand) { case 0: { format(string, sizeof(string), "{C0CEFF}** CAU DO **{FFFF00}: %s da tra loi dung va nhan duoc phan thuong $50,000!", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); GivePlayerCash(playerid, 50000); } case 1: { format(string, sizeof(string), "{C0CEFF}** CAU DO **{FFFF00}: %s da tra loi dung va nhan duoc phan thuong 2000 vat lieu!", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); PlayerInfo[playerid][pMats] += 2000; } case 2: { format(string, sizeof(string), "{C0CEFF}** CAU DO **{FFFF00}: %s da tra loi dung va nhan duoc phan thuong 20 pot va crack!", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); PlayerInfo[playerid][pPot] += 20; PlayerInfo[playerid][pCrack] += 20; } case 3: { format(string, sizeof(string), "{C0CEFF}** CAU DO **{FFFF00}: %s da tra loi dung va nhan duoc phan thuong Deagle va Mp5!", GetPlayerNameEx(playerid)); SendClientMessageToAllEx(COLOR_YELLOW, string); SetPlayerValidWeapon(playerid, 24, 35); SetPlayerValidWeapon(playerid, 29, 35); } } TonTaiCauDo = 0; NguoiTaoCauDo = INVALID_PLAYER_ID; format(CauDo, sizeof(CauDo), "None"); format(DapAn, sizeof(DapAn), "None"); } else { SendClientMessageEx(playerid, COLOR_GRAD2, "Ban da tra loi sai."); } } else SendClientMessageEx(playerid, COLOR_WHITE, "Chua co cau do nao duoc tao."); return 1; }