Raised This Month: $ Target: $400
 0% 

[L4D] Item Buy System


Post New Thread Reply   
 
Thread Tools Display Modes
symbiant
New Member
Join Date: Aug 2009
Old 08-10-2009 , 18:48   Re: [L4D] Item Buy System
Reply With Quote #251

I have been reading this thread and I noticed that people are having issues with points not clearing as intended. I am new with SourcePawn but I have some prior programming experience. After looking around the code and on the internet I think I have an easy way to clear the points that may work.
If you clear the points at the two critical times:

* When a player connects
* When a map loads(but with a check to prevent issues with versus)

then players should never be able to enter a game with points.

To do this, use the public function OnClientPutInServer to run logic when a player connects to the server. When the function is called you should be given their clientID. Just use this to set that new player's points to Zero.

As for clearing points when the map loads, use hook game_newmap to call an action. The action should run a check to see if this is the first round. To do this, there should be a global variable(still not sure if sourcePawn has something like this) that stores the last map the server had loaded. If the variable(lets call it vs_round_map) equals the ConVar host_map then it will not clear players points. This will allow players to keep their points between rounds on the same map. If vs_round_map doesn't equal host_map then every players points will be set to zero and vs_round_ map will be set equal to host_map. This should allow coop and vs play. As for survival, you could add a check to the bool to see if the game is survival and clear points everytime game_newmap hooks. The bool would look something like this:

(vs_round_map != host_map)||(mp_gamemode = survival)
**I know this isn't how it would look but you get the idea

When the above is TRUE then all points are cleared and vs_round_map is set to host_map

Hopefully this works, the logic seems sound to me(not sure since I am still new to sourcePawn)

Thanks for the awesome mod.

PS: sorry for the long post.
symbiant is offline
chaoling
Junior Member
Join Date: Aug 2009
Old 08-11-2009 , 03:55   Re: [L4D] Item Buy System
Reply With Quote #252

*when the infected appear "Normal Menu" is not a menu appears best fit for them?
*in "Special Menu" infecteds not the best place and WHITCH TANK?
*it is possible to embed laser plugin buy?
chaoling is offline
(-DR-)GrammerNatzi
Senior Member
Join Date: Jun 2009
Old 08-11-2009 , 23:18   Re: [L4D] Item Buy System
Reply With Quote #253

Quote:
Originally Posted by LTR.2 View Post
there is an option for infected to create a panic event? that would be great to slow down survivors.
That was in there, but was removed because of how buggy it was.
(-DR-)GrammerNatzi is offline
(-DR-)GrammerNatzi
Senior Member
Join Date: Jun 2009
Old 08-11-2009 , 23:20   Re: [L4D] Item Buy System
Reply With Quote #254

Quote:
Originally Posted by symbiant View Post
I have been reading this thread and I noticed that people are having issues with points not clearing as intended. I am new with SourcePawn but I have some prior programming experience. After looking around the code and on the internet I think I have an easy way to clear the points that may work.
If you clear the points at the two critical times:

* When a player connects
* When a map loads(but with a check to prevent issues with versus)

then players should never be able to enter a game with points.

To do this, use the public function OnClientPutInServer to run logic when a player connects to the server. When the function is called you should be given their clientID. Just use this to set that new player's points to Zero.

As for clearing points when the map loads, use hook game_newmap to call an action. The action should run a check to see if this is the first round. To do this, there should be a global variable(still not sure if sourcePawn has something like this) that stores the last map the server had loaded. If the variable(lets call it vs_round_map) equals the ConVar host_map then it will not clear players points. This will allow players to keep their points between rounds on the same map. If vs_round_map doesn't equal host_map then every players points will be set to zero and vs_round_ map will be set equal to host_map. This should allow coop and vs play. As for survival, you could add a check to the bool to see if the game is survival and clear points everytime game_newmap hooks. The bool would look something like this:

(vs_round_map != host_map)||(mp_gamemode = survival)
**I know this isn't how it would look but you get the idea

When the above is TRUE then all points are cleared and vs_round_map is set to host_map

Hopefully this works, the logic seems sound to me(not sure since I am still new to sourcePawn)

Thanks for the awesome mod.

PS: sorry for the long post.
Thanks, but I already tried clearing points on map load. For some reason it wouldn't work. It probably has to do with the way L4D was coded.
(-DR-)GrammerNatzi is offline
olj
Veteran Member
Join Date: Jun 2009
Old 08-12-2009 , 04:11   Re: [L4D] Item Buy System
Reply With Quote #255

Quote:
Originally Posted by (-DR-)GrammerNatzi View Post
Thanks, but I already tried clearing points on map load. For some reason it wouldn't work. It probably has to do with the way L4D was coded.
game_newmap event didnt work for me when i was trying to clear variables as well.
__________________
olj is offline
gothicdeathvr2
New Member
Join Date: Jul 2009
Old 08-13-2009 , 01:09   Re: [L4D] Item Buy System
Reply With Quote #256

Is there a way to make this COOP only?
gothicdeathvr2 is offline
bioderm
Junior Member
Join Date: May 2009
Old 08-13-2009 , 06:25   Re: [L4D] Item Buy System
Reply With Quote #257

Thx for update.

it works fine over 20slots!
bioderm is offline
symbiant
New Member
Join Date: Aug 2009
Old 08-13-2009 , 15:54   Re: [L4D] Item Buy System
Reply With Quote #258

Quote:
Originally Posted by olj View Post
game_newmap event didnt work for me when i was trying to clear variables as well.
Yeah, I have been focusing on writing the logic for detecting all players when they enter the server and determining if this is the first round or second round of VS. So far things are going OK but the issue I am having is getting the value of ConVar Host_map. I tried using GetConVarString(FindConVar("Host_map"), str_var, sizeof(str_var)) but it just returns a long number instead of the map name. When I get everything to work and have debugged it so their is no errors I will post the full code. If I can find the right hooks then I should be able to get it to work. Right now I believe I am using the event Player_spawn(I am not at my home computer.) This Hooks when a player first spawns on map start. This combined with an array that stores each users last loaded map should work. I am pairing this with a player_disconnect hook(not sure if this is what I am using)that should be able to clear the index used to store a players last played map when they log out. This would prevent anyone getting that players ClientID from receiving their points. I haven't gotten it to work because of the issue getting the map's name. I would love to see that points issue get corrected since it appears to be the only real issue with the script.
symbiant is offline
olj
Veteran Member
Join Date: Jun 2009
Old 08-13-2009 , 17:26   Re: [L4D] Item Buy System
Reply With Quote #259

"player_spawn" event fires every time special infected is spawned from ghost mode. Take this into account. For first spawn checks, better use OnClientPostAdminCheck or OnClientPutInServer. These will run only once per map for given client id (unless he reconnects i believe).
__________________
olj is offline
SwitchView
Junior Member
Join Date: Jul 2009
Old 08-15-2009 , 04:35   Re: [L4D] Item Buy System
Reply With Quote #260

Your give points command do not work, if I type in sm_giveclientpoints it says <#userid|name> [number of points] but if I type sm_giveclientpoints #4 300 it does not work, it says sm_giveclientpoints is a unknown command, how exactly do you use this command?
SwitchView 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 13:13.


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