SA-MP Forums Archive
Giveweapon command filterscript errors - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Giveweapon command filterscript errors (/showthread.php?tid=260251)



Giveweapon command filterscript errors - Nathan_Strider - 08.06.2011

Script:
Код:
public COMMAND:giveweapon(playerid, params[])
{
	new id;
	new weap;
	new ammo;
	if(IsPlayerConnected(id))
		{
		if(PlayerInfo[playerid] [AdminLevel] >= 106)
			{
			if(!sscanf(params, "uii", id, weap, ammo))
				{
				if(weap >= 1 && weap <= 46)
								{
									if(ammo >= 1 && ammo <= 5000)
									{
									
									
						new string[64];
						new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
						GetPlayerName(playerid, name, sizeof(name));
						GetPlayerName(id, PlayerName, sizeof(PlayerName));
						format(string, sizeof(string), "%s has given You weapon %d with %d ammu.", name, weap, ammo);
						SendClientMessage(id, 0xFF00CC, string);
						format(string, sizeof(string), "You gave weapon %d with %d ammu to %s .", weap, ammo, PlayerName);
						SendClientMessage(playerid, 0xFF00CC, string);
						GivePlayerWeapon(id, weap, ammo);
						return 1;
					}
					else return SendClientMessage(playerid, 0xFF00CC, "Max. Ammo is 5000");
				}
				else return SendClientMessage(playerid, 0xFF00CC, "Invalid weapon id!");
	else {
			SendClientMessage(playerid, 0xFF00CC, "USAGE: /giveweapon[PlayerId/PartOfName] [WeaponId] [Ammo]"),
			SendClientMessage(playerid, 0xFF00CC, "1(Brass) 2(Nite) 3(Club) 4(knife) 5(bat) 6(Shovel) 7(Cue) 8(Katana) 9(Chainsaw) 10-13(Dildo)"),
			SendClientMessage(playerid, 0xFF00CC, "14(Flowers) 15(Cane) 16(Grenades) 17(Teargas) 18(Molotovs) 22(Pistol) 23(SPistol) 24(Eagle)"),
			SendClientMessage(playerid, 0xFF00CC, "25(Shotgun) 26(sawn-off) 27(Combat) 28(TEC9) 29(MP5) 30(AK47) 31(M4) 32(MAC10) 33(Country)"),
			return SendClientMessage(playerid, 0xFF00CC, "34(Sniper) 35(RPG) 37(Flamethrower) 38(Minigun) 41(spray) 42(exting) 43(Camera) 46(Parachute)");
		}
		else return SendClientMessage(playerid, 0xFF00CC, "You are not allowed to use this command.");
	}
	else return SendClientMessage(playerid, 0xFF00CC, "Player Is Not Connected");
}
errors:
Код:
C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(3) : warning 235: public function lacks forward declaration (symbol "giveweapon")
C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(3 -- 6) : error 017: undefined symbol "IsPlayerConnected"
C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(3 -- 8) : error 017: undefined symbol "PlayerInfo"
C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(8) : warning 215: expression has no effect
C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(8) : error 001: expected token: ";", but found "]"
C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(8) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Help me please thank you.


Re: Giveweapon command filterscript errors - TheGarfield - 08.06.2011

pawn Код:
COMMAND:giveweapon(playerid, params[])
{
    new id;
    new weap;
    new ammo;
    if(IsPlayerConnected(id))
        {
        if(PlayerInfo[playerid] [AdminLevel] >= 106)
            {
            if(!sscanf(params, "uii", id, weap, ammo))
                {
                if(weap >= 1 && weap <= 46)
                                {
                                    if(ammo >= 1 && ammo <= 5000)
                                    {
                                   
                                   
                        new string[64];
                        new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, name, sizeof(name));
                        GetPlayerName(id, PlayerName, sizeof(PlayerName));
                        format(string, sizeof(string), "%s has given You weapon %d with %d ammu.", name, weap, ammo);
                        SendClientMessage(id, 0xFF00CC, string);
                        format(string, sizeof(string), "You gave weapon %d with %d ammu to %s .", weap, ammo, PlayerName);
                        SendClientMessage(playerid, 0xFF00CC, string);
                        GivePlayerWeapon(id, weap, ammo);
                        return 1;
                    }
                    else return SendClientMessage(playerid, 0xFF00CC, "Max. Ammo is 5000");
                }
                else return SendClientMessage(playerid, 0xFF00CC, "Invalid weapon id!");
    else {
            SendClientMessage(playerid, 0xFF00CC, "USAGE: /giveweapon[PlayerId/PartOfName] [WeaponId] [Ammo]"),
            SendClientMessage(playerid, 0xFF00CC, "1(Brass) 2(Nite) 3(Club) 4(knife) 5(bat) 6(Shovel) 7(Cue) 8(Katana) 9(Chainsaw) 10-13(Dildo)"),
            SendClientMessage(playerid, 0xFF00CC, "14(Flowers) 15(Cane) 16(Grenades) 17(Teargas) 18(Molotovs) 22(Pistol) 23(SPistol) 24(Eagle)"),
            SendClientMessage(playerid, 0xFF00CC, "25(Shotgun) 26(sawn-off) 27(Combat) 28(TEC9) 29(MP5) 30(AK47) 31(M4) 32(MAC10) 33(Country)"),
            return SendClientMessage(playerid, 0xFF00CC, "34(Sniper) 35(RPG) 37(Flamethrower) 38(Minigun) 41(spray) 42(exting) 43(Camera) 46(Parachute)");
        }
        else return SendClientMessage(playerid, 0xFF00CC, "You are not allowed to use this command.");
    }
    else return SendClientMessage(playerid, 0xFF00CC, "Player Is Not Connected");
}



Re: Giveweapon command filterscript errors - Nathan_Strider - 08.06.2011

Quote:

C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(3) : warning 203: symbol is never used: "giveweapon"
C:\Users\Owner\Desktop\Raven's Roleplay 0.3c\filterscripts\Giveweapon.pwn(3 -- 43) : error 013: no entry point (no public functions)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

and i did everything you did.


Re: Giveweapon command filterscript errors - Gertin - 08.06.2011

Delete in top of new giveweapon;


Re: Giveweapon command filterscript errors - Nathan_Strider - 08.06.2011

could you show me an example please im really new at scripting, please help me.