Command /givegun - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command /givegun (
/showthread.php?tid=333091)
Command /givegun -
RenSoprano - 10.04.2012
Hello I have this problem When Try to give weapon to someone it doesn't give a weapon to him
pawn Код:
CMD:givegun(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new target, gun, string[128];
if(sscanf(params, "ud", target, gun))
{
SendClientMessage(playerid, COLOR_GREY, "Usage: /givegun <playerid> <gun>");
return 1;
}
if(gun < 1 || gun > 47) { SendClientMessage(playerid, COLOR_GREY, "Don't go below 1 or above 47."); return 1; }
if(IsPlayerConnected(target))
{
if(target != INVALID_PLAYER_ID && gun <= 20 || gun >= 22)
{
GivePlayerValidWeapon(target, gun, 50000);
format(string, sizeof(string), "Admin %s has given you a weapon.", GetName(playerid));
SendClientMessage(target, COLOR_GREY, string);
format(string, sizeof(string), "You have given %s a weapon.", GetName(target));
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}
return 1;
}
Re: Command /givegun -
Shabi RoxX - 10.04.2012
You want to give gun to player whos using cmd ? OR what ?
Re: Command /givegun -
tyler12 - 10.04.2012
update sscanf..
Re: Command /givegun -
[HiC]TheKiller - 10.04.2012
pawn Код:
CMD:givegun(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
if(sscanf(params, "ud", target, gun)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /givegun <playerid> <gun>");
if(gun < 1 || gun > 47) return SendClientMessage(playerid, COLOR_GREY, "Don't go below 1 or above 47.");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_GREY, "User is not connected!");
if(gun != 21)
{
GivePlayerWeapon(target, gun, 50000); //Your version would be GivePlayerValidWeapon, this also may be causing issues.
format(string, sizeof(string), "Admin %s has given you a weapon.", GetName(playerid));
SendClientMessage(target, COLOR_GREY, string);
format(string, sizeof(string), "You have given %s a weapon.", GetName(target));
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
Try that.