Raised This Month: $ Target: $400
 0% 

Point shop doesn't work


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 03-27-2011 , 05:48   Point shop doesn't work
Reply With Quote #1

So point shop doesn't work, when i buy something it doesn't minus points and buy, I can't find the problem.

PHP Code:
public shop(id)
{
    if(!
is_user_alive(id))
    return 
PLUGIN_HANDLED;

        new 
menu menu_create("\rPoint Shop" "Shop_Handler");
        
menu_additem(menu ,"\wAmmo \d(100 Points)""1" 0);
    if(
HeTry[id] < 3)
    {
            
menu_additem(menu ,"\wHe Grenade \d(50 Points)""2" 0);
    }
    else if(
HeTry[id] == 3)
    {
            
menu_additem(menu ,"\dHe Grenade (You bought it already 3 times)""2" 0);
    }
 
        
menu_setprop(menu MPROP_EXIT MEXIT_ALL);
 
        
menu_display(id menu 0);

        return 
PLUGIN_CONTINUE;
}

public 
Shop_Handler(idmenuitemplayer)
{
   if (
item == MENU_EXIT)
   {
      
menu_destroy(menu)
      return 
PLUGIN_HANDLED
   
}

   new 
data[6], iName[64]
   new 
accesscallback
   menu_item_getinfo
(menuitemaccessdata5iName63callback)
   
   new 
key str_to_num(data)

   new 
Point gPoints[id];
   
   switch(
key)
   {
      case 
1:
      {
         if (
Point get_pcvar_num(cvar_ammocost))
         {
            
client_printcolor(id"/y[/ctrCorp/y]:: You don't have enough points!");
            return 
PLUGIN_HANDLED;
         }

         
client_printcolor(id"/y[/ctrCorp/y]:: You bought ammo!"); 
            
         
gPoints[id] -= get_pcvar_num(cvar_ammocost);
      }

      case 
2:
      {
         if(
Point get_pcvar_num(cvar_hecost))
         {
            
client_printcolor(id"/y[/ctrCorp/y]:: You don't have enough points!");
            return 
PLUGIN_HANDLED;
         }
     if(
HeTry[id] < 3)
     {
        
HeTry[id]++
               
give_item(id"weapon_hegrenade")
     }

         
client_printcolor(id"/y[/ctrCorp/y]:: You bought He grenade!"); 
            
         
gPoints[id] -= get_pcvar_num(cvar_hecost);
      }
   }
   
menu_destroy(menu)
   return 
PLUGIN_HANDLED;

DoviuX is offline
Send a message via Skype™ to DoviuX
 



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:34.


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