26.10.2018, 19:02
Se nгo tiver resolvido ainda tente dessa forma:
PHP Code:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
CMD:dararma(playerid, params[])
{
if(!IsPlayerAdmin(playerid)
return SendClientMessage(playerid, 0xFF0000FF, "|ERRO| » Vocк nгo й Admin RCON!");
new player1, ArmaNome[32], IdArma, Quantia, ArmaNome2[32], string[128];
if(sscanf(params, "us[32]D(500)", player1, ArmaNome, Quantia))
return SendClientMessage(playerid, 0xFF0000FF, "|USE| » /dararma [playerid] [arma id/arma nome] [muniзгo]");
if(player1 == INVALID_PLAYER_ID)
return SendClientMessage(playerid, 0xFF0000FF, "|ERRO| » O jogador nгo estб conectado.");
if(!IsNumeric(ArmaNome)) IdArma = GetWeaponIDFromName(ArmaNome); else IdArma = strval(ArmaNome);
GetWeaponName(IdArma, ArmaNome2, 32);
format(string, sizeof(string), "Vocк deu a arma %s (%d) com %d de muniзгo para o jogador: \"%s\"", ArmaNome2, IdArma, Quantia, pName(player1));
SendClientMessage(playerid, 0x00FF00FF, string);
if(player1 != playerid)
{
format(string,sizeof(string),"O Admin \"%s\" te deu a arma %s (%d) com %d de muniзгo", pName(playerid), ArmaNome2, IdArma, Quantia);
SendClientMessage(player1, 0xFFFF00FF, string);
}
GivePlayerWeapon(player1, IdArma, Quantia);
return 1;
}
stock GetWeaponIDFromName(WeaponName[])
{
if(strfind("molotov",WeaponName,true)!=-1) return 18;
for(new i = 0; i <= 46; i++)
{
switch(i)
{
case 0,19,20,21,44,45: continue;
default:
{
new name[32]; GetWeaponName(i,name,32);
if(strfind(name,WeaponName,true) != -1) return i;
}
}
}
return -1;
}
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}