AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin not compiling (https://forums.alliedmods.net/showthread.php?t=127479)

SaM.ThE.MaN 05-21-2010 15:50

Plugin not compiling
 
Hi,
I have completely rewritten this plugin , the plugin works and each time i lvl up it says congratulations for lvling up , but when i type /me for it to show me my lvl and XP , it says :
[Leveler] You are level and XP
Here is the code:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <vault>
#include <core>
#include <fun>

#define PLUGIN "Level Plugin"
#define VERSION "0.1"
#define AUTHOR "SaMThEMaN"

new PlayerXP[33]
new 
PlayerLevel[33]

new const 
LEVELS[6] = 
{
    
1
    
2
    
4
    
8,
    
16,
    
32
}

new 
msgtext

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("sv_Leveler""1")
    
register_event("DeathMsg""DeathMsg""a"
    
register_clcmd("say /me""Level")
    
register_clcmd("say_team /me""Level")
    
register_cvar("XP_per_kill""1")
}

public 
Level(id)
{
client_print(idprint_chat"[Leveler] You are level %d and %d XP"PlayerLevel[id], PlayerXP[id])
}

public 
SaveXP(id)
{
    new 
authid[32]; 
    
get_user_authid(id,authid,31); 

    new 
vaultkey[64], vaultdata[64]; 

    
format(vaultkey,63,"Plvl-%s-xp",authid); 
    
format(vaultdata,63,"%d",PlayerXP[id]); 
    
set_vaultdata(vaultkey,vaultdata); 

    
format(vaultkey,63,"Plvl-%s-level",authid); 
    
format(vaultdata,63,"%d",PlayerLevel[id]); 
    
set_vaultdata(vaultkey,vaultdata);


public 
LoadXP(id)
{
    new 
authid[32]; 
    
get_user_authid(id,authid,31); 

    new 
vaultkey[64], vaultdata[64];

    
format(vaultkey,63,"Plvl-%s-xp",authid); 
    
get_vaultdata(vaultkey,vaultdata,63); 
    
PlayerXP[id] = str_to_num(vaultdata);   

    
format(vaultkey,63,"Plvl-%s-level",authid); 
    
get_vaultdata(vaultkey,vaultdata,63);
    
PlayerLevel[id] = str_to_num(vaultdata);  


public 
client_connect(id)
{
    if(
get_cvar_num("SaveXP") == 1) {
       
         
LoadXP(id)

         
client_print(idprint_chat"[Leveler] XP Loaded!")
         
client_print(idprint_chat"[Leveler] You are level %d and %d XP"PlayerLevel[id], PlayerXP[id])
    }
}

public 
client_disconnect(id)
{
    if(
get_cvar_num("SaveXP") == 1) {
    
         
SaveXP(id)
    }
}

public 
DeathMsg()
{
if(
get_cvar_num("sv_Leveler") == 0
{
return 
PLUGIN_HANDLED
}
    new 
attacker read_data(1)

    
PlayerXP[attacker] += get_cvar_num("XP_per_kill")

    if(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
    
PlayerLevel[attacker] += 1

    client_print
(attackerprint_chat"[Leveler] Congratulations! You are now level %d!"PlayerLevel[attacker])
    if(
get_cvar_num("SaveXP") == 1) {
 
             
SaveXP(attacker)
         }
 }  
    return 
PLUGIN_CONTINUE



wrecked_ 05-21-2010 15:52

Re: Plugin not compiling
 
You didn't completely rewrite it... that's the tutorial without the animal names or whatever.

Post the errors.

Brreaker 05-21-2010 16:04

Re: Plugin not compiling
 
http://forums.alliedmods.net/showpos...65&postcount=7

You could read this although...

wrecked_ 05-21-2010 16:18

Re: Plugin not compiling
 
Quote:

Originally Posted by Brreaker (Post 1187110)

You didn't fix all of his issues. You forgot about fixing the health on spawn, PlayerClass, the useless class name const, ...

Brreaker 05-21-2010 16:34

Re: Plugin not compiling
 
I know, it's not 100% fixed, but I think it's better than the original version...-,-

SaM.ThE.MaN 05-21-2010 16:57

Re: Plugin not compiling
 
I fixed it and it works but i still have one problem, i have written it in my first post,
wreked i had another script before , now i made this one , which means i completely change it , u can even take a look.

SaM.ThE.MaN 05-21-2010 17:01

Re: Plugin not compiling
 
ok ill go hit the bet, cya guys tomorrow , help me fix it and the saving thing , it doesnt save and load lol . or perhaps it works only on servers.

Exolent[jNr] 05-21-2010 20:19

Re: Plugin not compiling
 
Learn to use proper % when formatting.
http://www.amxmodx.org/funcwiki.php?go=func&id=49

SaM.ThE.MaN 05-22-2010 03:30

Re: Plugin not compiling
 
Ok its working but , it doesnt save or load, by the way can i release this?

SaM.ThE.MaN 05-22-2010 07:06

Re: Plugin not compiling
 
Ok i got the whole thing fixed ,
I have an issue on the Save and load area :
If i disconnect from the server it saves my score, but , if i close and open the server everything goes away.
So can anyone give me an idea how to save it Permanently and load it.
Thank you


All times are GMT -4. The time now is 03:36.

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