Raised This Month: $ Target: $400
 0% 

Get Players Money at Disconnect throws error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-07-2013 , 06:54   Re: Get Players Money at Disconnect throws error
Reply With Quote #1

In the above stock, it misses a "return" before "get_pdata_int".
__________________
Arkshine is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 05-07-2013 , 09:15   Re: Get Players Money at Disconnect throws error
Reply With Quote #2

@Kia, stock updated https://forums.alliedmods.net/showpo...8&postcount=19
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 05-09-2013 , 11:32   Re: Get Players Money at Disconnect throws error
Reply With Quote #3

I:\AMXXdev\PStudio\temp833.sma(2 : error 078: function uses both "return" and "return <value>"
__________________
Kia is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-09-2013 , 12:25   Re: Get Players Money at Disconnect throws error
Reply With Quote #4

You seriously couldn't figure this out by yourself?

Code:
#include <amxmodx> #include <fakemeta> const PDATA_SAFE = 2 const OFFSET_CSMONEY = 115 const ERROR_PEV_INVALID = -15 fm_cs_get_user_money(id) {     if(pev_valid(id) != PDATA_SAFE) return ERROR_PEV_INVALID;     return get_pdata_int(id, OFFSET_CSMONEY); }   //... new iMoney = fm_cs_get_user_money( id ) if( iMoney != ERROR_PEV_INVALID ) {    // ... }
Backstabnoob is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 05-09-2013 , 14:06   AW: Get Players Money at Disconnect throws error
Reply With Quote #5

Tested it, players still report money lost.
__________________
Kia is offline
fl0werD
Senior Member
Join Date: May 2011
Old 05-09-2013 , 14:24   Re: Get Players Money at Disconnect throws error
Reply With Quote #6

register_forward( FM_ClientDisconnect, "FM_Hook_ClientDisconnect_Pre", ._post = 0 )
fl0werD is offline
Send a message via ICQ to fl0werD
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 05-09-2013 , 14:27   AW: Get Players Money at Disconnect throws error
Reply With Quote #7

I'll try that asap and report.
__________________
Kia is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 05-09-2013 , 14:33   Re: Get Players Money at Disconnect throws error
Reply With Quote #8

I try and it report true result:
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "0.0.1"
#define AUTHOR "wbyokomo"

const PDATA_SAFE 2
const OFFSET_CSMONEY 115

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

public 
client_disconnect(id)
{
    
server_print("[MONEY] Player [%i] has [%i] $"idfm_cs_get_user_money(id))
}

fm_cs_get_user_money(id)
{
    if(
pev_valid(id) != PDATA_SAFE) return -1
    
    
return get_pdata_int(idOFFSET_CSMONEY);

Console print:
Code:
[MONEY] Player [1] has [11670] $
Dropped Bruce_Lee from server
Reason:  Kicked
[MONEY] Player [7] has [16000] $
Dropped [MY]wakoduqduq from server
Reason:  Client sent 'drop'
Not sure what is your error.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 05-09-2013 , 14:40   AW: Get Players Money at Disconnect throws error
Reply With Quote #9

Can it be the saving part from NVault? It's in my Simple Vault Bank somewhere in Nee Plugins Section.
__________________
Kia is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 05-13-2013 , 04:51   Re: Get Players Money at Disconnect throws error
Reply With Quote #10

Quote:
Originally Posted by Kia View Post
Tried this, but now all players have $0 when they connect.
It seems you mixed something. What is the suppose of your plugin?

I guess you want to store players money on disconnect to give them the amount of money back on a (re)connect. So the wrong part isn't on the side of the save. Provide us more information about your code especially about the save/load (get/set) procedure.

The code I've send to you via PM works perfectly, so you miss something somewhere else :p
__________________
  • ZapTic - Paintball (Version 7.1.3 b1303)
  • Your #1 CS Paintball Server since 2008
  • 85.131.163.101:27015
Leon M. 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 10:52.


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