AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Adding bpammo for each weapon differently (https://forums.alliedmods.net/showthread.php?t=76255)

Fawkes37 08-21-2008 07:08

Adding bpammo for each weapon differently
 
hello

in the beginning i would say im a newb and havent even learned Pawn or any other codings because im more into mapping and other stuff, but i need this plugin to get done for my server.
ok, im using biohazard and a plugin which would set different bpammo for every weapon would be very nice. so i searched, found some code and tried to do something of my own. but failed misrably.

1) when compiling it says
error 088: number of arguement does not match definition (line 15)
2) heck, i dont even know if it would work.

so thats why i would ask your help again. here's my code (im just trying to set deagle's bpammo at first, and then adding all the others if it works):

Code:

#include <amxmodx>
#include <cstrike>
#include <engine>
public plugin_init()
{
 register_plugin("Bio_bpammo", "0.1", "fawk3s");
 register_event("CurWeapon", "event_currentweapon", "be", "1=1");
}
public event_currentweapon(id)
{
 if(get_user_weapon(id) == CSW_DEAGLE)
 {
  cs_set_user_bpammo(id, 200);
 }
}


jim_yang 08-21-2008 07:26

Re: Adding bpammo for each weapon differently
 
to call a function, you need to follow the prototype
cs_set_user_bpammo ( index, weapon, amount )

Fawkes37 08-21-2008 07:39

Re: Adding bpammo for each weapon differently
 
Quote:

Originally Posted by jim_yang (Post 673148)
to call a function, you need to follow the prototype
cs_set_user_bpammo ( index, weapon, amount )

ok i made it
cs_set_user_bpammo (id, CSW_DEAGLE, 200) //was that what i was supposed to do?

since it compiled now, is there a chance it will work or there isnt a point in trying ?

sorry for my noobish coding, thanks in advance

jim_yang 08-21-2008 07:41

Re: Adding bpammo for each weapon differently
 
weapon should be the weaponid stuff begin CSW_
cs_set_user_bpammo(id, CSW_AK47, 90)

Fawkes37 08-21-2008 07:43

Re: Adding bpammo for each weapon differently
 
Quote:

Originally Posted by jim_yang (Post 673155)
weapon should be the weaponid stuff begin CSW_
cs_set_user_bpammo(id, CSW_AK47, 90)

heh seems like i edited too late :D
my idiotic brain figured it out
so would it work or there isnt a point in trying ?

thx in advance

EDIT: is there a difference between

Code:

public event_currentweapon(id)
{
 if(get_user_weapon(id) == CSW_DEAGLE)
 {
  cs_set_user_bpammo(id, CSW_DEAGLE, 200);
 }
}

and

Code:

public event_currentweapon(id)
{
 cs_set_user_bpammo(id, CSW_DEAGLE, 200);
}


jim_yang 08-21-2008 07:54

Re: Adding bpammo for each weapon differently
 
you don't need to check the current weapon to set its bpammo

Fawkes37 08-21-2008 08:56

Re: Adding bpammo for each weapon differently
 
Quote:

Originally Posted by jim_yang (Post 673160)
you don't need to check the current weapon to set its bpammo

well now i tried, it sets the ammo, but it doesnt do what i want it to do:
whenever i reload, the ammo needed to reload has to go off the bpammo.
but this plugin sets it to whatever i want to and keeps it that way. how to fix it?


All times are GMT -4. The time now is 03:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.