10.04.2010, 00:47
Quote:
Originally Posted by 20KtM
How do I convert if to dcmd:
Код:
new aNames[][] = { "Desarmado", "Soqueira", "Taco de Golf", "Caзetete", "Faca", "Taco de Base-Ball", "Pб de pedreiro", "Cano", "Espada", "Motoserra", "Vibrador", "Vibrador", "Vibrador", "Vibrador", "Flores", "Pй de cabra", "Granada", "Bomba de Gбs", "Coctel-Molotov", "Desconhecido", "Desconhecido", "Desconhecido", "Pistola 9mm", "Pistola 9mm com Silenciador", "Desert Eagle", "Shotgun", "Escopeta de cano serrado", "Escopeta de combate", "Micro Uzi", "MP5", "Ak-47", "M4", "Tec9", "Rifle", "Rifle-Sniper", "Lanзa Missil", "Lanзa Missil RPG", "Lanзa Chamas", "Minigun", "Bomba por controle", "Detonador", "Spray", "Extintor", "Camera", "Тculos de Visгo noturna", "Тculos Infra Vermelho", "Paraquedas", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido" }; if(strcmp(cmdtext, "/infoarmas", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0xFFFFFFAA, "USE: /infoarmas [id do player]"); return 1; } if(!IsPlayerAdmin(playerid)) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo estб autorizado a fazer isso!"); return 1; } new giveplayerid; giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { new weapons[13][2]; new playerck[MAX_PLAYER_NAME]; GetPlayerName(giveplayerid, playerck, sizeof(playerck)); format(string, sizeof(string), "EXIBINDO AS INFORMAЗХES DAS ARMAS DE: %s",playerck); SendClientMessage(playerid, TEAM_BALLAS_COLOR, string); GetPlayerWeaponData(giveplayerid, 2, weapons[2][0], weapons[2][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[2][0]], weapons[2][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 3, weapons[3][0], weapons[3][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[3][0]], weapons[3][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 4, weapons[4][0], weapons[4][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[4][0]], weapons[4][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 5, weapons[5][0], weapons[5][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[5][0]], weapons[5][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 6, weapons[6][0], weapons[6][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[6][0]], weapons[6][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 7, weapons[7][0], weapons[7][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[7][0]], weapons[7][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 8, weapons[8][0], weapons[8][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[8][0]], weapons[8][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 9, weapons[9][0], weapons[9][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[9][0]], weapons[9][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 11, weapons[11][0], weapons[11][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[11][0]], weapons[11][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); } } else { SendClientMessage(playerid, COLOR_GREY, " Este jogador estб off-line !"); return 1; } } return 1; } |
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 new aNames[][] = { "Desarmado", "Soqueira", "Taco de Golf", "Caзetete", "Faca", "Taco de Base-Ball", "Pб de pedreiro", "Cano", "Espada", "Motoserra", "Vibrador", "Vibrador", "Vibrador", "Vibrador", "Flores", "Pй de cabra", "Granada", "Bomba de Gбs", "Coctel-Molotov", "Desconhecido", "Desconhecido", "Desconhecido", "Pistola 9mm", "Pistola 9mm com Silenciador", "Desert Eagle", "Shotgun", "Escopeta de cano serrado", "Escopeta de combate", "Micro Uzi", "MP5", "Ak-47", "M4", "Tec9", "Rifle", "Rifle-Sniper", "Lanзa Missil", "Lanзa Missil RPG", "Lanзa Chamas", "Minigun", "Bomba por controle", "Detonador", "Spray", "Extintor", "Camera", "Тculos de Visгo noturna", "Тculos Infra Vermelho", "Paraquedas", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido", "Desconhecido" }; public OnPlayerCommandText(playerid, cmdtext) { dcmd(infoarmas, 9, cmdtext); return 1; } dcmd_infoarmas(playerid, params[]) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0xFFFFFFAA, "USE: /infoarmas [id do player]"); return 1; } if(!IsPlayerAdmin(playerid)) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo estб autorizado a fazer isso!"); return 1; } new giveplayerid; giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { new weapons[13][2]; new playerck[MAX_PLAYER_NAME]; GetPlayerName(giveplayerid, playerck, sizeof(playerck)); format(string, sizeof(string), "EXIBINDO AS INFORMAЗХES DAS ARMAS DE: %s",playerck); SendClientMessage(playerid, TEAM_BALLAS_COLOR, string); GetPlayerWeaponData(giveplayerid, 2, weapons[2][0], weapons[2][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[2][0]], weapons[2][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 3, weapons[3][0], weapons[3][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[3][0]], weapons[3][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 4, weapons[4][0], weapons[4][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[4][0]], weapons[4][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 5, weapons[5][0], weapons[5][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[5][0]], weapons[5][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 6, weapons[6][0], weapons[6][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[6][0]], weapons[6][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 7, weapons[7][0], weapons[7][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[7][0]], weapons[7][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 8, weapons[8][0], weapons[8][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[8][0]], weapons[8][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 9, weapons[9][0], weapons[9][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[9][0]], weapons[9][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); GetPlayerWeaponData(giveplayerid, 11, weapons[11][0], weapons[11][1]); format(string, sizeof(string), "Arma: %s, Muniзгo: %d",aNames[weapons[11][0]], weapons[11][1]); SendClientMessage(playerid, 0xFFFFFFAA, string); } } else { SendClientMessage(playerid, COLOR_GREY, " Este jogador estб off-line !"); return 1; } } return 1; }
Код:
#pragma unused params