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

[HELP PLS] Surf Levels Update


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
R3pTy
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 08-30-2016 , 14:39   [HELP PLS] Surf Levels Update
Reply With Quote #1

Hi, i and my friend update the plugin and now have some problems.

The plugin is working but my problem is when i change map all XP (points) and levels dont save.
I change the map and when i join it my levels and XP start in 0 again ... :$

i need help to fix it pls.

PHP Code:
/* Include some modules */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <nvault>
#include <fakemeta>
#include <dhudmessage>
#include <colorchat>


/* Who made this bad coded plugin? */
#define PLUGIN    "SURF XP MOD"
#define AUTHOR    "Ardivaba"
#define VERSION    "1.0"

/* Lets define some illegal stuff */
#define TUTORIAL 1001
#define TASK_TUT 1111

/* What is the sound of the message? */
#define MSOUND "items/nvg_off.wav"

enum _:Data
{
_csw[32],
_xp[32],
_model[64]
}
new const 
Stuff[][Data]=
{
"",
{
CSW_KNIFE10"models/PFA/Surf/v_gknife.mdl"},
{
CSW_DEAGLE20"models/PFA/Surf/v_gdeagle.mdl"},
{
CSW_M330"models/PFA/Surf/v_gm3.mdl"},
{
CSW_HEGRENADE40"models/PFA/Surf/v_shegrenade.mdl"},
{
CSW_AK4750"models/PFA/Surf/v_gak47.mdl"},
{
CSW_M4A150"models/PFA/Surf/v_gm4.mdl"},
{
CSW_GLOCK1860"models/PFA/Surf/v_gglock.mdl"},
{
CSW_USP60"models/PFA/Surf/v_gusp.mdl"},
{
CSW_AWP100"models/PFA/Surf/v_gawp.mdl"}
}



/* So many levels...oh my f**in god */
new const LEVELS[200] = { 

10
20,
30
40
50
60,
100
... 


new 
PXP33 ]
new 
PLEVEL33 ]
new 
PKS33 ]
new 
g_vault

new SzMaxPlayersSzSayText  

public plugin_init()
{

//You want credits? Take credits...you stealz0rs
register_plugin(PLUGINVERSIONAUTHOR)

//You poor little guy died, what we gonna do now?
register_event"DeathMsg""EventDeathMsg""a" )

//All kinds of information
register_clcmd"say /pontos""printXp", -1"Print player Xp" )
register_clcmd"say /nivel""printLevel", -1"Print player level" )
register_clcmd"say /proximonivel""printNewLevel", -1"Print player how many xp left to new level" )
register_clcmd"say /ajuda""printHelp", -1"Print help" )
register_clcmd"say /info""printInfo", -1"Print info" )
register_clcmd"say /armas""printWeapons", -1"Print weapon unlocks" )

//Nozoom stuff
register_event("SetFOV","zoom","b","1<90"
register_event("CurWeapon","ev_CurWeapon""be""1=1")

//Meat...mmmm, delicious ham
RegisterHam(Ham_Spawn"player""EventPlayerSpawn"1)
RegisterHam(Ham_TakeDamage"player""fwHamTakeDamage")

//nVault stuff
g_vault nvault_open("SURFXPMOD")

}
public 
plugin_precache() 

    
precache_sound(MSOUND
     
    new 

     
    
for(1sizeof Stuffi++)
    
precache_model(Stuff[i][_model])
     



public 
client_putinserver(id
{
set_task(1.0"surfcyka"id__"b")
}

public 
client_connectid )
{
PXPid ] = 0
LoadData
id )
}

public 
client_disconnectid )
{
SaveDataid )
PXPid ] = 0
PLEVEL
id ] = 0
PKS
id ] = 0
}

public 
EventPlayerSpawnid )
{
new 
health
new newhealth
new money
new newmoney
new armor
new newarmor

money 
cs_get_user_moneyid )
newmoney money + (PLEVELid ] * 100)
cs_set_user_moneyidnewmoney)

if( 
PLEVELid ] <= 25 )
{
health get_user_healthid )
newhealth health + (PLEVELid ])
set_user_healthidnewhealth )
}
else
{
health get_user_healthid )
newhealth 125

armor 
get_user_armorid )
newarmor armor + ((PLEVELid ]) - 25)
set_user_armoridnewarmor )
set_user_healthidnewhealth )
}
}

public 
EventDeathMsg()
{
new 
killer read_data)
new 
victim read_data)
new 
headshot read_data)
new 
xp
new hs

if(PLEVELkiller ] > PLEVELvictim ])
{
xp 4
}

if(
PLEVELkiller ] < PLEVELvictim ])
{
xp 6
}

if(
PLEVELkiller ] == PLEVELvictim ])
{
xp 5
}

PKSvictim ] = 0

if( victim == killer )
{
return 
PLUGIN_CONTINUE
}

if(
headshot)
{
xp xp 5
hs 
1
}

if(
PKSkiller ] < 10)
{
PKSkiller ]++
}

xp xp PKSkiller ]

add_xpkillerxphs )
check_levelkiller )


return 
PLUGIN_HANDLED
}

/* Add xp */
public add_xpidxphs )
{
new 
newlevel LEVELS[PLEVELid ]]-PXPid ]

PXPid ] = PXPid ] + xp

if(hs)
{
set_dhudmessage(10802550.530.2622.09.0 ); 
show_dhudmessage(id"[ www.pFa-Cm.Org ]"); 
set_dhudmessage(1001001000.530.3020.02.0 )
show_dhudmessage(id"HEADSHOT! Ganhaste %d Pontos! ^nMataste %d seguidos^nFaltam %d Pontos para o Proximo Nivel!"xpPKSid ], newlevel
}
else
{
set_dhudmessage(10802550.530.2622.09.0 ); 
show_dhudmessage(id"[ www.pFa-Cm.Org ]"); 
set_dhudmessage(1001001000.530.3020.02.0 )
show_dhudmessage(id"Ganhaste %d Pontos! ^nMataste %d seguidos^nFaltam %d Pontos para o Proximo Nivel!"xpPKSid ], newlevel

}
}

/* Lets check if player got a new level */
public check_levelid )
{
if(
PXPid ] >= LEVELS[PLEVELid ]])
{
PLEVELid ]++
ColorChat(idTEAM_COLOR"^04[ www.pFa-Cm.Org ]^03 O teu Nivel Atual:^01 %d"PLEVELid ])
}
}

/* Lets print the list of weapon achievments */
public printWeaponsid )
{
show_motd(id"surf_armas.txt")
}

public 
SubMenuidiMenuiItem )
{
if( 
iItem == MENU_EXIT )
{
menu_destroyiMenu );
return 
PLUGIN_HANDLED;
}

new 
iAccessiData], iName64 ], iCallBack
menu_item_getinfoiMenuiItemiAccessiDatacharsmaxiData ), iNamecharsmaxiName ), iCallBack ); 

new 
iKey str_to_numiData );

switch( 
iKey )
{
case 
1
{    
}
case 
2
{
}
case 
3:    
{
}
case 
4:    
{
}

}    
menu_destroyiMenu );
return 
PLUGIN_HANDLED;
}
public 
printHelpid )
{
show_motd(id"surf_ajuda.txt")
}

/* Plugin information */
public printInfoid )
{
show_motd(id"surf_info.txt")
}

public 
surfcyka(id)
{
new 
newlevel LEVELS[PLEVELid ]]-PXPid ]
ColorChat(idTEAM_COLOR"^04[ www.pFa-Cm.Org ]^03 Nivel:^x01 %d.^x03 Proximo Nivel:^01 %d.^03 Pontos:^01 %d"PLEVELid ], newlevelPXPid ])
}

/* Lets print players ammount of xp */
public printXpid )
{
ColorChat(idTEAM_COLOR"^04[ www.pFa-Cm.Org ]^03 Os teus Pontos Atuais:^01 %d"PXPid ]) 
}

/* Lets print when player get's new level */
public printNewLevelid )
{
new 
newlevel LEVELS[PLEVELid ]]-PXPid ]
ColorChat(idTEAM_COLOR"^04[ www.pFa-Cm.Org ]^03 Pontos para o Proximo Nivel:^01 %d"newlevel
}

/* Lets print players level */
public printLevelid )
{
ColorChat(idTEAM_COLOR"^04[ www.pFa-Cm.Org ]^03 O teu Nivel Atual:^01 %d"PLEVELid ]) 
}

/* Save Data to nVault */
public SaveData(id)
{
new 
AuthID[35]
get_user_name(id,AuthID,34)

new 
vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-Mod",AuthID)
format(vaultdata,255,"%i#%i#",PXP[id],PLEVEL[id])
nvault_set(g_vault,vaultkey,vaultdata)
return 
PLUGIN_CONTINUE
}

/* Load Data  from nVault */
public LoadData(id)
{
new 
AuthID[35]
get_user_name(id,AuthID,34)

new 
vaultkey[64],vaultdata[256]
format(vaultkey,63,"%s-Mod",AuthID)
format(vaultdata,255,"%i#%i#",PXP[id],PLEVEL[id])
nvault_get(g_vault,vaultkey,vaultdata,255)

replace_all(vaultdata255"#"" ")

new 
playerxp[32], playerlevel[32]

parse(vaultdataplayerxp31playerlevel31)

PXP[id] = str_to_num(playerxp)
PLEVEL[id] = str_to_num(playerlevel)

return 
PLUGIN_CONTINUE
}


/* Golden Weapons */

public ev_CurWeapon(id

    if(!
is_user_connected(id) || !is_user_alive(id))  
    { 
        return 
PLUGIN_HANDLED
    } 
    new 
Weapon_Id read_data(2
     
    for(new 
1sizeof Stuffi++)
    {
        if(
Weapon_Id == Stuff[i][_csw] && PLEVEL[id] >= Stuff[i][_xp])
        
set_pev(idpev_viewmodel2Stuff[i][_model])
         
    }
    return 
PLUGIN_CONTINUE

public 
fwHamTakeDamage(victiminflictorattackerFloat:damagedamagebits

    for(new 
1sizeof Stuffi++)
    {
        if(
get_user_weapon(attacker) == Stuff[i][_csw] && PLEVELattacker ] >= Stuff[i][_xp])
        {
            
SetHamParamFloat(4damage 2.0)
            return 
HAM_HANDLED
        
}
    }
    
    return 
HAM_IGNORED  

__________________

Last edited by R3pTy; 08-30-2016 at 16:41.
R3pTy is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 08-31-2016 , 05:51   Re: [HELP PLS] Surf Levels Update
Reply With Quote #2

That plugin is awful, and needs to be remade. I suggest using fVault, its faster and simpler to use than nVault

Anyways, try this:
PHP Code:
public client_connect(id)
LoadData(id)

public 
client_disconnect(id)
SaveData(id

Also, you are saving player data by NAME, which means, anyone can use that NAME and have the XP/LEVELS...

(como é que é possível a PFA já existir à tantos anos e mesmo assim não perceberem patavina de amxx...)
Syturi0 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-31-2016 , 06:07   Re: [HELP PLS] Surf Levels Update
Reply With Quote #3

Quote:
its faster than nVault
I would like to hear your arguments for that. Don't spread misinformation.
__________________

Last edited by HamletEagle; 08-31-2016 at 06:08.
HamletEagle is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 08-31-2016 , 07:11   Re: [HELP PLS] Surf Levels Update
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
I would like to hear your arguments for that. Don't spread misinformation.
Quote:
its faster and simpler to use than nVault
Syturi0 is offline
R3pTy
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 08-31-2016 , 11:33   Re: [HELP PLS] Surf Levels Update
Reply With Quote #5

Quote:
Originally Posted by Syturi0 View Post
(como é que é possível a PFA já existir à tantos anos e mesmo assim não perceberem patavina de amxx...)
(pq talvez nunca e o msm cfg a configurar aquilo)
__________________
R3pTy is offline
R3pTy
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 09-05-2016 , 13:46   Re: [HELP PLS] Surf Levels Update
Reply With Quote #6

what is the best sistem for save the EXP and Points here?
what we can do for put this saving EXP and Points with IP player?
if is the best anyway to do this.
__________________
R3pTy is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 09-05-2016 , 13:54   Re: [HELP PLS] Surf Levels Update
Reply With Quote #7

Quote:
Originally Posted by R3pTy View Post
what is the best sistem for save the EXP and Points here?
what we can do for put this saving EXP and Points with IP player?
if is the best anyway to do this.
The best would be SQL.
The easiest is fVault.

Saving by IP is an extremely bad method for obvious reasons, just do it by SteamID or Login+Password.
Syturi0 is offline
R3pTy
Senior Member
Join Date: Jul 2014
Location: Portugal
Old 09-06-2016 , 11:29   Re: [HELP PLS] Surf Levels Update
Reply With Quote #8

can someone add SQL on this plugin ?
__________________
R3pTy is offline
james 007
Member
Join Date: Dec 2014
Location: Portugal
Old 09-20-2016 , 14:57   Re: [HELP PLS] Surf Levels Update
Reply With Quote #9

Want to Help it speaks steam
james 007 is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-21-2016 , 02:01   Re: [HELP PLS] Surf Levels Update
Reply With Quote #10

The most easiest and faster is nvault and that's all

R3pty, i recommand you to download Nvault Editor and check your vault file to see how the keys are stored( or if they are stored ... )
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
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 03:28.


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