Raised This Month: $165 Target: $400
 41% 

I try to make mod with xp.


Post New Thread Reply   
 
Thread Tools Display Modes
dekken
Veteran Member
Join Date: Jul 2007
Old 06-05-2008 , 18:53   Re: I try to make mod with xp.
Reply With Quote #21

iam confused
post you full sma code
and tell me whats wrong?
__________________
Signature Goes Here
dekken is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 06-05-2008 , 19:38   Re: I try to make mod with xp.
Reply With Quote #22

Quote:
wow , thanks for a help dekken . And could someone tell me how to add one weapon model on one of classes because i have one weapon model how can I set that model , example cs_set_playerclass "modelname.mdl" . ?? I know that I must precache that model , but how to set on one of class and that model have all time ... Thanks . Ops , appeared error > http://img84.**************/my.php?image=errorux9.jpg
ok here is .sma
Attached Files
File Type: sma Get Plugin or Get Source (BetaModtest1.sma - 300 views - 7.6 KB)
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.

Last edited by Fry!; 06-05-2008 at 19:42.
Fry! is offline
dekken
Veteran Member
Join Date: Jul 2007
Old 06-05-2008 , 19:59   Re: I try to make mod with xp.
Reply With Quote #23

well For The MESSAGE BLABLA thingy
you tried to send iPlayer as an index in fwHamPlayerSpawnPost Function
i guess you cant do it..

You got Here pretty much simple Tut on how to change Weapon Models:
http://forums.alliedmods.net/showthr...t=Weapon+model

Here's the code with one weapon Changed for the Soldier.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>

#define MAXCLASSES 6
#define MAXLEVELS 10

#define MAX_HEALTH 570
#define MAX_ARMOR 450

#define PLUGIN "BetaMod"
#define VERSION "0.0.1"
#define AUTHOR "The_Thing"


new VIEW_MODEL[]        = "models/test/v_m4a1.mdl" 
new WORLD_MODEL[]    = "models/test/w_m4a1.mdl"
new OLDWORLD_MODEL[]    = "models/w_m4a1.mdl"

enum
{
    
PLAYERLEVEL_1,
    
PLAYERLEVEL_2,
    
PLAYERLEVEL_3,
    
PLAYERLEVEL_4,
    
PLAYERLEVEL_5,
    
PLAYERLEVEL_6,
    
PLAYERLEVEL_7,
    
PLAYERLEVEL_8,
    
PLAYERLEVEL_9,
    
PLAYERLEVEL_10

}

enum
{
    
CLASS_NONE 0,
    
CLASS_SOLDIER,
    
CLASS_WIZARD,
    
CLASS_AMAZON,
    
CLASS_GHOST,
    
CLASS_DRAGON
}

new const 
CLASSES[MAXCLASSES][] =
{
    
"None",
    
"Soldier",
    
"Wizard",
    
"Amazon",
    
"GHOST",
    
"Dragon"
}

new const 
LEVELS[MAXLEVELS] =
{
    
0,
    
100,
    
200,
    
350,
    
500,
    
650,
    
800,
    
1000,
    
1200,
    
1450,
}

new 
PlayerXP[33], PlayerLevel[33], PlayerClass[33]
new 
g_vaultidattackerXP_Kill,XP_Knife,XP_Hs,SaveXP

public plugin_precache() 
{
    
precache_model(VIEW_MODEL)
    
precache_model(WORLD_MODEL)
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_event("DeathMsg""eDeath""a")

    
SaveXP register_cvar("SaveXP","1")
    
XP_Kill register_cvar("XP_per_kill""15")
    
XP_Hs register_cvar("XP_hs_bonus""25")
    
XP_Knife register_cvar("XP_knife_bonus""30")
    
g_vault nvault_open("BetaMod")

    
    
register_event("CurWeapon""Event_CurWeapon""be","1=1")
    
register_forward(FM_SetModel"fw_SetModel")
    
    
    
register_clcmd("say","check_say")
    
register_clcmd("say_team""check_say")
    
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost")
    
    
//register_logevent("logevent_round_end", 2, "1=Round_End")
    
register_clcmd("fullupdate""clcmd_fullupdate")
}


public 
check_say(id)
{
    new 
arg[32]
    
read_argsarg31 )
    
remove_quotes(arg)
    
    if(
equali(arg,"!heroes"))
        
ChangeClass(id)
    
    if(
equali(arg"!info"))
        
ShowHud(id)
}

public 
fwHamPlayerSpawnPost(id)
{
    if (
PlayerClass[id] == CLASS_NONE)
        
ChangeClass(id)
}

public 
clcmd_fullupdate()
{
    return 
PLUGIN_HANDLED_MAIN
}

public 
eDeath( )
{
    new 
headshot,attacker read_data)
    new 
clipammoweapon get_user_weapon(id,clip,ammo)
    
headshot read_data)
    
    if(
PlayerClass[attacker] == 0)
        return 
PLUGIN_CONTINUE
    
    PlayerXP
[attacker] += get_pcvar_num(XP_Kill)
    
    if(
headshot)
        
PlayerXP[attacker] += get_pcvar_num(XP_Hs)
    
    if(
weapon == CSW_KNIFE)
        
PlayerXP[attacker] += get_pcvar_num(XP_Knife)
    
    while(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
    {
        
client_print(attackerprint_chat"[Beta Mod] Cheers ! You are a level %i %s!"PlayerLevel[attacker],CLASSES[PlayerClass[attacker]])
        
PlayerLevel[attacker] += 1
    
}
    
    
ShowHud(attacker)
    
SaveData(attacker)
    return 
PLUGIN_CONTINUE
}


public 
ShowHud(id)
{
    
set_hudmessage(255000.750.0103.03.00.10.11)
    
show_hudmessage(id"Level: %i^nXP: %i^nClass: %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]])
}


public 
ChangeClass(id)
{
    new 
menu menu_create("Class Menu""Class_Handle");
    
menu_additem(menu ,"Soldier""1" 0);
    
menu_additem(menu ,"Wizard""2" 0);
    
menu_additem(menu ,"Amazon""3" 0);
    
menu_additem(menu ,"GHOST""4" 0);
    
menu_additem(menu ,"Dragon""5" 0);
    
    
menu_setprop(menu MPROP_EXIT MEXIT_ALL);
    
    
menu_display(id menu 0);
    
    return 
PLUGIN_CONTINUE
}


public 
Class_Handle(idmenu item)
{
    new 
szCommand[6] , szName[64]; 
    new 
access callback;
    
menu_item_getinfo(menu item access szCommand szName 63 callback);
    
    new 
ChosenClass str_to_num(szCommand)
    
    if(
PlayerClass[id] != ChosenClass)
    {
        
PlayerClass[id] = ChosenClass 
        client_print
(idprint_chat,"You are now a %s",CLASSES[ChosenClass])
    }
    
    else
    {
        if (
PlayerClass[ChosenClass] == CLASS_NONE)
            
client_print(idprint_chat"You didnt choose any Class!")
        
        else
        {
            
client_print(id,print_chat,"You are already a %s",CLASSES[ChosenClass]);
        }
    } 
    
    return 
PLUGIN_HANDLED
}


public 
client_connect(id)
{
    if(
get_pcvar_num(SaveXP) == 1)
    {
        
LoadData(id)
        
ChangeClass(id)
    }
}


public 
client_disconnect(id

    if(
get_pcvar_num(SaveXP) == 1
     { 

          
SaveData(id
     } 
}


public 
SaveData(id

   
    new 
AuthID[35
    
get_user_authid(id,AuthID,34)
    new 
vaultkey[64],vaultdata[256
 
    
format(vaultkey,63,"%s Mod",AuthID
    
format(vaultdata,255,"%i %i ",PlayerXP[id],PlayerLevel[id]) 
 
    
nvault_set(g_vault,vaultkey,vaultdata
    return 
PLUGIN_CONTINUE 
}


public 
LoadData(id

    new 
AuthID[35
    
get_user_authid(id,AuthID,34
    new 
vaultkey[64],vaultdata[256

    
format(vaultkey,63,"%s Mod",AuthID

    
nvault_get(g_vault,vaultkey,vaultdata,255
    new 
playerxp[32], playerlevel[32
    
parse(vaultdataplayerxp31playerlevel31
    
PlayerXP[id] = str_to_num(playerxp
    
PlayerLevel[id] = str_to_num(playerlevel
    return 
PLUGIN_CONTINUE 



public 
PlayerClass2(id)
{
    if (
PlayerClass[id] == CLASS_SOLDIER)
    {
        switch(
PlayerLevel[id])
        {
            case 
1:
            {
                
set_user_health(id102);
                
give_item(id,"weapon_m249");
            }
            case 
2:
            {
                
set_user_health(id104);
                
set_user_armor(id105);
            }
            case 
3:
            {    
                
set_user_health(id106);
                
set_user_armor(id110);
            }
            case 
4:
            {
                
set_user_health(id108);
                
set_user_armor(id115);
            }
            case 
5:
            {
                
set_user_health(id110);
                
set_user_armor(id120);
            }
            case 
6:
            {
                
set_user_health(id112);
                
set_user_armor(id125);
            }
            case 
7:
            {
                
set_user_health(id114);
                
set_user_armor(id130);
            }
            case 
8:
            {
                
set_user_health(id116);
                
set_user_armor(id135);
            }
            case 
9:
            {
                
set_user_health(id118);
                
set_user_armor(id140)
            }
            case 
10:
            {
                
set_user_health(id120);
                
set_user_armor(id145);
            }
        }
    }

    if (
PlayerClass[id] == CLASS_WIZARD)
    {
        switch (
PlayerLevel[id])
        {
            case 
1:
            {
                
set_user_health(id101);
                
set_user_armor(id105);
            }
            case 
2:
            {
                
set_user_health(id102);
                
set_user_armor(id110);
            }
            case 
3:
            {
                
set_user_health(id103);
                
set_user_armor(id115);
            }
            case 
4:
            {
                
set_user_health(id104);
                
set_user_armor(id120);
            }
            case 
5:
            {
                
set_user_health(id105);
                
set_user_armor(id125);
            }
            case 
6:
            {
                
set_user_health(id106);
                
set_user_armor(id130);
            }
            case 
7:
            {
                
set_user_health(id107);
                
set_user_armor(id140);
            }
            case 
8:
            {
                
set_user_health(id108);
                
set_user_armor(id145);
            }
            case 
9:
            {
                
set_user_health(id109);
                
set_user_armor(id150);
            }
            case 
10:
            {
                
set_user_health(id110);
                
set_user_armor(id155);
            }
        }
    }
}


public 
Event_CurWeapon(id
{
    if (
PlayerClass[id] == CLASS_SOLDIER)
    {
        new 
weaponID read_data(2)
        
        if(
weaponID != CSW_M4A1)
            return 
PLUGIN_CONTINUE
        
        entity_set_string
(idEV_SZ_viewmodelVIEW_MODEL)
    }
    return 
PLUGIN_CONTINUE 
}

public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity)) 
        return 
FMRES_IGNORED
    
    
if(!equali(modelOLDWORLD_MODEL)) 
        return 
FMRES_IGNORED
    
    
new className[33]
    
entity_get_string(entityEV_SZ_classnameclassName32)
    
    if(
equal(className"weaponbox") || equal(className"armoury_entity") || equal(className"grenade"))
    {
        
entity_set_model(entityWORLD_MODEL)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

__________________
Signature Goes Here
dekken is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 06-06-2008 , 13:03   Re: I try to make mod with xp.
Reply With Quote #24

Thanks for fix it again :] , later I will change my script .
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 06-10-2008 , 18:21   Re: I try to make mod with xp.
Reply With Quote #25

How can I change this because i have a 4 error's on line 166 .

164public PlayerClass2(id)
165{
166 if (lastround[id] == 0)

Error's > : pstudio-0.8.3\temp114.sma(165) : error 029: invalid expression, assumed zero
: pstudio-0.8.3\temp114.sma(165) : warning 215: expression has no effect
: pstudio-0.8.3\temp114.sma(165) : error 001: expected token: ";", but found "]"
: pstudio-0.8.3\temp114.sma(165) : error 029: invalid expression, assumed zero
: pstudio-0.8.3\temp114.sma(165) : fatal error 107: too many error messages on one line

(plugin still not completed , I just try fix some errors)
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
dekken
Veteran Member
Join Date: Jul 2007
Old 06-11-2008 , 04:08   Re: I try to make mod with xp.
Reply With Quote #26

well show us the full code
__________________
Signature Goes Here
dekken is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 06-11-2008 , 14:11   Re: I try to make mod with xp.
Reply With Quote #27

Here you go. >>
I know plugin is messy but first I try add all classes and some magic and I still learning (pawn tutorial). By the way can you tell how to add magic (something like in wc3) when in every level you can choose one of 6 magics. If you can't then it's ok . =)
Attached Files
File Type: sma Get Plugin or Get Source (BetaModtest.sma - 334 views - 11.2 KB)
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! 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 02:01.


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