Raised This Month: $ Target: $400
 0% 

Set negative frag/score


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 02-01-2013 , 08:59   Set negative frag/score
Reply With Quote #1

Setting negative score/frag to the player just won't work with either set_user_frags or Ham_AddPoints way.

Doing it with Ham_AddPoints sets the player's score back to 0 (using a plugin which force the score to not go to a negative value), doesn't matter how high score the player had. And without checking the user frags, it crash the server instantly when the event gets called.
Code:
#include <amxmodx> #include <fun> #include <hamsandwich> new g_maxplayers #define IsPlayer(%1) (1 <= %1 <= g_maxplayers) public plugin_init() {     register_event("TextMsg", "HookHostageKilled", "b", "2&#Killed_Hostage")     g_maxplayers = get_maxplayers() } public HookHostageKilled(id) {     if(IsPlayer(id))     { //      ExecuteHamB(Ham_AddPoints, id, -2, true) // server crash instantly         // The killer/player's score is set to 0 even if the killer/player have 2+ score         if(get_user_frags(id) >= 2)             ExecuteHamB(Ham_AddPoints, id, -2, true)         else if(get_user_frags(id) == 1)             ExecuteHamB(Ham_AddPoints, id, -1, true)     } }

Last edited by Rirre; 02-01-2013 at 16:15.
Rirre is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-01-2013 , 09:19   Re: Set negative frag/score
Reply With Quote #2

PHP Code:
set_user_frags(idget_user_frags(id) -3
It works for me.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-01-2013 , 10:45   Re: Set negative frag/score
Reply With Quote #3

Last argument of AddPoints is bool:bAllowNegativeScore, so if you set it to false, it's normal it doesn't work, you have to set it to true.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 02-01-2013 , 16:02   Re: Set negative frag/score
Reply With Quote #4

Messed around with false and true to see if it even worked to give the player score, forgot to mention that.
That's why it is at "false" now.
Still crashing with "true".
Rirre is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-01-2013 , 16:47   Re: Set negative frag/score
Reply With Quote #5

Tried ExecuteHamB(Ham_AddPoints, id, -2, true) and it works fine.
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

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 20:38.


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