Raised This Month: $ Target: $400
 0% 

pm raffle xp help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eskemo
Senior Member
Join Date: Dec 2008
Location: Australia
Old 01-04-2012 , 17:50   pm raffle xp help
Reply With Quote #1

PHP Code:
/* Credits - 
    Exolent - http://forums.alliedmods.net/showthread.php?t=74666
    Emp' - http://forums.alliedmods.net/showthread.php?t=46364&highlight=emps+menu
    Phil - Great help in the Raffle part :) <3
*/

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <pokemod>

#pragma semicolon 1
#define MAXPLAYERS 33
#define USESOUND "events/enemy_died.wav"

new costxpspme_randxp_amountpme_randxp_cost;
new 
pme_raffle_costpme_rafflexp_amountmp_timelimit;
new 
bool:pMUsedMAXPLAYERS ];
new 
bool:RaffleBoughtMAXPLAYERS ];
new 
Float:ltime;

public 
plugin_init()
{
    
register_plugin("Pokemod buyxp""1.4""eskemo + Phil");
    
register_clcmd("say buyxp""buyxp_menu");
    
register_clcmd("say /buyxp""buyxp_menu");
    
register_clcmd("say_team buyxp""buyxp_menu");
    
register_clcmd("say_team /buyxp""buyxp_menu");
    
register_logevent"EventRoundEnd"2"1=Round_End" );
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
pme_randxp_cost register_cvar("pm_randomxp_cost""14000");
    
cost register_cvar("pm_exp_cost""8000");
    
xps register_cvar("pm_exp_amount""50");
    
pme_randxp_amount register_cvar("pm_randomxp_amount""1000");
    
pme_raffle_cost register_cvar("pm_raffle_cost""16000");
    
pme_rafflexp_amount register_cvar("pm_raffle_amount""5000"); 
    
mp_timelimit get_cvar_pointer("mp_timelimit");

    
set_task(0.1"preRaffle"0""0"b"0);
    
}
public 
plugin_precache() {
    
precache_sound(USESOUND);
}

public 
fwHamPlayerSpawnPost(iPlayer,id) {
        if (
is_user_alive(iPlayer)) {
          
client_print(idprint_chat"[PM] To buy xp type /buyxp in chat or team chat. Can only buy when alive and once a round.");
        }
}  
public 
EventRoundEnd()
{
    for(new 
0MAXPLAYERSi++)
    {
        
pMUsed[i] = false;
    }
}

public 
client_disconnect(id)
{
    
pMUsed[id] = false;
}

public 
buyxp_menu(id)
{
    if(!
pMUsed[id]){
        new 
menu menu_create("\rBuyxp:""menu_handler");
        
menu_additem(menu"\wBuyxp""1"0);
        
menu_additem(menu"\wRandom Buyxp""2"0);
        
//menu_additem(menu, "\wRaffle Ticket!", "3", 0);
        
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_display(idmenu0);
        }else{
        
client_print(idprint_chat"[PM] : Please wait till next round before you try and buyxp again.");
    }
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            new 
money cs_get_user_money(id);
            new 
price get_pcvar_num(cost);
            new 
xp get_pcvar_num(xps);
            if(
money price)
            {
                
client_print(idprint_chat"[PM] You do not have enough money right now.");
                return 
PLUGIN_HANDLED;
            }
            
cs_set_user_money(idmoney -= price);
            
Poke_Give_XP(id, -1xp);
            
emit_sound(idCHAN_ITEMUSESOUND VOL_NORMATTN_NORM0PITCH_NORM);
            
client_print(idprint_chat"[PM] %i Experience bought for your pokemon."xp);
            
pMUsed[id] = true;
            return 
PLUGIN_HANDLED;
        }
        case 
2:
        {
            new 
money cs_get_user_money(id);
            new 
price1 get_pcvar_num(pme_randxp_cost);
            new 
randxp_maxamount get_pcvar_num(pme_randxp_amount);
            if(
money price1)
            {
                
client_print(idprint_chat"[PM] You do not have enough money right now.");
                return 
PLUGIN_HANDLED;
            }
            new 
exp random_num(0randxp_maxamount);
            
cs_set_user_money(idmoney -= price1);
            
Poke_Give_XP(id, -1exp);
            
emit_sound(idCHAN_ITEMUSESOUND VOL_NORMATTN_NORM0PITCH_NORM);
            
client_print(idprint_chat"[PM] %i Experience bought for your pokemon."exp);
            
pMUsed[id] = true;
            return 
PLUGIN_HANDLED;
        }
        case 
3:
        {
            new 
money cs_get_user_money(id);
            new 
price2 get_pcvar_num(pme_raffle_cost);
            if(
money price2)
            {
                
client_print(idprint_chat"[PM] You do not have enough money right now.");
                return 
PLUGIN_HANDLED;
            }
            
cs_set_user_money(idmoney -= price2);
            
client_print(idprint_chat"[PM] You have Bought a Raffle Ticket." );
            
emit_sound(idCHAN_ITEMUSESOUND VOL_NORMATTN_NORM0PITCH_NORM);
            
pMUsed[id] = true;
            
RaffleBought[id] = true;
            return 
PLUGIN_HANDLED;
        }
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}


GetRandomPlayer(const flags[]="", const teamORname[]="")
{
    new 
players[32], pnum;
    
get_players(playerspnumflagsteamORname);
    
    return (
pnum 0) ? players[random(pnum)] : 0;
}

public 
preRaffle(id) {
    
    static 
Float:GameTime;
    
GameTime get_gametime();
    
ltime get_pcvar_float(mp_timelimit) / 2;
    if(
GameTime >= ltime)
    {
        
Raffleid );
    }
}

public 
Raffleid )
{
    if( 
RaffleBoughtid ] == true)
    {
        new 
raffleexp get_pcvar_numpme_rafflexp_amount );
        new 
player GetRandomPlayer("a");
        
        new 
winner32 ];
        
get_user_nameplayerwinner31 );
        
        
Poke_Give_XP(player, -1raffleexp);
        
client_print(0print_chat"[PM] player %s has won the raffle of %i exp!."winnerraffleexp);
    }


Why woudl the raffle parts not be working please help thanks!
__________________


Free Australian FASTDL Server PM ME
eskemo 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 16:27.


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