Unknown Command /givegun
#1

Hi guys, I have a problem with this Weapon Anti-Hack: https://sampforum.blast.hk/showthread.php?tid=123887

I integrated in my gamemode but /givegun dosen't work

Код:
CMD:givegun(playerid, params[])
{
        new gun,target,gloante;
  		if(PlayerInfo[playerid][pAdminLevel] < 4) return FaraAcces;
        if(sscanf(params, "udd", target, gun ,gloante)) return SendClientMessage(playerid, -1, "{C0C0C0}Folosire {FFFFFF}/givegun <playerid> <gun> <gloante>");
        if(gun < 1 || gun > 47) return SendClientMessage(playerid, COLOR_GREY, "Armele au ID cuprinse intre 1-47.");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_GREY, "Acel player nu este conectat!");
        if(gun == 21 && PlayerInfo[target][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"Nu poti da JetPack la un Player");
        
        if(gun == 21)
		{
   			SetPlayerSpecialAction(target,SPECIAL_ACTION_USEJETPACK);
        }
        if(gun != 21)
        {
			GivePlayerGun(target, gun, gloante);
			new adminame[MAX_PLAYER_NAME+1], string1[128+MAX_PLAYER_NAME+1],playername[MAX_PLAYER_NAME+1], string2[128+MAX_PLAYER_NAME+1];
			GetPlayerName(playerid, adminame, sizeof(adminame));
 			GetPlayerName(target, playername, sizeof(playername));

   		 	format(string1, sizeof(string1), "[Admin] {FFFFFF}Iai dat playerului {F81414}%s {00FFFF}(ID %d) {FFFFFF}arma ID %d cu %d gloante.",playername,target,gun,gloante);
    		SendClientMessage(playerid, 0xC0C0C0AA, string1);
    		format(string2, sizeof(string2), "[Admin] {FFFFFF}Ai primit {F81414}Arma {FFFFFF}ID %d cu %d gloante de la Admin {F81414}%s",gun,gloante,adminame);
    		SendClientMessage(target, 0xC0C0C0AA, string2);
        }
        return 1;
}
GivePlayerGun(target, gun, gloante); <--- This line is the problem, (if i try to give a jetpack,works)

If i type /givegun 0 24 999 (exemple) i recive: Unknown Command

Sorry for bad english
Reply
#2

Any help ? Please
Reply
#3

What's FaraAccess?
Reply
#4

#define FaraAcces SendClientMessage(playerid,-1,"{F81414}Nu ai acces la aceasta comanda!")
Reply
#5

There are two scenarios I can imagine here, either one of your SendClientMessage's actually returns 0 and fails to send the message whнch may result in an unknown command. Unsure of what command preprocessor you're using and how they handle it, or it's really GivePlayerGun in which case would you please paste GivePlayerGun for me?
Reply
#6

Try this one

Код:
CMD:givegun(playerid, params[])
{
	new giveplayerid,giveplayer[25],moneys1,ammo,playername[25], string[256];
	if(PlayerInfo[playerid][pAdminLevel] < 4) return 0;
	if(sscanf(params, "udd", giveplayerid, moneys1, ammo)) return SendClientMessage(playerid, -1, "{C0C0C0}Folosire {FFFFFF}/givegun <playerid> <gun> <gloante>");
 	if(moneys1 < 1 || moneys1 > 47) return SendClientMessage(playerid, COLOR_GREY, "Armele au ID cuprinse intre 1-47.");
        if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_GREY, "Acel player nu este conectat!");
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
        GetPlayerName(playerid, adminame, sizeof(adminame));
	if(moneys1 == 21 && PlayerInfo[target][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"Nu poti da JetPack la un Player");
        if(moneys1 == 21)
	{
   		SetPlayerSpecialAction(target,SPECIAL_ACTION_USEJETPACK);
 	}
  	if(moneys1 != 21)
   	{
   	    GivePlayerWeapon2(giveplayerid, moneys1, ammo);
	 	format(string1, sizeof(string1), "[Admin] {FFFFFF}Iai dat playerului {F81414}%s {00FFFF}(ID %d) {FFFFFF}arma ID %d cu %d gloante.",playername,giveplayer,moneys1,ammo);
 		SendClientMessage(playerid, 0xC0C0C0AA, string1);
 		format(string2, sizeof(string2), "[Admin] {FFFFFF}Ai primit {F81414}Arma {FFFFFF}ID %d cu %d gloante de la Admin {F81414}%s",moneys1,ammo,adminame);
 		SendClientMessage(target, 0xC0C0C0AA, string2);
   	}
   	return 1;
}
Reply
#7

Код:
stock GivePlayerGun(playerid, Gun, Ammo)
{
        if(Gun == 1) { Brass[playerid] = 1; }
        if(Gun == 2) { Golf[playerid] = 1; }
        if(Gun == 3) { NiteStick[playerid] = 1; }
        if(Gun == 4) { Knife[playerid] = 1; }
        if(Gun == 5) { BaseBall[playerid] = 1; }
        if(Gun == 6) { Shovel[playerid] = 1; }
        if(Gun == 7) { Pool[playerid] = 1; }
        if(Gun == 8) { Katana[playerid] = 1; }
        if(Gun == 9) { ChainSaw[playerid] = 1; }
        if(Gun == 10) { PurpleDil[playerid] = 1; }
        if(Gun == 11) { SmallWhiteDil[playerid] = 1; }
        if(Gun == 12) { LargeWhiteDil[playerid] = 1; }
        if(Gun == 13) { SilverDil[playerid] = 1; }
        if(Gun == 14) { Flowers[playerid] = 1; }
        if(Gun == 15) { Cane[playerid] = 1; }
        if(Gun == 16) { Grenade[playerid] = 1; }
        if(Gun == 17) { TearGas[playerid] = 1; }
        if(Gun == 18) { Molitov[playerid] = 1; }
        if(Gun == 22) { Ninemm[playerid] = 1; }
        if(Gun == 23) { Silenced9mm[playerid] = 1; }
        if(Gun == 25) { Shotgun[playerid] = 1; }
        if(Gun == 26) { SawnOffShotgun[playerid] = 1; }
        if(Gun == 27) { CombatShotgun[playerid] = 1; }
        if(Gun == 28) { MicroSMG[playerid] = 1; }
        if(Gun == 29) { SMG[playerid] = 1; }
        if(Gun == 30) { AK47[playerid] = 1; }
        if(Gun == 31) { M4[playerid] = 1; }
        if(Gun == 32) { Tec9[playerid] = 1; }
        if(Gun == 33) { CountryRifle[playerid] = 1; }
        if(Gun == 34) { SniperRifle[playerid] = 1; }
        if(Gun == 35) { Rocket[playerid] = 1; }
        if(Gun == 36) { HeatSeakingRocket[playerid] = 1; }
        if(Gun == 37) { FlameThrower[playerid] = 1; }
        if(Gun == 38) { MiniGun[playerid] = 1; }
        if(Gun == 39) { Satchel[playerid] = 1; }
        if(Gun == 40) { Detonator[playerid] = 1; }
        if(Gun == 41) { SprayCan[playerid] = 1; }
        if(Gun == 42) { Fire[playerid] = 1; }
        if(Gun == 43) { Camera[playerid] = 1; }
        if(Gun == 44) { NightVision[playerid] = 1; }
        if(Gun == 45) { ThermalVision[playerid] = 1; }
        if(Gun == 46) { Parachute[playerid] = 1; }
        GivePlayerWeapon(playerid, Gun, Ammo);
}
Reply
#8

Makhmoor where did you get the GivePlayerWeapon2 from? lol

EDIT: There is nothing wrong with GivePlayerGun. I think one of your SendClientMessage things are failing. Try something like:

pawn Код:
printf("%b", SendClientMessage(playerid, -1, "xx");
and see if your console outputs 0. Not sure if %b works.
Reply
#9

GetPlayerWeapon(giveplayerid, moneys1, ammo); * sorry its look like this
Reply
#10

Quote:

CMD:givegun(playerid, params[])
{
new gun,target,gloante;
if(PlayerInfo[playerid][pAdminLevel] < 4) return FaraAcces;
if(sscanf(params, "udd", target, gun ,gloante)) return SendClientMessage(playerid, -1, "{C0C0C0}Folosire {FFFFFF}/givegun <playerid> <gun> <gloante>");
if(gun < 1 || gun > 47) return SendClientMessage(playerid, COLOR_GREY, "Armele au ID cuprinse intre 1-47.");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_GREY, "Acel player nu este conectat!");
if(gun == 21 && PlayerInfo[target][pAdminLevel] == 0) return SendClientMessage(playerid,-1,"Nu poti da JetPack la un Player");

if(gun == 21)
{
SetPlayerSpecialAction(target,SPECIAL_ACTION_USEJE TPACK);
}
GivePlayerGun(target, gun, gloante);
//new adminame[MAX_PLAYER_NAME+1], string1[128+MAX_PLAYER_NAME+1],playername[MAX_PLAYER_NAME+1], string2[128+MAX_PLAYER_NAME+1];
//GetPlayerName(playerid, adminame, sizeof(adminame));
//GetPlayerName(target, playername, sizeof(playername));

//format(string1, sizeof(string1), "[Admin] {FFFFFF}Iai dat playerului {F81414}%s {00FFFF}(ID %d) {FFFFFF}arma ID %d cu %d gloante.",playername,target,gun,gloante);
//SendClientMessage(playerid, 0xC0C0C0AA, string1);
//format(string2, sizeof(string2), "[Admin] {FFFFFF}Ai primit {F81414}Arma {FFFFFF}ID %d cu %d gloante de la Admin {F81414}%s",gun,gloante,adminame);
//SendClientMessage(target, 0xC0C0C0AA, string2);
return 1;
}

I try like that and i recive that message " Unknown Command"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)