SA-MP Forums Archive
[Code] Error somewere that I dont get - 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: [Code] Error somewere that I dont get (/showthread.php?tid=361087)



[Code] Error somewere that I dont get - UnknownGamer - 20.07.2012

Код:
	if(strcmp(cmd, "/kickgun", true) ==0)
	{
	    if(PlayerInfo[playerid][pAdmin] >= 1337)
	    {
			if(kickgun[playerid] == 0)
			{
				if(PlayerInfo[playerid][pTazerBullets] != 0)
				{
					SafeGivePlayerWeapon(playerid, 33, 10000);
 					SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1000);
					kickgun[playerid] = 1;
					Kick(playerid);
					format(string, sizeof(string), "* %s Takes out his kickgun.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY,"* No charges in the kickgun!");
				    return 1;
				}
			}
			else
			{
				SafeGivePlayerWeapon(playerid, 24, 10);
				AttachWeaponCorrectly(playerid, 23);
				kickgun[playerid] = 0;
				ClearAnimations(playerid);
				SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, PlayerInfo[playerid][pSilenSkill]);
				format(string, sizeof(string), "* %s Puts his kickgun away.", sendername);
				ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
			}
		}
	    return 1;
	}
When i go in game, it says "No charges in the KickGun" Why is this? It is scripted 100 precent rite?


Re: [Code] Error somewere that I dont get - [KHK]Khalid - 20.07.2012

Let me explain this part of your code (Read comments)
pawn Код:
if(PlayerInfo[playerid][pTazerBullets] != 0) // obviously checks if the player who typed the command has tazer bullets
{
    SafeGivePlayerWeapon(playerid, 33, 10000);
    SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1000);
    kickgun[playerid] = 1;
    Kick(playerid);
    format(string, sizeof(string), "* %s Takes out his kickgun.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
else // if they don't have tazer bullets
{
    // sends the message, "No charges in the kickgun!"
    SendClientMessage(playerid, COLOR_GREY,"* No charges in the kickgun!");
    return 1;
}
So, maybe you didn't have TAZER BULLETS when you typed the command.