RemovePlayerWeapon
#1

I saw this function being mentioned on the forum a few times

RemovePlayerWeapon(playerid,gunid)

but when i try and use it in my script i get this error

error 017: undefined symbol "RemovePlayerWeapon"

i know that means its not defined but when i define it what do i put?
Reply
#2

pawn Код:
ResetPlayerWeapons(playerid);
Cheers!
Reply
#3

Quote:
Originally Posted by Jeffry
pawn Код:
ResetPlayerWeapons(playerid);
Cheers!
i know but i have wrote in another post that ResetPlayerWeapons(playerid); just simply dosent work it just dosent i have tryed everything and i thought i had solved the problem when i read about this function but i cant get this function to work ether i will post my duty and quit duty script now

pawn Код:
if (strcmp("/duty", cmdtext, true, 10) == 0)
    {
if((wanted) == 1)
      {
      police = 0;
      SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are wanted so you cant be a cop");
      return 1;
    }

if((police) == 0)
      {
        police = 1;
        SetJob(1,playerid);
        GivePlayerWeapon(playerid, 3, 0);
        GivePlayerWeapon(playerid, 24, 500);
        GivePlayerWeapon(playerid, 17, 10);
        SetPlayerColor(playerid,COLOR_LIGHTBLUE);
        SetPlayerSkin(playerid,280,284);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on duty");
        }
else
        {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are all ready on duty");
        }
return 1;
    }
if (strcmp("/quitduty", cmdtext, true, 10) == 0)
  {

  if((police) == 1)

    {
    police = 0;
    RemovePlayerWeapon(playerid,gunid);
    SetJob(0,playerid);
    SetPlayerSkin( playerid, Skin[ playerid ] );
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are off duty");
    SetPlayerColor(playerid, COLOR_WHITE);
   
     }

     else
    {
   SendClientMessage(playerid, COLOR_LIGHTBLUE, "You arent on duty!");
   }
  return 1;
}
return 0;
   }
Reply
#4

I found this in Useful Functions topic...

Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
	new plyWeapons[12]
	new plyAmmo[12]

	for(new slot = 0; slot != 12; slot++)
	{
		new wep, ammo
		GetPlayerWeaponData(playerid, slot, wep, ammo)
		
		if(wep != weaponid)
		{
			GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot])
		}
	}
	
	ResetPlayerWeapons(playerid)
	for(new slot = 0; slot != 12; slot++)
	{
		GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot])
	}
}
Reply
#5

Quote:
Originally Posted by HeGe
I found this in Useful Functions topic...

Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
	new plyWeapons[12]
	new plyAmmo[12]

	for(new slot = 0; slot != 12; slot++)
	{
		new wep, ammo
		GetPlayerWeaponData(playerid, slot, wep, ammo)
		
		if(wep != weaponid)
		{
			GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot])
		}
	}
	
	ResetPlayerWeapons(playerid)
	for(new slot = 0; slot != 12; slot++)
	{
		GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot])
	}
}
do i just put that at the bottem of the script?
Reply
#6

Quote:
Originally Posted by HeGe
I found this in Useful Functions topic...

Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
	new plyWeapons[12]
	new plyAmmo[12]

	for(new slot = 0; slot != 12; slot++)
	{
		new wep, ammo
		GetPlayerWeaponData(playerid, slot, wep, ammo)
		
		if(wep != weaponid)
		{
			GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot])
		}
	}
	
	ResetPlayerWeapons(playerid)
	for(new slot = 0; slot != 12; slot++)
	{
		GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot])
	}
}
i put this at the bottem of my script and i got this error
Quote:

warning 202: number of arguments does not match definition
error 001: expected token: ";", but found "new"
error 001: expected token: ";", but found "for"
error 001: expected token: ";", but found "-identifier-"
error 001: expected token: ";", but found "if"
expected token: ";", but found "}"
expected token: ";", but found "for"
error 001: expected token: ";", but found "}"

Reply
#7

Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
	new plyWeapons[12];
	new plyAmmo[12];

	for(new slot = 0; slot != 12; slot++)
	{
		new wep, ammo;
		GetPlayerWeaponData(playerid, slot, wep, ammo);
		
		if(wep != weaponid)
		{
			GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
		}
	}
	
	ResetPlayerWeapons(playerid);
	for(new slot = 0; slot != 12; slot++)
	{
		GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
	}
}
try this
Reply
#8

Quote:
Originally Posted by HeGe
Код:
stock RemovePlayerWeapon(playerid, weaponid)
{
	new plyWeapons[12];
	new plyAmmo[12];

	for(new slot = 0; slot != 12; slot++)
	{
		new wep, ammo;
		GetPlayerWeaponData(playerid, slot, wep, ammo);
		
		if(wep != weaponid)
		{
			GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
		}
	}
	
	ResetPlayerWeapons(playerid);
	for(new slot = 0; slot != 12; slot++)
	{
		GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
	}
}
try this
thanks didnt get a compile error but when i type /quitduty instead of removeing the player weapon it times the amo by 3 :S which i dont get here is my offduty command now

pawn Код:
if (strcmp("/quitduty", cmdtext, true, 10) == 0)
  {

  if((police) == 1)

    {
    police = 0;
    RemovePlayerWeapon(playerid, 3);
    SetJob(0,playerid);
    SetPlayerSkin( playerid, Skin[ playerid ] );
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are off duty");
    SetPlayerColor(playerid, COLOR_WHITE);
   
     }

     else
    {
   SendClientMessage(playerid, COLOR_LIGHTBLUE, "You arent on duty!");
   }
  return 1;
}
Reply
#9

then just put ResetPlayerWeapons(playerid); in your command...
Reply
#10

Quote:
Originally Posted by HeGe
then just put ResetPlayerWeapons(playerid); in your command...
but as i said befor that just dosent work and i have no idea why the weapons arent removed from the player at all
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)