Raised This Month: $ Target: $400
 0% 

DonaldDuck XP mod


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
platEE
Member
Join Date: Jul 2008
Location: Finland, Kuopio
Old 09-21-2008 , 05:20   DonaldDuck XP mod
Reply With Quote #1

So im making DonaldDuck mod and need some help in scripting it heres what i need :
how to add special attacks/abilitys to classes
how to get special attacks bind command?
I know somebody knows these!
__________________
ALWAYS leave your name when giving +Karma

Last edited by platEE; 09-21-2008 at 10:57.
platEE is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-21-2008 , 05:33   Re: DonaldDuck XP mod
Reply With Quote #2

PHP Code:
register_clcmd("+superskill""cmdSuperSkill", -1"bind this to any key to use the super donald skill"
__________________
xPaw is offline
platEE
Member
Join Date: Jul 2008
Location: Finland, Kuopio
Old 09-21-2008 , 05:47   Re: DonaldDuck XP mod
Reply With Quote #3

hmm didnt understand D can u explain it better?
__________________
ALWAYS leave your name when giving +Karma
platEE is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-21-2008 , 05:53   Re: DonaldDuck XP mod
Reply With Quote #4

register_clcmd @ FuncWiki

The syntax is:
PHP Code:
 register_clcmd ( const client_cmd[],const function[],flags=-1info[]="" 
The good example:
PHP Code:
register_clcmd("amx_mycommand","MyFunction",ADMIN_KICK,"Description of the command"
okay, we got
PHP Code:
register_clcmd("+superskill""cmdSuperSkill", -1"bind this to any key to use the super donald skill"
+superskill is the console command for player
cmdSuperSkill is a function
-1 means what all can use this command
and the last is the description for amx_help

cmdSuperSkill for example
PHP Code:
public cmdSuperSkill id ) {
  
// first i think we need to check is user alive? then the level
  
if ( is_user_alive id ) && g_DonaldLevel[id] => ) {
    
// aha he is alive and he got more than 5lvl
  
}

__________________
xPaw is offline
platEE
Member
Join Date: Jul 2008
Location: Finland, Kuopio
Old 09-21-2008 , 06:04   Re: DonaldDuck XP mod
Reply With Quote #5

thanks i need litlle more help i get very many errors here when compiling :
/home/groups/amxmodx/tmp3/phphAUQdq.sma(52) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phphAUQdq.sma(69) : error 017: undefined symbol "msgtext"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(81) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phphAUQdq.sma(104) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phphAUQdq.sma(137) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phphAUQdq.sma(137) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phphAUQdq.sma(137) : error 004: function "client_disconnect" is not implemented
/home/groups/amxmodx/tmp3/phphAUQdq.sma(147) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phphAUQdq.sma(147) : error 017: undefined symbol "Choosecharacter"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(156) : error 037: invalid string (possibly non-terminated string)
/home/groups/amxmodx/tmp3/phphAUQdq.sma(157) : error 017: undefined symbol "DonaldDuck"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(157) : error 017: undefined symbol "n2"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(15 : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phphAUQdq.sma(159) : error 017: undefined symbol "Huey"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(159) : error 017: undefined symbol "n4"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(160) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phphAUQdq.sma(161) : error 017: undefined symbol "Louie"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(161) : error 017: undefined symbol "n6"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(162) : error 017: undefined symbol "DaicyDuck"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(162) : error 017: undefined symbol "n"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(162) : error 017: undefined symbol "n0"
/home/groups/amxmodx/tmp3/phphAUQdq.sma(162) : fatal error 107: too many error messages on one line

heres my source code i hope can solve whats wrong
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <vault>

#define CLASS_NOTHING 0
#define CLASS_DonaldDuck 1
#define CLASS_ScroogeMcDuck 2
#define CLASS_Huey 3
#define CLASS_Dewey 4
#define CLASS_Louie 5
#define CLASS_DaicyDuck 6

#define MAXCLASSES 7

new PlayerClass[33]
new 
PlayerXP[33]
new 
PlayerLevel[33]

new const 
CLASSES[MAXCLASSES][] =
{     
    
"None"
    
"DonaldDuck",
    
"ScroogeMcDuck",  
    
"Huey"
    
"Dewey",
    
"Louie",
    
"DaicyDuck"    
}

new const 
LEVELS[8] = {
    
100//100 XP for level 1
    
200//200 XP for level 2
    
400//Etc..
    
800,
    
1600,
    
3200,
    
6400,
    
12800
}

public 
plugin_init()
{

    
register_plugin("Duck Mod""3.0""platEE")
    
register_cvar("sv_duckmod""1")
    
    
//Now we register the DeathMsg event. This is where we can add XP when you kill somebody.
    
register_event("DeathMsg""DeathMsg""a"
    
//Note that i registered it as "a"; global event
    
    //Now we register a "XP Per Kill" cvar...
    //Now I made 20 xp per kill.
    
register_cvar("xp_per_kill""30")

    
//Lets register a SaveXP toggle cvar.
    
register_cvar("SaveXP""1")
    
    
//Lets register a menu to choose animal with...
    
register_menucmd(register_menuid("menu_Choosecharacter"),1023,"DoChoosecharacter"); 
    
    
//ResetHUD event... (Check if user has no class)
    
register_event("ResetHUD""ResetHud""b")
    
    
//Something for ShowHUD... Will explain later.
    
msgtext get_user_msgid("StatusText"

    
//Lets make a "Change Animal" cmd for players.
    //I just lead it to the change animal menu.
    //Ill get back to the menu later.
    
register_clcmd("say /changecharacter""Changecharacter")
    
register_clcmd("say_team /changeanimal""Changecharacter")
}

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

    new 
vaultkey[64], vaultdata[64]; 
  
    
//Save their class
    
format(vaultkey,63,"CHARACTER-%s-class",authid); 
    
format(vaultdata,63,"%d",PlayerClass[id]); 
    
set_vaultdata(vaultkey,vaultdata); 

    
//Save their XP
    
format(vaultkey,63,"CHARACTER-%s-xp",authid); 
    
format(vaultdata,63,"%d",PlayerXP[id]); 
    
set_vaultdata(vaultkey,vaultdata); 

    
//Save their level
    
format(vaultkey,63,"CHARACTER-%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]; 

    
//Load their class
    
format(vaultkey,63,"CHARACTER-%s-class",authid); 
    
get_vaultdata(vaultkey,vaultdata,63); 
    
PlayerClass[id] = str_to_num(vaultdata); 

     
//Load their XP
    
format(vaultkey,63,"CHARACTER-%s-xp",authid); 
    
get_vaultdata(vaultkey,vaultdata,63); 
    
PlayerXP[id] = str_to_num(vaultdata);   

    
//Load their level
    
format(vaultkey,63,"CHARACTER-%s-level",authid); 
    
get_vaultdata(vaultkey,vaultdata,63);
    
PlayerLevel[id] = str_to_num(vaultdata);  
}

public 
client_connect(id)
{
    
//Only load their XP if our SaveXP cvar is 1.
    
if(get_cvar_num("SaveXP") == 1) {
       
         
LoadXP(id)

         
//Add a message if you want....
         
client_print(idprint_chat"[Duck Mod] XP Loaded!")
         
client_print(idprint_chat"[Duck Mod] You are a %s with level %s and %s XP"PlayerClass[id], PlayerLevel[id], PlayerXP[id])
    
}

public 
client_disconnect(id)
{
    
//Only save their XP if our SaveXP cvar is 1.
    
if(get_cvar_num("SaveXP") == 1) {
    
         
SaveXP(id)
    }
}

//Call it whatever you want...
stock Choosecharacter(id)
{
    new 
menu[192
    
    
//Add keys for how many classes you have + exit key.
    
new keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3 

    
    
//Here we write the menu options..
    
format(menu191"Duck Mod: Choose character^n^n1.
    DonaldDuck^n2.
    ScroogeMcDuck^n3. 
    Huey^n4. 
    Dewey^n5.
    Louie^n6
    DaicyDuck^n^n0.
    Exit"

    
    
//We created a menu in plugin_init() and now we make the plugin know that its this menu it has to show.
    
show_menu(idkeysmenu, -1"menu_Choosecharacter"
    
    return 
PLUGIN_CONTINUE
}

public 
DoChoosecharacter(idkey)
{
    
// Remeber that the keys starts on 0...
    
if(key == 0) {
       
         
//Lets check if the player allready has Dog...
         
if(PlayerClass[id] == CLASS_DonaldDuck) {
         
              
//Make a message here if you want...
              
client_print(idprint_chat"[Duck Mod] You are allready a DonaldDuck! Choose something else!")
              
              
//Open the menu again...
              
Choosecharacter(id)
              
              
//Exit...
              
return PLUGIN_HANDLED
         
}        

         
//Now, if the player didnt have dog allready, we'll set his class to dog.
         
PlayerClass[id] = CLASS_DonaldDuck
         
         
//Make a message if you want...
         
client_print(idprint_chat"[Duck Mod] You are now DonaldDuck!")
    }        
    
    
//Im doing the same on all other buttons...
         
    
if(key == 1) {
         
         if(
PlayerClass[id] == CLASS_ScroogeMcDuck) {
              
              
client_print(idprint_chat"[Duck Mod] You are allready a ScroogeMcDuck! Choose something else!")
              
Choosecharacter(id)
              return 
PLUGIN_HANDLED
         
}
                   
         
PlayerClass[id] = CLASS_ScroogeMcDuck
         client_print
(idprint_chat"[Duck Mod] You are now a ScroogeMcDuck!")
    }
    
    if(
key == 2) {
         
         if(
PlayerClass[id] == CLASS_Huey) {
              
              
client_print(idprint_chat"[Duck Mod] You are allready a Huey! Choose something else!")
              
Choosecharacter(id)
              return 
PLUGIN_HANDLED
         
}
                   
         
PlayerClass[id] = CLASS_Huey
         client_print
(idprint_chat"[Duck Mod] You are now a Huey!")
    }    

    if(
key == 3) {
         
         if(
PlayerClass[id] == CLASS_Dewey) {
              
              
client_print(idprint_chat"[Duck Mod] You are allready a Dewey! Choose something else!")
              
Choosecharacter(id)
              return 
PLUGIN_HANDLED
         
}
                   
         
PlayerClass[id] = CLASS_Dewey
         client_print
(idprint_chat"[Duck Mod] You are now a Dewey!")
    }
    
    if(
key == 4)
    {
        if(
PlayerClass[id] == CLASS_Louie)
    {
        
client_print(idprint_chat"[Duck Mod] You are allready a Louie! choose something else!")
        
Choosecharacter(id)
        return 
PLUGIN_HANDLED
    
}
    
    
PlayerClass[id] = CLASS_Louie
    client_print
(idprint_chat"[Duck Mod] you are now Louie!")
    }
    
    if(
key == 5)
    {
        if(
PlayerClass[id] == CLASS_DaicyDuck)
    {
        
client_print(idprint_chat"[Duck Mod] You are allready a DaicyDuck! choose something else")
        
Choosecharacter(id)
        return 
PLUGIN_HANDLED
    
}
    
    
PlayerClass[id] = CLASS_Louie
    client_print
(idprint_chat"[Duck Mod] You are now DaicyDuck
    //Show new HUD after picking class.
    //Ill get back to this later...
    ShowHUD(id)
    
    return PLUGIN_HANDLED
}

public ResetHUD(id)
{
//Lets check if "
sv_animalmod" is on. If its off, we'll stop the function.
    if(get_cvar_num("
sv_duckmod") == 0) {
         return PLUGIN_HANDLED
    }

    //Lets check if the player has no animal.
    if(PlayerClass[id] == CLASS_NOTHING) {
    
         //If the player doesnt have a animal;
         //Open the choose animal menu for him.
         Choosecharacter(id)
         return PLUGIN_HANDLED
    }
    
    return PLUGIN_HANDLED
}

public DeathMsg() //Note that i only had (), and not (id)
{
//Lets check if "
sv_animalmod" is on. If its off, we'll stop the function.
    if(get_cvar_num("
sv_duckmod") == 0) {
         return PLUGIN_HANDLED
    }
    
    //Now we create a "
attacker" varriable. So the XP will be given to the killer, and not all players on the server.
    new attacker = read_data(1)
    
    //Now the plugin will check if the attacker doesnt have a class, and if he doesnt, the function will stop.
    if(PlayerClass[attacker] == CLASS_NOTHING) {
         return PLUGIN_HANDLED
    }
    
    //Now lets see if the attacker allready has level 6, and doesnt need more XP, and if he is, stop the function.
    //You can remove this if you want, and let the player get as much XP he want. But we wont get more than level 6 anyway.
    if(PlayerLevel[attacker] == 8) {
         return PLUGIN_HANDLED
    }
    
    //Now we can add XP to the attacker.        
    PlayerXP[attacker] += get_cvar_num("
XP_per_kill") //Add the amout of XP you have on the "XP_per_kill" cvar.
    
    //Now we check if the attacker has enough XP for a new level. And if he has, we add it.
    if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
     
         //Add his level...
         PlayerLevel[attacker] += 1
         
         //Now you can make a "
congratualtions" message if you want...
         client_print(attacker, print_chat, "
[Duck ModCongratulationsYou are now level %i!", PlayerLevel[attacker])
         
         //Lets save his XP every time he gets a level incase the server crashes or something. So they wont loose it all.
         if(get_cvar_num("
SaveXP") == 1) {
 
              SaveXP(attacker)
         }


         //Show His New Level on the HUD message.
         //Ill get back to this later...
         ShowHUD(attacker)
    }   
    
    //Show new HUD if you didnt get level too. (To show the new XP)
    //Ill get back to this later...
    ShowHUD(attacker)
    
    return PLUGIN_CONTINUE
    
  public ShowHUD(id)    

    new HUD[51] 
    
    //This is the stuff that will actually show in game.
    format(HUD, 50, "
[%s]Level: %i XP: %i", CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id]) 

    message_begin(MSG_ONE, msgtext, {0,0,0}, id) 
    write_byte(0) 
    write_string(HUD) 
    message_end() 
    return

This is made from XP mod tutorial thats why theres things about animals
__________________
ALWAYS leave your name when giving +Karma
platEE is offline
Old 09-21-2008, 06:05
xbatista
This message has been deleted by xbatista.
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-21-2008 , 06:14   Re: DonaldDuck XP mod
Reply With Quote #6

undefined symbol "msgtext"
undefined symbol "DonaldDuck"
undefined symbol "Huey"
and etc...

PHP Code:
register_event("ResetHUD""ResetHud""b"
dont use this method of checking new round!!!!!

and use switch instead of (if == in menu
__________________

Last edited by xPaw; 09-21-2008 at 06:17.
xPaw 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 22:14.


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