Raised This Month: $51 Target: $400
 12% 

Scripting Help


Post New Thread Reply   
 
Thread Tools Display Modes
Mortdredd
Senior Member
Join Date: Dec 2009
Old 01-30-2010 , 18:09   Re: Scripting Help
Reply With Quote #11

Quote:
Originally Posted by noodleboy347 View Post
You're using ADMFLAG_CUSTOM4, which is r, not o. For o use ADMFLAG_CUSTOM1.
Changed that, still not doing anything.
Mortdredd is offline
Mortdredd
Senior Member
Join Date: Dec 2009
Old 01-31-2010 , 15:45   Re: Scripting Help
Reply With Quote #12

changed the admin flag and took out alot of the stuff that seemed to be pointless and it still does nothing for anyone. compiles fine but nothing on the server. dont think its the cvar as it only needs the 1 about the version as far as i can tell. can anyone point me in the correct direction?

Last edited by Mortdredd; 02-03-2010 at 16:59.
Mortdredd is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 01-31-2010 , 19:38   Re: Scripting Help
Reply With Quote #13

Does Event_PlayerSpawn need to be hooked?
__________________
M249-M4A1 is offline
Mortdredd
Senior Member
Join Date: Dec 2009
Old 02-01-2010 , 08:52   Re: Scripting Help
Reply With Quote #14

Quote:
Originally Posted by M249-M4A1 View Post
Does Event_PlayerSpawn need to be hooked?
possibly, i know next to nothing about the proper way to code pawn. i looked at the metal regen script by darthninja to try and work out how to get this to work for the admins. Given the original version of this code requires the admin to activate it via a command on the admin menu i was wondering if that was the problem

I've just taken another look at his code and he does have it, my bad. have added it and uploaded it to my server, will test it later

Last edited by Mortdredd; 02-01-2010 at 09:15. Reason: n00b mistake
Mortdredd is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 02-01-2010 , 11:26   Re: Scripting Help
Reply With Quote #15

I completely missed this part before:

Code:
public Action:g_tmrGiveAmmo_TimerTick(Handle:timer) {     new intPlayerIndex = 1;     {         // if the client is set to have unlimited ammo, give it to them         if( g_enuPlayerAmmo[intPlayerIndex] == enuPlayerAmmoType_Unlimited )         GiveFullAmmo(intPlayerIndex);     } }

it seems that you are defining the player index to give ammo to as index 1, so player index 1 will ALWAYS get full ammo. you might not be player index 1 in the game so you should do a loop through all players, setting their indicies to unlimited ammo, rather than hardcoding just 1. give that a try.

id also recommend doing a PrintToAllChat("timer running") message in each of the functions (with different text), so that you can see if its even being called or not
__________________
M249-M4A1 is offline
Mortdredd
Senior Member
Join Date: Dec 2009
Old 02-02-2010 , 05:52   Re: Scripting Help
Reply With Quote #16

Quote:
Originally Posted by M249-M4A1 View Post
I completely missed this part before:

Code:
public Action:g_tmrGiveAmmo_TimerTick(Handle:timer) { &nbsp;&nbsp;&nbsp;&nbsp;new intPlayerIndex = 1;
&nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;// if the client is set to have unlimited ammo, give it to them &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;if( g_enuPlayerAmmo[intPlayerIndex] == enuPlayerAmmoType_Unlimited ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;GiveFullAmmo(intPlayerIndex);
&nbsp;&nbsp;&nbsp;&nbsp;} }



it seems that you are defining the player index to give ammo to as index 1, so player index 1 will ALWAYS get full ammo. you might not be player index 1 in the game so you should do a loop through all players, setting their indicies to unlimited ammo, rather than hardcoding just 1. give that a try.

id also recommend doing a PrintToAllChat("timer running") message in each of the functions (with different text), so that you can see if its even being called or not

the originalcontained this bit of code

//********************************************* *************************************
//* Name: Initialize Player List
//* Abstract: set all the players to have normal ammo management
//********************************************* *************************************
public InitializePlayerList()
{
new intPlayerIndex = 0;

//go through each player spot and set them to normal ammo type (they get nothing special)
for (intPlayerIndex = 1; intPlayerIndex <= MAXPLAYERS; intPlayerIndex += 1)
{
g_enuPlayerAmmo[intPlayerIndex] = enuPlayerAmmoType_Normal;
}

}
would that do what you are talking about?
Mortdredd is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 02-02-2010 , 17:44   Re: Scripting Help
Reply With Quote #17

yes, because intPlayerIndex will change in the for loop, and assign each index 1 through MAXPLAYERS to unlimited ammo.

to clarify, each player is assigned an index number 1 to max players. if there are 32 players, there will be indicies 1-32. the FOR loop will assign intPlayerIndex (which starts at 1) to player index 1, then intPlayerIndex changes to 2, assigns to player 2, changes to 3, assigns to 3 etc.

what you had before only assigned player index 1 unlimited ammo
__________________
M249-M4A1 is offline
Mortdredd
Senior Member
Join Date: Dec 2009
Old 02-03-2010 , 01:16   Re: Scripting Help
Reply With Quote #18

I've been playing around with it and i think its working (kinda)

Explination:
the ppl on my server with the 'o' flag report that there weapons now auto reload the second they use a shell/rocket/nade etc etc. so i think timer instructing it to refill ammo is working, its just working on the wrong clip and taking the ammo from the reserve clip, now just got to work out how to alter that still not doing anythin for the guns with no secondary clip tho

Think im gonna take another look at the original again

Last edited by Mortdredd; 02-03-2010 at 03:16.
Mortdredd is offline
Mortdredd
Senior Member
Join Date: Dec 2009
Old 02-03-2010 , 16:59   Re: Scripting Help
Reply With Quote #19

ok, i've gone back to the begining with this, and done it properly this time with saves of each different version changelog etc and i am close to cracking it, hope you guys can help me that final mile.

Attatched is version 0.3 the main function i am after works in this version (unlimited ammo via regenerating ammo in the secondary clip) however to start it you still have to call it from the admin/player menu.

Could some one please provide some insight as to how i make this happen automatically when a player with the 'o' flag joins the game?
Attached Files
File Type: sp Get Plugin or Get Source (UnlimitedAmmo0.3.sp - 245 views - 16.7 KB)
Mortdredd is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:30.


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