[CSS] /sell

Hello,



My code for sell item is good, unless the withdrawal of money to the buyer and adding money to the seller in case the buyer purchases the item Click post title for more details



Can someone fix it?




PHP Code:







#include <sourcemod>
#include <sdktools>
#include "smlib.inc"

new g_offset = -1;

public 
Plugin:myinfo 

    
name "Menu de vente"
    
author "Delachambre"
    
description "/vendre"
    
version "1.0"
    
url "http://vip-magnetik.fr" 
};

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_vendre"Command_vendre);
    
    
g_offset FindSendPropOffs("CCSPlayer""m_iAccount");
}

public 
Action:Command_vendre(clientargs)
{
    if (
Client_HasAdminFlags(clientADMFLAG_ROOT))
    {
        new 
Handle:menu CreateMenu(
vente);
        
SetMenuTitle(menu"Choisis ce que tu veut vendre :");
        
AddMenuItem(menu"Fumigene""Fumigene");
        
AddMenuItem(menu"Flash""Flash");
        
AddMenuItem(menu"Grenade""Grenade");
        
DisplayMenu(menu< /span>client15);
    }
    else
    {
        
PrintToChat(client"\x02[JailRP] : Vous n'avez pas accès Ã  cette commande");
    }
}

public 
vente(Handle:menuMenuAction:actionclientparam2)
{
    if (
action == MenuAction_Select)
    {
        new&nb sp;
String:info[32];
        
GetMenuItem(menuparam2infosizeof(info));
            
        new 
GetClientAimTarget(clienttrue);
            
        new 
Float:entorigin[3], Float:clientent[3];
        
GetEntPropVector(iProp_Send"m_vecOrigin"entorigin);
        
GetEntPropVector(clientProp_Send"m_vecOrigin"clientent);
            
        if (
StrEqual(info"Fumigene"))
        {
            new 
Handle :menu CreateMenu(ventefumi);
            
SetMenuTitle(menu"Voulez vous acheté une Fumigene Ã  200$ ?");
            
AddMenuItem(menu"Oui""Oui");
            
AddMenuItem(menu"Non""Non");
            
DisplayMenu(menui
15);
        }
        if (
StrEqual(info"Flash"))
        {
            new 
Handle:menu CreateMenu(venteflash);
            
SetMenuTitle(menu"Voulez vous acheté une Flash Ã  250$ ?");
            
AddMenuItem(menu"Oui""Oui");
            
AddMenuItem(menu"Non""Non");
            
DisplayMenu(menui15);
        }
        if (
StrEqual(info"Grenade"))
        {
            new 
Handle:menu CreateMenu( ventegrenade);
            
SetMenuTitle(menu"Voulez vous acheté une Grenade Ã  400$ ?");
            
AddMenuItem(menu"Oui""Oui");
            
AddMenuItem(menu"Non""Non");
            
DisplayMenu(menui15);
         }
    }
    else if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
}

public 
ventefumi(Handle:menuMenuAction:actionclientparam2)
{
    new 
GetClientAimTarget(clienttrue);
            
    new < /span>Float:entorigin[3], Float:clientent[3];
    
GetEntPropVector(iProp_Send"m_vecOrigin"entorigin);
    
GetEntPropVector(clientProp_Send"m_vecOrigin"clientent);
        
    if (
action == MenuAction_Select)
    {
        new 
String:infos[32];
        
GetMenuItem(menuparam2infossizeof(infos));

        if (
StrEqual(infos"Oui"))
        {
            
PrintToChat(client"\x04[JailMod] : Vous avez acheté une fumigène a 200$.");
            
GivePlayerItem(
client"weapon_smokegrenade");
            
DelCash(client200);
            
Addcash(i200);
        }
        if (
StrEqual(infos"Non"))
        {
            
PrintToChat(client"\x04[JailMod] : Vous avez refusé l'achat d'une&nb sp;fumigène a 200$.");
        }
    }
    else if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
}

public 
venteflash(Handle:menuMenuAction:actionclientparam2)
{
    new 
GetClientAimTarget(clienttrue);
        ;     
    new 
Float:entorigin[3], Float:clientent[3];
    
GetEntPropVector(iProp_Send"m_vecOrigin"entorigin);
    
GetEntPropVector(clientProp_Send"m_vecOrigin"clientent);
        
    if (
action == MenuAction_Select)
    {
 &nbs p;      new 
String:infoss[32];
        
GetMenuItem(menuparam2infosssizeof(infoss));

        if (
StrEqual(infoss"Oui"))
        {
            
PrintToChat(client"\x04[JailMod] : Vous avez acheté une flash a 250$.");
      &n bsp;     
GivePlayerItem(client"weapon_flashbang");
            
DelCash(client250);
            
Addcash(i250);
        }
        if (
StrEqual(infoss"Non"))
        {
            
PrintToChat(client"\x04[JailMod 3; : Vous avez refusé l'achat d'une flash a 250$.");
        }
    }
    else if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
}

public 
ventegrenade(Handle:menuMenuAction:actionclientparam2)
{
    new 
GetClientAimTarget(clienttrue);
            
    new 
Float:entorigin[3], Float:clientent[3];
    
GetEntPropVector(iProp_Send"m_vecOrigin"entorigin);
    
GetEntPropVector(clientProp_Send"m_vecOrigin"clientent);
    
    if (
action == MenuAction_Select)
    {
        new 
String:infosss[32];
        
GetMenuItem(menuparam2infossssizeof(infosss));

        if (
StrEqual(infosss"Oui"))
        {
            
PrintToChat(client"\x04[JailMod] : Vous avez acheté une grenade a 400$.");
            
GivePlayerItem(client"weapon_hegrenade");
            
DelCash(client400);
            
Addcash(i400);
        }
        if (
StrEqual(infosss"Non"))
        {
            
PrintToChat(client"\x04[JailMod] : Vous avez refusé l'achat d'une grenade a 400$.");
        }
    }
    else if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
}

DelCash(clientmontant)
{
    new 
current GetEntData(clientg_offset);
    new 
total;
   ;  if ((
current montant) > 16000)    total 16000;
    else                                    
total = (current montant);
    
    
SetEntData(clientg_offsettotal);
}

Addcash(clientmontant)
{
  & nbsp; new 
currents GetEntData(clientg_offset);
    new 
totals;
    if ((
currents montant) > 16000)    totals 16000;
    else                                    
totals = (currents montant);
    
    
SetEntData (clientg_offsettotals);










thanks in advance, sorry for my bad English, i am French.


Orignal From: [CSS] /sell

No comments

Not a single link is allowed to submit in comment :o