Originally Posted by bombomloko
Em momento algum, eu cheguei a falar que nгo sabia converter cmd pra strcmp. Apenas disse que os cуdigos que eles me passaram nгo tavam dando certo e que se fossem continuar ajudando, poderiam fazer em strcmp para facilitar, pra eu nгo ter que ficar convertendo.
pawn Код:
CMD:dararma(playerid, params[]) { new giveplayerid; if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "[INFO] /dararma [id]"); new arma = GetPlayerWeapon(playerid); new muni = GetPlayerAmmo(playerid); GivePlayerWeapon(giveplayerid, arma, muni); new msg[70], player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME]; GetPlayerName(playerid, player, sizeof(player)); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); format(msg, sizeof(msg), "Vocк deu uma arma para %s com %i de muniзгo!", giveplayer, muni); SendClientMessage(playerid, COLOR_LIGHTBLUE, msg); format(msg, sizeof(msg), "Vocк recebeu uma arma de %s com %i de muniзгo!", player, muni); SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, msg); RemovePlayerWeapon(giveplayerid, arma); return 1; }
// me passaram esse comando. sabe o que muda pra transformar pra strcmp? apenas isso: CMD:dararma(playerid, params[])
//pra isso: if(strcmp(cmd, "/dararma", true) == 0)
//e isso: if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "[INFO] /dararma [id]");
//pra isso: tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Para dar sua arma a alguйm, use: /darma [id]"); return 1; }
Te passo meu comando em STRCMP, prontinho, sу que й /darma e nгo /dar arma.
pawn Код:
if(strcmp(cmd, "/darma", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Para dar sua arma a alguйm, use: /darma [id]"); return 1; } new arma = GetPlayerWeapon(playerid); new muni = GetPlayerAmmo(playerid); giveplayerid = ReturnUser(tmp); new msg[70], player[MAX_PLAYER_NAME]; GivePlayerWeapon(giveplayerid, arma, muni); RemovePlayerWeapon(playerid, arma); GetPlayerName(playerid, player, sizeof(player)); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); format(msg, sizeof(msg), "Vocк deu uma arma para %s com %i de muniзгo!", giveplayer, muni); SendClientMessage(playerid, COLOR_LIGHTBLUE, msg); format(msg, sizeof(msg), "Vocк recebeu uma arma de %s com %i de muniзгo!", player, muni); SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, msg); return 1; }
|