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

Error when buy cocaina


Post New Thread Reply   
 
Thread Tools Display Modes
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 02-29-2012 , 14:27   Re: Give velocity when buy
Reply With Quote #21

Quote:
Originally Posted by xfire97 View Post
The speed is fix it and in new spawn drugs "effect" stop?
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#define PLUGIN "Drogas"
#define VERSION "1.0"
#define AUTHOR "Rocha"

new Floatspeed 310.0;

new 
Floatspeed1 330.0;

new 
Floatspeed2 360.0;

public 
plugin_init() 
{
    
register_plugin("Drogas""1.0""Rocha")
    
    
register_clcmd"say /drogas","DrogasMenu");
    
    
RegisterHam(Ham_Spawn"player""ronda"1);
    
    
RegisterHam(Ham_Spawn"player""CBasePlayer_Spawn_Post"true)
     
    
register_event("CurWeapon""Event_CurWeapon""be");
    
     
register_event("CurWeapon""Event_CurWeapon1""be");
     
      
register_event("CurWeapon""Event_CurWeapon2""be");
    
}
public 
Event_CurWeapon(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idspeed);
}  
public 
Event_CurWeapon1(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idspeed1);
}  
public 
Event_CurWeapon2(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idspeed2);
}  

public 
CBasePlayer_Spawn_Postid )
{
    if( 
is_user_alive(id) )
    {
        new 
iFlags pev(idpev_flags)
        if( 
iFlags FL_BASEVELOCITY )
        {
            
set_pev(idpev_flagsiFlags & ~FL_BASEVELOCITY)
        }
        
set_pev(idpev_velocity0)
        
set_pev(idpev_basevelocity0)
    }
}  

public 
ronda(id)
{
        
set_task(0.1"DrogasMenu"id)
    
}
public 
DrogasMenu(id)
{
    new 
menu menu_create("\r[Drogas Menu]\yEscolhe a tua Droga:""menu_handler");
    
    
menu_additem(menu"\wPolen""1"0);
    
menu_additem(menu"\wErva""2"0);
    
menu_additem(menu"\wCogumelos""3"0);
    
menu_additem(menu"\wLSD""4"0);
    
menu_additem(menu"\wCocaina""5"0);
    
menu_additem(menu"\rHeroina""6"ADMIN_RESERVATION);
    
menu_additem(menu"\rCrack""7"ADMIN_RESERVATION);
    
menu_additem(menu"\rMarijuana""8"ADMIN_RESERVATION);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    
}
public 
menu_handler(idmenuitem)
{
    new 
health get_user_health(id)
    new 
frags get_user_frags(id)
    new 
money cs_get_user_money(id)
    {
    if (
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
        return 
PLUGIN_HANDLED;
    }
    if(
is_user_alive(id))
    {
        
    new 
data[6], iName[64]
    new 
acesscallback
    
    menu_item_getinfo
(menuitemacessdata5iName63callback);
    
    new 
key str_to_num(data);
    
    switch (
key)
    {
        case 
1:
        {
            
client_print(idprint_chat"Esta pedra de polen era boa, ganhas te 10 HP");
            
set_user_health(idhealth 10);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
2:
        {
            
client_print(idprint_chat"Ganda Saquinho de Erva, ganhas te 15 HP");
            
set_user_health(idhealth 15);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
3:
        {
            
client_print(idprint_chat"Ganda alucinacao, acho que matei alguem");
            
set_user_frags(idfrags 1);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
4:
        {
            
client_print(idprint_chat"Este LSD, tou mesmo relaxado, ganhei ainda 750$");
            
cs_set_user_money(idmoney 750);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
5:
        {
            
client_print(idprint_chat"Cocaina da boa, ate corro mais rapido, adrenalina!");
            
set_user_maxspeed(idspeed);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
6:
        {
            
client_print(idprint_chat"Heroina de qualidade, corro mais rapido e tenho mais saude!");
            
set_user_maxspeed(idspeed1);
            
set_user_health(idhealth 25);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
7:
        {
            
client_print(idprint_chat"Crack do melhor, ganhei 25 HP, e ainda ganhei 850$");
            
set_user_health(idhealth 25);
            
cs_set_user_money(idmoney 850);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
8:
        {
            
client_print(idprint_chat"Marijuana do Mexico, da me alto speed e saude, e ainda vendo!");
            
set_user_maxspeed(idspeed2);
            
set_user_health(idhealth 30);
            
cs_set_user_money(idmoney 1000);
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
    }
    
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}


There, ALL alive players will have speed.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
xfire97
Member
Join Date: Aug 2011
Old 02-29-2012 , 14:36   Re: Give velocity when buy
Reply With Quote #22

why? did i delete the
PHP Code:
public Event_CurWeapon(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idspeed);
}  
public 
Event_CurWeapon1(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idspeed1);
}  
public 
Event_CurWeapon2(id)
{
    if(
is_user_alive(id))
        
set_user_maxspeed(idspeed2); 
</span></span>

Last edited by xfire97; 02-29-2012 at 14:37.
xfire97 is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 02-29-2012 , 14:55   Re: Give velocity when buy
Reply With Quote #23

You must use a var to know who is allow to use speed and who no. You set true in the menu's switch and then in false when you want.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
xfire97
Member
Join Date: Aug 2011
Old 02-29-2012 , 15:10   Re: Give velocity when buy
Reply With Quote #24

Ok, but i want fixed the drug "effect" just for one round and the menu appears when a player is in a team.
xfire97 is offline
xfire97
Member
Join Date: Aug 2011
Old 03-01-2012 , 15:34   Re: Give velocity when buy
Reply With Quote #25

Somebody fix it, i dont get it, fix the speed and player only can use the "drugs" 1 one time in round, and menu only appear when player have a team, and the drugs "effect" over when new round and when die, please somebody help i try very hard i dont get it.
xfire97 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-01-2012 , 15:52   Re: Give velocity when buy
Reply With Quote #26

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <shop>

#define MAX_PLAYERS 32

// enumerate our items
enum _:Items {
    
Item_Polen,
    
Item_Erva,
    
Item_Cogumelos,
    
Item_LSD,
    
Item_Cocaina,
    
Item_Heroina,
    
Item_Crack,
    
Item_Marijuana
};

// create the names for each
new const gItemNames[Items][] = {
    
"Polen",
    
"Erva",
    
"Cogumelos",
    
"LSD",
    
"Cocaina",
    
"Heroina",
    
"Crack",
    
"Marijuana"
};

// setup the short names of the items
new const gItemShortNames[Items][] = {
    
"polen",
    
"erva",
    
"cogumelos",
    
"lsd",
    
"cocaina",
    
"heroina",
    
"crack",
    
"marijuana"
};

// registered item id's
new gItems[Items];

// speed of the player
new Float:gSpeed[MAX_PLAYERS+1];

public 
plugin_init() {
    
// hook player spawn to reset speed
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawnPost"1);
    
    
// hook when weapon changes to fix speed
    
RegisterHam(Ham_Item_PreFrame"player""FwdPlayerResetMaxSpeedPost"1);
    
    
// prepare items
    
for(new 0Itemsi++) {
        
// register item to shop
        
gItems[i] = shop_add_item(gItemNames[i], gItemShortNames[i]);
    }
}

public 
FwdPlayerSpawnPost(id) {
    
// if player had speed and is alive
    
if(gSpeed[id] > 0.0 && is_user_alive(id)) {
        
// remove speed
        
gSpeed[id] = 0.0;
        
set_user_maxspeed(id, -1.0);
    }
}

public 
FwdPlayerResetMaxSpeedPost(id) {
    
// check if player has speed and is alive and is not during freeze time
    
if(gSpeed[id] > 0.0 && is_user_alive(id) && get_user_maxspeed(id) != 1.0) {
        
// set back player's speed
        
set_user_maxspeed(idgSpeed[id]);
    }
}

public 
CallbackItemAllowed(itemid) {
    
// get item constant from item id
    
for(new 0Itemsi++) {
        
// check if found item
        
if(gItems[i] == item) {
            
// can only use these items while alive
            
if(!is_user_alive(id)) {
                return 
SHOP_ITEM_DISABLED;
            }
            
            
// if an admin reserved item and not an admin
            
if((== Item_Heroina || == Item_Crack || == Item_Marijuana) && !access(idADMIN_RESERVATION)) {
                return 
SHOP_ITEM_DISABLED;
            }
            
            
// player is allowed this item
            
return SHOP_ITEM_ENABLED;
        }
    }
    
    
// player not allowed item, so hide item from menu
    
return SHOP_ITEM_HIDDEN;
}

public 
shop_item_selected(itemid) {
    
// find which item was selected, if one from this plugin
    
for(new 0Itemsi++) {
        
// check if found item
        
if(gItems[i] == item) {
            
// switch item for specific giving
            
switch(i) {
                case 
Item_Polen: {
                    
// handle selection
                    
set_user_health(idget_user_health(id) + 10);
                }
                case 
Item_Erva: {
                    
// handle selection
                    
set_user_health(idget_user_health(id) + 15);
                }
                case 
Item_Cogumelos: {
                    
// handle selection
                    
set_user_frags(idget_user_frags(id) + 1);
                }
                case 
Item_LSD: {
                    
// handle selection
                    
cs_set_user_money(idcs_get_user_money(id) + 750);
                }
                case 
Item_Cocaina: {
                    
// handle selection
                    
set_maxspeed(id310.0);
                }
                case 
Item_Heroina: {
                    
// handle selection
                    
set_maxspeed(id350.0);
                    
set_user_health(idget_user_health(id) + 25);
                }
                case 
Item_Crack: {
                    
// handle selection
                    
set_user_health(idget_user_health(id) + 25);
                    
cs_set_user_money(idcs_get_user_money(id) + 850);
                }
                case 
Item_Marijuana: {
                    
// handle selection
                    
set_maxspeed(id360.0);
                    
set_user_health(idget_user_health(id) + 30);
                    
cs_set_user_money(idcs_get_user_money(id) + 1000);
                }
            }
            
            
// found item, so don't look anymore
            
break;
        }
    }
}

set_maxspeed(idFloat:speed) {
    
gSpeed[id] = speed;
    
set_user_maxspeed(idspeed);

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xfire97
Member
Join Date: Aug 2011
Old 03-01-2012 , 18:01   Re: Give velocity when buy
Reply With Quote #27

Exolent this
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fun> 
#include <cstrike> 
#include <hamsandwich> 
#include <shop> 

#define MAX_PLAYERS 32 

// enumerate our items 
enum _:Items 
    
Item_Polen
    
Item_Erva
    
Item_Cogumelos
    
Item_LSD
    
Item_Cocaina
    
Item_Heroina
    
Item_Crack
    
Item_Marijuana 
}; 

// create the names for each 
new const gItemNames[Items][] = { 
    
"Polen"
    
"Erva"
    
"Cogumelos"
    
"LSD"
    
"Cocaina"
    
"Heroina"
    
"Crack"
    
"Marijuana" 
}; 

// setup the short names of the items 
new const gItemShortNames[Items][] = { 
    
"polen"
    
"erva"
    
"cogumelos"
    
"lsd"
    
"cocaina"
    
"heroina"
    
"crack"
    
"marijuana" 
}; 

// registered item id's 
new gItems[Items]; 

// speed of the player 
new Float:gSpeed[MAX_PLAYERS+1]; 

public 
plugin_init() { 
    
// hook player spawn to reset speed 
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawnPost"1); 
     
    
// hook when weapon changes to fix speed 
    
RegisterHam(Ham_Item_PreFrame"player""FwdPlayerResetMaxSpeedPost"1); 
     
    
// prepare items 
    
for(new 0Itemsi++) { 
        
// register item to shop 
        
gItems[i] = shop_add_item(gItemNames[i], gItemShortNames[i]); 
    } 


public 
FwdPlayerSpawnPost(id) { 
    
// if player had speed and is alive 
    
if(gSpeed[id] > 0.0 && is_user_alive(id)) { 
        
// remove speed 
        
gSpeed[id] = 0.0
        
set_user_maxspeed(id, -1.0); 
    } 


public 
FwdPlayerResetMaxSpeedPost(id) { 
    
// check if player has speed and is alive and is not during freeze time 
    
if(gSpeed[id] > 0.0 && is_user_alive(id) && get_user_maxspeed(id) != 1.0) { 
        
// set back player's speed 
        
set_user_maxspeed(idgSpeed[id]); 
    } 


public 
CallbackItemAllowed(itemid) { 
    
// get item constant from item id 
    
for(new 0Itemsi++) { 
        
// check if found item 
        
if(gItems[i] == item) { 
            
// can only use these items while alive 
            
if(!is_user_alive(id)) { 
                return 
SHOP_ITEM_DISABLED
            } 
             
            
// if an admin reserved item and not an admin 
            
if((== Item_Heroina || == Item_Crack || == Item_Marijuana) && !access(idADMIN_RESERVATION)) { 
                return 
SHOP_ITEM_DISABLED
            } 
             
            
// player is allowed this item 
            
return SHOP_ITEM_ENABLED
        } 
    } 
     
    
// player not allowed item, so hide item from menu 
    
return SHOP_ITEM_HIDDEN


public 
shop_item_selected(itemid) { 
    
// find which item was selected, if one from this plugin 
    
for(new 0Itemsi++) { 
        
// check if found item 
        
if(gItems[i] == item) { 
            
// switch item for specific giving 
            
switch(i) { 
                case 
Item_Polen: { 
                    
// handle selection 
                    
set_user_health(idget_user_health(id) + 10); 
                } 
                case 
Item_Erva: { 
                    
// handle selection 
                    
set_user_health(idget_user_health(id) + 15); 
                } 
                case 
Item_Cogumelos: { 
                    
// handle selection 
                    
set_user_frags(idget_user_frags(id) + 1); 
                } 
                case 
Item_LSD: { 
                    
// handle selection 
                    
cs_set_user_money(idcs_get_user_money(id) + 750); 
                } 
                case 
Item_Cocaina: { 
                    
// handle selection 
                    
set_maxspeed(id310.0); 
                } 
                case 
Item_Heroina: { 
                    
// handle selection 
                    
set_maxspeed(id350.0); 
                    
set_user_health(idget_user_health(id) + 25); 
                } 
                case 
Item_Crack: { 
                    
// handle selection 
                    
set_user_health(idget_user_health(id) + 25); 
                    
cs_set_user_money(idcs_get_user_money(id) + 850); 
                } 
                case 
Item_Marijuana: { 
                    
// handle selection 
                    
set_maxspeed(id360.0); 
                    
set_user_health(idget_user_health(id) + 30); 
                    
cs_set_user_money(idcs_get_user_money(id) + 1000); 
                } 
            } 
             
            
// found item, so don't look anymore 
            
break; 
        } 
    } 


set_maxspeed(idFloat:speed) { 
    
gSpeed[id] = speed
    
set_user_maxspeed(idspeed); 

alone work?
</span></span>
xfire97 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-01-2012 , 18:07   Re: Give velocity when buy
Reply With Quote #28

You have to install the Shop API.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xfire97
Member
Join Date: Aug 2011
Old 03-01-2012 , 18:45   Re: Give velocity when buy
Reply With Quote #29

Yes my new script
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fun> 
#include <cstrike> 
#include <hamsandwich> 
#include <shop> 
#include <chatcolor>

#define MAX_PLAYERS 32 

// enumerate our items 
enum _:Items 
    
Item_Polen
    
Item_Erva
    
Item_Cogumelos
    
Item_LSD
    
Item_Cocaina
    
Item_Heroina
    
Item_Crack
    
Item_Marijuana 
}; 

// create the names for each 
new const gItemNames[Items][] = { 
    
"Polen"
    
"Erva"
    
"Cogumelos"
    
"LSD"
    
"Cocaina"
    
"Heroina"
    
"Crack"
    
"Marijuana" 
}; 

// setup the short names of the items 
new const gItemShortNames[Items][] = { 
    
"polen"
    
"erva"
    
"cogumelos"
    
"lsd"
    
"cocaina"
    
"heroina"
    
"crack"
    
"marijuana" 
}; 

// registered item id's 
new gItems[Items]; 

new 
gCvarMenuTitle;

new 
gCvarSpawnMenu;

// speed of the player 
new Float:gSpeed[MAX_PLAYERS+1]; 

public 
plugin_init() { 
    
// hook player spawn to reset speed 
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawnPost"1); 
     
    
// hook when weapon changes to fix speed 
    
RegisterHam(Ham_Item_PreFrame"player""FwdPlayerResetMaxSpeedPost"1); 
    
    
gCvarMenuTitle register_cvar("shop_menu_title""\r[Drogas Menu]\yEscolhe a tua Droga:");
    
    
gCvarSpawnMenu register_cvar("shop_spawn_menu""1");
     
    
// prepare items 
    
for(new 0Itemsi++) { 
        
// register item to shop 
        
gItems[i] = shop_add_item(gItemNames[i], gItemShortNames[i]); 
    } 


public 
FwdPlayerSpawnPost(id) { 
    
// if player had speed and is alive 
    
if(gSpeed[id] > 0.0 && is_user_alive(id)) { 
        
// remove speed 
        
gSpeed[id] = 0.0
        
set_user_maxspeed(id, -1.0); 
    } 


public 
FwdPlayerResetMaxSpeedPost(id) { 
    
// check if player has speed and is alive and is not during freeze time 
    
if(gSpeed[id] > 0.0 && is_user_alive(id) && get_user_maxspeed(id) != 1.0) { 
        
// set back player's speed 
        
set_user_maxspeed(idgSpeed[id]); 
    } 


public 
CallbackItemAllowed(itemid) { 
    
// get item constant from item id 
    
for(new 0Itemsi++) { 
        
// check if found item 
        
if(gItems[i] == item) { 
            
// can only use these items while alive 
            
if(!is_user_alive(id)) { 
                return 
SHOP_ITEM_DISABLED
            } 
             
            
// if an admin reserved item and not an admin 
            
if((== Item_Heroina || == Item_Crack || == Item_Marijuana) && !access(idADMIN_RESERVATION)) { 
                return 
SHOP_ITEM_DISABLED
            } 
             
            
// player is allowed this item 
            
return SHOP_ITEM_ENABLED
        } 
    } 
     
    
// player not allowed item, so hide item from menu 
    
return SHOP_ITEM_HIDDEN


public 
shop_item_selected(itemid) { 
    
// find which item was selected, if one from this plugin 
    
for(new 0Itemsi++) { 
        
// check if found item 
        
if(gItems[i] == item) { 
            
// switch item for specific giving 
            
switch(i) { 
                case 
Item_Polen: { 
                    
// handle selection 
                    
set_user_health(idget_user_health(id) + 10); 
                } 
                case 
Item_Erva: { 
                    
// handle selection 
                    
set_user_health(idget_user_health(id) + 15); 
                } 
                case 
Item_Cogumelos: { 
                    
// handle selection 
                    
set_user_frags(idget_user_frags(id) + 1); 
                } 
                case 
Item_LSD: { 
                    
// handle selection 
                    
cs_set_user_money(idcs_get_user_money(id) + 750); 
                } 
                case 
Item_Cocaina: { 
                    
// handle selection 
                    
set_maxspeed(id310.0); 
                } 
                case 
Item_Heroina: { 
                    
// handle selection 
                    
set_maxspeed(id350.0); 
                    
set_user_health(idget_user_health(id) + 25); 
                } 
                case 
Item_Crack: { 
                    
// handle selection 
                    
set_user_health(idget_user_health(id) + 25); 
                    
cs_set_user_money(idcs_get_user_money(id) + 850); 
                } 
                case 
Item_Marijuana: { 
                    
// handle selection 
                    
set_maxspeed(id360.0); 
                    
set_user_health(idget_user_health(id) + 30); 
                    
cs_set_user_money(idcs_get_user_money(id) + 1000); 
                } 
            } 
             
            
// found item, so don't look anymore 
            
break; 
        } 
    } 


set_maxspeed(idFloat:speed) { 
    
gSpeed[id] = speed
    
set_user_maxspeed(idspeed); 

but have errors
LINE 174 warning 204 symbol is assigned a value that is never used "gCvarMenuTitle"
and another 174 warning 204 symbol is assigned a value that is never used "gCvarSpawnMenu"
but compile
xfire97 is offline
xfire97
Member
Join Date: Aug 2011
Old 03-01-2012 , 18:54   Re: Give velocity when buy
Reply With Quote #30

And doesnt work, when i spawn dont appear the menu, any ideia exolent.
xfire97 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 14:16.


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