Raised This Month: $70 Target: $400
 17% 

OciXCrom's Custom Shop + API


Post New Thread Reply   
 
Thread Tools Display Modes
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-04-2016 , 20:42   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #21

Few days ago you said that you fixed the problem and now you are saying the opposite? Why did you post a video tutorial on how to install basebuilder? I can't help you unless you start speaking the same language as me. Please stop spamming my topic with comments that lead nowhere.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Mohammad Hlwani
Member
Join Date: May 2016
Old 07-05-2016 , 09:24   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #22

Quote:
Originally Posted by OciXCrom View Post
Few days ago you said that you fixed the problem and now you are saying the opposite? Why did you post a video tutorial on how to install basebuilder? I can't help you unless you start speaking the same language as me. Please stop spamming my topic with comments that lead nowhere.
you mean you dont want to help me ?
Mohammad Hlwani is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-05-2016 , 09:43   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #23

Quote:
Originally Posted by Mohammad Hlwani View Post
you mean you dont want to help me ?
He does, just explain to him what he asks for nothing else.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Mohammad Hlwani
Member
Join Date: May 2016
Old 07-09-2016 , 11:39   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #24

Quote:
Originally Posted by Napoleon_be View Post
He does, just explain to him what he asks for nothing else.
i told him man this is the problem

when i enter the game before choose team the game be normal when i enter an team the game turn off than give me this error

please if you know help me plz
Mohammad Hlwani is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-09-2016 , 11:40   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #25

You get thisproblem only when this plugin is enabled?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Mohammad Hlwani
Member
Join Date: May 2016
Old 07-09-2016 , 12:45   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #26

Quote:
Originally Posted by Napoleon_be View Post
You get thisproblem only when this plugin is enabled?
yes only
Mohammad Hlwani is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-09-2016 , 14:31   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #27

PodBot is causing this problem and I don't know what I should do to prevent that. Some part of the plugin needs to be stopped for bots, but I don't know which. However, try it with this code and let me know if it changed something:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cshop_settings>
#include <fun>
#include <hamsandwich>
#include <nvault>

#define PLUGIN_VERSION "3.3"
#define TASK_HUDBAR 388838

#define mtop(%1) floatround(float(%1) / 10.0, floatround_floor)

enum _:Items
{
    
iName[64],
    
iPrice,
    
iLimit,
    
iSound[128],
    
Float:iSeconds,
    
iTeam,
    
iFlag[2]
}

enum _:Settings
{
    
stgPrefix[32],
    
stgTitle[128],
    
stgTitlePage[128],
    
stgSoundError[128],
    
stgSoundExpire[128],
    
stgSoundOpen[128],
    
stgBuySoundType,
    
stgExpireSoundType,
    
stgOpenSoundType,
    
stgPrevPage[32],
    
stgNextPage[32],
    
stgMenuExit[32],
    
stgPerPage,
    
stgFlag[2],
    
stgTeam,
    
stgPointsEnable,
    
stgMoneyName[32],
    
stgMoneyNameUC[32],
    
stgCurrency[16],
    
stgSavePoints,
    
stgSaveType,
    
stgShowTeamed,
    
stgItemTeamed[32],
    
stgShowFlagged,
    
stgItemFlagged[32],
    
stgLimitType,
    
stgHideLimited,
    
stgOpenAtSpawn,
    
stgRewardNormal,
    
stgRewardHeadshot,
    
stgRewardKnife,
    
stgRewardVip,
    
stgVipFlag[2],
    
stgTeamKill,
    
stgKillMessage,
    
stgHudEnable,
    
stgHudRed,
    
stgHudGreen,
    
stgHudBlue,
    
Float:stgHudX,
    
Float:stgHudY
}

enum _:Fields
{
    
FIELD_TEAM,
    
FIELD_MONEY,
    
FIELD_CURRENCY,
    
FIELD_NEWLINE,
    
FIELD_PAGE
}

new const 
g_szVaults[][] = { "CustomShop""CustomShopIP""CustomShopSI" }
new const 
g_szColorReplace[][] = { "!g""^4""!t""^3""!n""^1" }
new const 
g_szHideChat[][] = { "\r""\y""\w""\d""\R" }

new Array:
g_aItems
new g_eSettings[Settings]
new 
g_szFields[Fields][16] = { "%team%""%money%""%currency%""%newline%""%page%" }

new Array:
g_aSounds
new g_iTotalItems
new g_msgSayText
new g_iLimit[33][MAX_ITEMS]
new 
g_iItemTeamLimit[4][MAX_ITEMS]
new 
g_iItemLimit[MAX_ITEMS]
new 
bool:g_blHasItem[33][MAX_ITEMS]
new 
g_szItems[MAX_ITEMS][192]
new 
g_szItemsLoaded[192]
new 
g_szTeams[4][32]
new 
g_szInfo[33][35]
new 
g_iPoints[33]
new 
g_fwdSelectItem
new g_fwdRemoveItem
new g_iVault
new g_iHUD

public plugin_init()
{
    
register_plugin("Custom Shop"PLUGIN_VERSION"OciXCrom")
    
register_cvar("CustomShop"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
register_dictionary("CustomShop.txt")
    
register_logevent("eventRoundStart"2"0=World triggered""1=Round_Start")
    
RegisterHam(Ham_Spawn"player""eventPlayerSpawn"1)
    
register_event("DeathMsg""eventPlayerKilled""a")
    
register_concmd("cshop_points""cmdGivePoints"FLAG_ADMIN"<nick|#userid> <points to give/take>")
    
register_concmd("cshop_items""cmdListItems"FLAG_ADMIN"-- lists all loaded items")
    
g_fwdSelectItem CreateMultiForward("cshopItemBought"ET_STOPFP_CELLFP_CELL)
    
g_fwdRemoveItem CreateMultiForward("cshopItemRemoved"ET_IGNOREFP_CELLFP_CELL)
    
g_msgSayText get_user_msgid("SayText")
    
g_iVault nvault_open(g_szVaults[g_eSettings[stgSaveType]])
    
g_iHUD CreateHudSyncObj()
    
formStuff()
}

formStuff()
{
    new 
szTemp[128], eItem[Items]
    
    for(new 
ig_iTotalItemsi++)
    {
        
ArrayGetArray(g_aItemsieItem)
        
formatex(g_szItems[i], charsmax(g_szItems[]), "#%i: %s [%L: %i%s"1eItem[iName], LANG_TYPE"CSHOP_PRICE"eItem[iPrice], g_eSettings[stgCurrency])
        
        if(
eItem[iLimit])
            
format(g_szItems[i], charsmax(g_szItems[]), "%s | %L: %i"g_szItems[i], LANG_TYPE"CSHOP_LIMIT"eItem[iLimit])
            
        if(
eItem[iSeconds])
            
format(g_szItems[i], charsmax(g_szItems[]), "%s | %L: %.1f"g_szItems[i], LANG_TYPE"CSHOP_TIME"eItem[iSeconds])
            
        if(
eItem[iTeam])
            
format(g_szItems[i], charsmax(g_szItems[]), "%s | %L: %i"g_szItems[i], LANG_TYPE"CSHOP_TEAM"eItem[iTeam])
            
        if(
eItem[iFlag])
            
format(g_szItems[i], charsmax(g_szItems[]), "%s | %L: %s"g_szItems[i], LANG_TYPE"CSHOP_FLAG"eItem[iFlag])
            
        
add(g_szItems[i], charsmax(g_szItems[]), " ]")
    }
    
    
formatex(g_szItemsLoadedcharsmax(g_szItemsLoaded), "%L"LANG_TYPE"CSHOP_ITEMS_LOADED"g_iTotalItems)
    
    if(
contain(g_eSettings[stgTitle], g_szFields[FIELD_CURRENCY]) != -1)
        
replace_all(g_eSettings[stgTitle], charsmax(g_eSettings[stgTitle]), g_szFields[FIELD_CURRENCY], g_eSettings[stgMoneyNameUC])
        
    if(
contain(g_eSettings[stgTitle], g_szFields[FIELD_NEWLINE]) != -1)
        
replace_all(g_eSettings[stgTitle], charsmax(g_eSettings[stgTitle]), g_szFields[FIELD_NEWLINE], "^n")
    
    if(
contain(g_eSettings[stgTitlePage], g_szFields[FIELD_NEWLINE]) != -1)
        
replace_all(g_eSettings[stgTitlePage], charsmax(g_eSettings[stgTitlePage]), g_szFields[FIELD_NEWLINE], "^n")
        
    if(
contain(g_eSettings[stgTitlePage], g_szFields[FIELD_PAGE]) != -1)
    {
        
formatex(szTempcharsmax(szTemp), "%L"LANG_TYPE"CSHOP_PAGE")
        
replace_all(g_eSettings[stgTitlePage], charsmax(g_eSettings[stgTitlePage]), g_szFields[FIELD_PAGE], szTemp)
    }
}

public 
plugin_precache()
{
    
g_aItems ArrayCreate(Items)
    
g_aSounds ArrayCreate(1281)
    
fileRead()
}

public 
plugin_end()
{
    
ArrayDestroy(g_aItems)
    
ArrayDestroy(g_aSounds)
}

fileRead()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/CustomShop.ini"szConfigsName)
    new 
iFilePointer fopen(szFilename"rt")
    
    if(
iFilePointer)
    {
        new 
szData[160], szKey[32], szValue[128]
        
        while(!
feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)
            
            switch(
szData[0])
            {
                case 
EOS';': continue
                default:
                {
                    
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                    
trim(szKey); trim(szValue)
                    
                    if(
is_blank(szValue))
                        continue
                    
                    if(
equal(szKey"CSHOP_PREFIX"))
                        
copy(g_eSettings[stgPrefix], charsmax(g_eSettings[stgPrefix]), szValue)
                    else if(
equal(szKey"CSHOP_TITLE"))
                        
copy(g_eSettings[stgTitle], charsmax(g_eSettings[stgTitle]), szValue)
                    else if(
equal(szKey"CSHOP_TITLE_PAGE"))
                        
copy(g_eSettings[stgTitlePage], charsmax(g_eSettings[stgTitlePage]), szValue)
                    else if(
equal(szKey"CSHOP_TEAM_NAMES"))
                    {
                        for(new 
i4i++)
                        {
                            
strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ',')
                            
trim(szKey); trim(szValue)
                            
copy(g_szTeams[i], charsmax(g_szTeams[]), szKey)
                        }
                    }
                    else if(
equal(szKey"CSHOP_SOUND_ERROR"))
                    {
                        
copy(g_eSettings[stgSoundError], charsmax(g_eSettings[stgSoundError]), szValue)
                        
precache_sound(szValue)
                    }
                    else if(
equal(szKey"CSHOP_SOUND_EXPIRE"))
                    {
                        
copy(g_eSettings[stgSoundExpire], charsmax(g_eSettings[stgSoundExpire]), szValue)
                        
precache_sound(szValue)
                    }
                    else if(
equal(szKey"CSHOP_SOUND_OPEN"))
                    {
                        
copy(g_eSettings[stgSoundOpen], charsmax(g_eSettings[stgSoundOpen]), szValue)
                        
precache_sound(szValue)
                    }
                    else if(
equal(szKey"CSHOP_BUYSOUND_TYPE"))
                        
g_eSettings[stgBuySoundType] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_EXPIRESOUND_TYPE"))
                        
g_eSettings[stgExpireSoundType] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_OPENSOUND_TYPE"))
                        
g_eSettings[stgOpenSoundType] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_PREVPAGE"))
                        
copy(g_eSettings[stgPrevPage], charsmax(g_eSettings[stgPrevPage]), szValue)
                    else if(
equal(szKey"CSHOP_NEXTPAGE"))
                        
copy(g_eSettings[stgNextPage], charsmax(g_eSettings[stgNextPage]), szValue)
                    else if(
equal(szKey"CSHOP_EXITMENU"))
                        
copy(g_eSettings[stgMenuExit], charsmax(g_eSettings[stgMenuExit]), szValue)
                    else if(
equal(szKey"CSHOP_PERPAGE"))
                        
g_eSettings[stgPerPage] = clamp(str_to_num(szValue), 07)
                    else if(
equal(szKey"CSHOP_COMMANDS"))
                    {
                        while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                        {
                            
trim(szKey); trim(szValue)
                            
register_clcmd(szKey"menuShop")
                        }
                    }
                    else if(
equal(szKey"CSHOP_FLAG"))
                        
copy(g_eSettings[stgFlag], charsmax(g_eSettings[stgFlag]), szValue)
                    else if(
equal(szKey"CSHOP_TEAM"))
                        
g_eSettings[stgTeam] = clamp(str_to_num(szValue), 03)
                    else if(
equal(szKey"CSHOP_POINTS_ENABLE"))
                        
g_eSettings[stgPointsEnable] = clamp(str_to_num(szValue), 01)
                    else if((
g_eSettings[stgPointsEnable] && equal(szKey"CSHOP_POINTS_NAME")) || (!g_eSettings[stgPointsEnable] && equal(szKey"CSHOP_MONEY_NAME")))
                    {
                        
copy(g_eSettings[stgMoneyName], charsmax(g_eSettings[stgMoneyName]), szValue)
                        
copy(g_eSettings[stgMoneyNameUC], charsmax(g_eSettings[stgMoneyNameUC]), szValue)
                        
ucfirst(g_eSettings[stgMoneyNameUC])
                    }
                    else if((
g_eSettings[stgPointsEnable] && equal(szKey"CSHOP_POINTS_CURRENCY")) || (!g_eSettings[stgPointsEnable] && equal(szKey"CSHOP_MONEY_CURRENCY")))
                        
copy(g_eSettings[stgCurrency], charsmax(g_eSettings[stgCurrency]), szValue)
                    else if(
equal(szKey"CSHOP_POINTS_SAVE"))
                        
g_eSettings[stgSavePoints] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_SAVE_TYPE"))
                        
g_eSettings[stgSaveType] = clamp(str_to_num(szValue), 02)
                    else if(
equal(szKey"CSHOP_POINTS_COMMANDS"))
                    {
                        while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                        {
                            
trim(szKey); trim(szValue)
                            
register_clcmd(szKey"cmdPoints")
                        }
                    }
                    else if(
equal(szKey"CSHOP_SHOW_TEAMED"))
                        
g_eSettings[stgShowTeamed] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_ITEM_TEAMED"))
                        
copy(g_eSettings[stgItemTeamed], charsmax(g_eSettings[stgItemTeamed]), szValue)
                    else if(
equal(szKey"CSHOP_SHOW_FLAGGED"))
                        
g_eSettings[stgShowFlagged] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_ITEM_FLAGGED"))
                        
copy(g_eSettings[stgItemFlagged], charsmax(g_eSettings[stgItemFlagged]), szValue)
                    else if(
equal(szKey"CSHOP_LIMIT_TYPE"))
                        
g_eSettings[stgLimitType] = clamp(str_to_num(szValue), 02)
                    else if(
equal(szKey"CSHOP_HIDE_LIMITED"))
                        
g_eSettings[stgHideLimited] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_OPEN_AT_SPAWN"))
                        
g_eSettings[stgOpenAtSpawn] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_REWARD_NORMAL"))
                        
g_eSettings[stgRewardNormal] = str_to_num(szValue)
                    else if(
equal(szKey"CSHOP_REWARD_HEADSHOT"))
                        
g_eSettings[stgRewardHeadshot] = str_to_num(szValue)
                    else if(
equal(szKey"CSHOP_REWARD_KNIFE"))
                        
g_eSettings[stgRewardKnife] = str_to_num(szValue)
                    else if(
equal(szKey"CSHOP_REWARD_VIP"))
                        
g_eSettings[stgRewardVip] = str_to_num(szValue)
                    else if(
equal(szKey"CSHOP_VIP_FLAG"))
                        
copy(g_eSettings[stgVipFlag], charsmax(g_eSettings[stgVipFlag]), szValue)
                    else if(
equal(szKey"CSHOP_POINTS_TEAMKILL"))
                        
g_eSettings[stgTeamKill] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_KILL_MESSAGE"))
                        
g_eSettings[stgKillMessage] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_HUD_ENABLED"))
                        
g_eSettings[stgHudEnable] = clamp(str_to_num(szValue), 01)
                    else if(
equal(szKey"CSHOP_HUD_RED"))
                        
g_eSettings[stgHudRed] = clamp(str_to_num(szValue), 0255)
                    else if(
equal(szKey"CSHOP_HUD_GREEN"))
                        
g_eSettings[stgHudGreen] = clamp(str_to_num(szValue), 0255)
                    else if(
equal(szKey"CSHOP_HUD_BLUE"))
                        
g_eSettings[stgHudBlue] = clamp(str_to_num(szValue), 0255)
                    else if(
equal(szKey"CSHOP_HUD_X"))
                        
g_eSettings[stgHudX] = _:floatclamp(str_to_float(szValue), -1.01.0)
                    else if(
equal(szKey"CSHOP_HUD_Y"))
                        
g_eSettings[stgHudY] = _:floatclamp(str_to_float(szValue), -1.01.0)
                }
            }    
        }
        
        
fclose(iFilePointer)
    }
}

public 
client_disconnect(id)
    
nvault_read(id0g_szInfo[id])
        
public 
client_putinserver(id)
{
    
g_iPoints[id] = 0
    
    
switch(g_eSettings[stgSaveType])
    {
        case 
0get_user_name(idg_szInfo[id], charsmax(g_szInfo[]))
        case 
1get_user_ip(idg_szInfo[id], charsmax(g_szInfo[]), 1)
        case 
2get_user_authid(idg_szInfo[id], charsmax(g_szInfo[]))
    }
    
    
nvault_read(id1g_szInfo[id])
    
    if(
g_eSettings[stgPointsEnable] && g_eSettings[stgHudEnable])
        
set_task(1.0"showHUD"id TASK_HUDBAR__"b")
        
    
arrayset(g_iLimit[id], 0sizeof(g_iLimit[]))
    
arrayset(g_blHasItem[id], falsesizeof(g_blHasItem[]))
}

public 
client_infochanged(id)
{
    if(
g_eSettings[stgSaveType])
        return
        
    new 
szNewName[32], szOldName[32]
    
get_user_info(id"name"szNewNamecharsmax(szNewName))
    
get_user_name(idszOldNamecharsmax(szOldName))
    
    if(!
equal(szNewNameszOldName))
    {
        
nvault_read(id0szOldName)
        
nvault_read(id1szNewName)
    }
}

nvault_read(idiTypeszInfo[])
{
    if(!
g_eSettings[stgSavePoints] || is_user_bot(id))
        return
        
    new 
szPoints[20]
    
    switch(
iType)
    {
        case 
0:
        {
            
num_to_str(g_iPoints[id], szPointscharsmax(szPoints))
            
nvault_set(g_iVaultszInfoszPoints)
        }
        case 
1:
        {
            
nvault_get(g_iVaultszInfoszPointscharsmax(szPoints))
            
g_iPoints[id] = str_to_num(szPoints)
        }
    }
}

public 
showHUD(id)
{
    
id -= TASK_HUDBAR
    
    
if(!is_user_connected(id))
    {
        
remove_task(id TASK_HUDBAR)
        return
    }
    
    
set_hudmessage(g_eSettings[stgHudRed], g_eSettings[stgHudGreen], g_eSettings[stgHudBlue], g_eSettings[stgHudX], g_eSettings[stgHudY], 01.01.5)
    
ShowSyncHudMsg(idg_iHUD"%s: %i"g_eSettings[stgMoneyNameUC], g_iPoints[id])
}

public 
eventRoundStart()
{
    switch(
g_eSettings[stgLimitType])
    {
        case 
1:
        {
            for(new 
i4i++)
                
arrayset(g_iItemTeamLimit[i], 0sizeof(g_iItemTeamLimit[]))
        }
        case 
2:    arrayset(g_iItemLimit0sizeof(g_iItemLimit))
    }
}

public 
eventPlayerSpawn(id)
{
    if(!
g_eSettings[stgLimitType])
    {
        
arrayset(g_iLimit[id], 0sizeof(g_iLimit[]))
        
        for(new 
ig_iTotalItemsi++)
            if(
g_blHasItem[id][i])
                
removeItem(idi)
    }
    
    if(
g_eSettings[stgOpenAtSpawn])
        if(
has_access_flag(id))
            if(
has_access_team(id))
                if(
is_user_alive(id))
                    
menuShop(id)
}

public 
eventPlayerKilled()
{
    if(!
g_eSettings[stgPointsEnable])
        return
        
    new 
iAttacker read_data(1)
    new 
iVictim read_data(2)
    
    if(!
is_user_connected(iAttacker) || !is_user_connected(iVictim) || iAttacker == iVictim)
        return
    
    if(!
has_access_flag(iAttacker))
        return
        
    if(
get_user_team(iAttacker) == get_user_team(iVictim))
        if(!
g_eSettings[stgTeamKill])
            return
    
    new 
iReward
    
    iReward 
+= g_eSettings[stgRewardNormal]
    
    if(
read_data(3))
        
iReward += g_eSettings[stgRewardHeadshot]
    
    new 
szWeapon[16]
    
read_data(4szWeaponcharsmax(szWeapon))
    
    if(
equal(szWeapon"knife"))
        
iReward += g_eSettings[stgRewardKnife]
        
    if(
g_eSettings[stgRewardVip] && get_user_flags(iAttacker) & g_eSettings[stgVipFlag])
        
iReward += g_eSettings[stgRewardVip]
        
    
g_iPoints[iAttacker] += iReward
    
    
if(g_eSettings[stgKillMessage])
    {
        new 
szName[32]
        
get_user_name(iVictimszNamecharsmax(szName))
        
ColorChat(iAttacker"%L"iAttacker"CSHOP_KILL"iRewardg_eSettings[stgCurrency], szName)
    }
}

public 
cmdPoints(id)
{
    if(
g_eSettings[stgPointsEnable])
        
ColorChat(id"%L"id"CSHOP_POINTS"g_iPoints[id], g_eSettings[stgCurrency])
    else
        
ColorChat(id"%L"id"CSHOP_POINTS_DISABLED")
        
    return 
PLUGIN_HANDLED
}

public 
cmdGivePoints(idiLeveliCid)
{
    if(!
cmd_access(idiLeveliCid3))
        return 
PLUGIN_HANDLED
        
    
if(!g_eSettings[stgPointsEnable])
    {
        
ColorChat(id"%L"id"CSHOP_POINTS_DISABLED")
        return 
PLUGIN_HANDLED
    
}

    new 
szPlayer[32]
    
read_argv(1szPlayercharsmax(szPlayer))
    
    new 
iPlayer cmd_target(idszPlayer0)
    
    if(!
iPlayer)
        return 
PLUGIN_HANDLED
    
    
new szAmount[10]
    
read_argv(2szAmountcharsmax(szAmount))
    
    new 
iAmount str_to_num(szAmount)
    new 
bool:blGive szAmount[0] == '-' false true
    
    g_iPoints
[iPlayer] += iAmount
    
    
if(!blGive)
        
iAmount *= -1
    
    
if(is_user_connected(id))
    {
        new 
szMessage[192], szName[32], szName2[32]
        
get_user_name(idszNamecharsmax(szName))
        
get_user_name(iPlayerszName2charsmax(szName2))
        
formatex(szMessagecharsmax(szMessage), "%L"LANG_TYPEblGive "CSHOP_CMD_GIVE" "CSHOP_CMD_TAKE"szNameiAmountg_eSettings[stgCurrency], szName2)
        
ColorChat(0szMessage)
        
        for(new 
isizeof(g_szColorReplace); += 2)
            
replace_all(szMessagecharsmax(szMessage), g_szColorReplace[i], "")
        
        
log_amx(szMessage)
    }
    
    return 
PLUGIN_HANDLED
}

public 
cmdListItems(idiLeveliCid)
{
    if(!
cmd_access(idiLeveliCid1))
        return 
PLUGIN_HANDLED
        
    client_print
(idprint_consoleg_szItemsLoaded)
    
    for(new 
ig_iTotalItemsi++)
        
client_print(idprint_consoleg_szItems[i])
    
    
client_print(idprint_consoleg_szItemsLoaded)
    return 
PLUGIN_HANDLED
}

public 
menuShop(id)
{
    if(!
has_access_flag(id))
    {
        
ColorChat(id"%L"id"CSHOP_NOTALLOWED_FLAG")
        
errorSound(id)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iUserTeam get_user_team(id)
    
    if(!
has_access_team(id))
    {
        
ColorChat(id"%L"id"CSHOP_NOTALLOWED_TEAM")
        
errorSound(id)
        return 
PLUGIN_HANDLED
    
}
    
    if(!
is_user_alive(id))
    {
        
ColorChat(id"%L"id"CSHOP_NOTALLOWED_DEAD")
        
errorSound(id)
        return 
PLUGIN_HANDLED
    
}
    
    if(!
is_blank(g_eSettings[stgSoundOpen]))
    {
        switch(
g_eSettings[stgOpenSoundType])
        {
            case 
0emitSound(idg_eSettings[stgSoundOpen])
            case 
1speakSound(idg_eSettings[stgSoundOpen])
        }
    }
    
    new 
szTitle[256], szItem[128], szKey[5], eItem[Items], iUserLimit
    
new iMoney g_eSettings[stgPointsEnable] ? g_iPoints[id] : get_user_money(id)
    new 
iFlags get_user_flags(id)
    
    
copy(szTitlecharsmax(szTitle), g_eSettings[stgTitle])
    
    if(
contain(szTitleg_szFields[FIELD_TEAM]) != -1)
        
replace_all(szTitlecharsmax(szTitle), g_szFields[FIELD_TEAM], g_szTeams[iUserTeam])
    
    if(
contain(szTitleg_szFields[FIELD_MONEY]) != -1)
    {
        new 
szMoney[16]
        
num_to_str(iMoneyszMoneycharsmax(szMoney))
        
replace_all(szTitlecharsmax(szTitle), g_szFields[FIELD_MONEY], szMoney)
    }
        
    new 
iMenu menu_create(szTitle"handlerShop")
    
    for(new 
ig_iTotalItemsi++)
    {
        
ArrayGetArray(g_aItemsieItem)
        
num_to_str(iszKeycharsmax(szKey))
        
        if(
eItem[iTeam] && eItem[iTeam] != iUserTeam)
        {
            if(
g_eSettings[stgShowTeamed])
            {
                
formatex(szItemcharsmax(szItem), "\d%s %s"eItem[iName], g_eSettings[stgItemTeamed])
                goto 
cpAddItem
            
}
            
            continue
        }
        
        if(!
is_blank(eItem[iFlag]) && !(iFlags read_flags(eItem[iFlag])))
        {
            if(
g_eSettings[stgShowFlagged])
            {
                
formatex(szItemcharsmax(szItem), "\d%s %s"eItem[iName], g_eSettings[stgItemFlagged])
                goto 
cpAddItem
            
}
                
            continue
        }
        
        
iUserLimit get_user_limit(idi)
        
        if(
g_eSettings[stgHideLimited] && (eItem[iLimit] && iUserLimit == eItem[iLimit]))
            continue
        
        if(
eItem[iLimit])
            
formatex(szItemcharsmax(szItem), "%s%s \r[\y%i%s\r] [\y%i\r/\y%i\r]"
            (
iMoney >= eItem[iPrice] && iUserLimit eItem[iLimit]) ? "" "\d"eItem[iName], eItem[iPrice], g_eSettings[stgCurrency], iUserLimiteItem[iLimit])
        else
            
formatex(szItemcharsmax(szItem), "%s%s \r[\y%i%s\r]"
            (
iMoney >= eItem[iPrice]) ? "" "\d"eItem[iName], eItem[iPrice], g_eSettings[stgCurrency])
        
        
cpAddItem:
        
menu_additem(iMenuszItemszKey)
    }
    
    new 
iPages menu_pages(iMenu)
    
    if(!
iPages)
    {
        
ColorChat(id"%L"id"CSHOP_NOITEMS")
        
errorSound(id)
    }
    else
    {
        if(
iPages 1)
        {
            
add(szTitlecharsmax(szTitle), g_eSettings[stgTitlePage])
            
menu_setprop(iMenuMPROP_TITLEszTitle)
        }
            
        
menu_setprop(iMenuMPROP_BACKNAMEg_eSettings[stgPrevPage])
        
menu_setprop(iMenuMPROP_NEXTNAMEg_eSettings[stgNextPage])
        
menu_setprop(iMenuMPROP_EXITNAMEg_eSettings[stgMenuExit])
        
menu_setprop(iMenuMPROP_PERPAGEg_eSettings[stgPerPage])
        
menu_display(idiMenu0)
    }
    
    return 
PLUGIN_HANDLED
}

public 
handlerShop(idiMenuiItem)
{
    if(
iItem == MENU_EXIT || !is_user_alive(id))
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
szName[64], szData[6], accesscallback
    menu_item_getinfo
(iMenuiItemaccessszDatacharsmax(szData), szNamecharsmax(szName), callback)
    new 
iKey str_to_num(szData)
    
    new 
eItem[Items]
    
ArrayGetArray(g_aItemsiKeyeItem)
    new 
iMoney g_eSettings[stgPointsEnable] ? g_iPoints[id] : get_user_money(id)
    new 
iUserLimit get_user_limit(idiKey)
    
    if(
eItem[iTeam] && eItem[iTeam] != get_user_team(id))
    {
        
ColorChat(id"%L"id"CSHOP_NOT_TEAM")
        
errorSound(id)
    }
    else if(!
is_blank(eItem[iFlag]) && !(get_user_flags(id) & read_flags(eItem[iFlag])))
    {
        
ColorChat(id"%L"id"CSHOP_NOT_FLAG")
        
errorSound(id)
    }
    else if(
iMoney eItem[iPrice])
    {
        
ColorChat(id"%L"id"CSHOP_NOT_MONEY"g_eSettings[stgMoneyName], iMoneyeItem[iPrice], g_eSettings[stgCurrency])
        
errorSound(id)
    }
    else if(
eItem[iLimit] && (iUserLimit == eItem[iLimit]))
    {
        
ColorChat(id"%L"id"CSHOP_NOT_LIMIT"iUserLimiteItem[iLimit])
        
errorSound(id)
    }
    else if(
eItem[iSeconds] && g_blHasItem[id][iKey])
    {
        
ColorChat(id"%L"id"CSHOP_NOT_DELAY"eItem[iSeconds])
        
errorSound(id)
    }
    else 
buyItem(idiKey)
    
    
menu_destroy(iMenu)
    return 
PLUGIN_HANDLED
}

buyItem(idiItem)
{
    new 
iReturn
    ExecuteForward
(g_fwdSelectItemiReturnidiItem)
    
    if(
iReturn)
        return 
iReturn
        
    
new eItem[Items]
    
ArrayGetArray(g_aItemsiItemeItem)
    
    if(
g_eSettings[stgPointsEnable])
        
g_iPoints[id] -= eItem[iPrice]
    else
        
take_user_money(ideItem[iPrice])
        
    
ColorChat(id"%L"id"CSHOP_ITEM_BOUGHT"eItem[iName], eItem[iPrice], g_eSettings[stgCurrency])
    
    switch(
g_eSettings[stgBuySoundType])
    {
        case 
0emitSound(ideItem[iSound])
        case 
1speakSound(ideItem[iSound])
    }
    
    switch(
g_eSettings[stgLimitType])
    {
        case 
0g_iLimit[id][iItem]++
        case 
1g_iItemTeamLimit[get_user_team(id)][iItem]++
        case 
2g_iItemLimit[iItem]++
    }
    
    
g_blHasItem[id][iItem] = true
    
    
if(eItem[iSeconds])
    {
        new 
iArray[2]
        
iArray[0] = id
        iArray
[1] = iItem
        set_task
(eItem[iSeconds], "autoRemoveItem"0iArray2)
    }
    
    return 
PLUGIN_HANDLED
}

public 
autoRemoveItem(iArray[2])
{
    new 
id iArray[0], iItem iArray[1], eItem[Items]
    
ArrayGetArray(g_aItemsiItemeItem)
    
removeItem(idiItem)
    
    if(
is_user_alive(id))
    {
        
ColorChat(id"%L"id"CSHOP_ITEM_EXPIRED"eItem[iSeconds], eItem[iName])
        
        switch(
g_eSettings[stgExpireSoundType])
        {
            case 
0:    emitSound(idg_eSettings[stgSoundExpire])
            case 
1:    speakSound(idg_eSettings[stgSoundExpire])
        }
    }
}

get_user_limit(idiItem)
{
    switch(
g_eSettings[stgLimitType])
    {
        case 
0: return g_iLimit[id][iItem]
        case 
1: return g_iItemTeamLimit[get_user_team(id)][iItem]
        case 
2: return g_iItemLimit[iItem]
    }
    
    return 
0
}

removeItem(idiItem)
{
    new 
iReturn
    g_blHasItem
[id][iItem] = false
    ExecuteForward
(g_fwdRemoveItemiReturnidiItem)
}
    
speakSound(idszSound[])
    
client_cmd(id"spk %s"szSound)
    
emitSound(idszSound[])
    
emit_sound(idCHAN_ITEMszSound1.0ATTN_NORM0PITCH_NORM)
    
errorSound(id)
    
speakSound(idg_eSettings[stgSoundError])
    
bool:has_access_flag(id)
    return (
equal(g_eSettings[stgFlag], "!") || get_user_flags(id) & read_flags(g_eSettings[stgFlag])) ? true false
    
bool
:has_access_team(id)
    return (!
g_eSettings[stgTeam] || get_user_team(id) == g_eSettings[stgTeam]) ? true false
    
bool
:is_blank(szString[])
    return 
szString[0] == EOS true false
    
public plugin_natives()
{
    
register_library("CustomShop")
    
register_native("cshopRegisterItem""_cshopRegisterItem")
    
register_native("cshopHasItem""_cshopHasItem")
    
register_native("cshopPointsEnabled""_cshopPointsEnabled")
    
register_native("cshopGetLimit""_cshopGetLimit")
    
register_native("cshopRemoveItem""_cshopRemoveItem")
    
register_native("cshopErrorSound""_cshopErrorSound")
    
register_native("cshopTotalItems""_cshopTotalItems")
    
register_native("cshopGivePoints""_cshopGivePoints")
    
register_native("ColorChat""_ColorChat")
}

public 
_cshopRegisterItem(iPluginiParams)
{
    new 
szSound[128], eItem[Items], bool:blPrecache true
    get_string
(1eItem[iName], charsmax(eItem[iName]))
    
    if(
g_eSettings[stgPointsEnable])
    {
        new 
iPoints get_param(6)
        
eItem[iPrice] = iPoints iPoints mtop(get_param(2))
    }
    else 
eItem[iPrice] = get_param(2)
    
    
eItem[iLimit] = get_param(3)
    
get_string(4eItem[iSound], charsmax(eItem[iSound]))
    
eItem[iSeconds] = get_param(5)
    
eItem[iTeam] = get_param(7)
    
get_string(8eItem[iFlag], charsmax(eItem[iFlag]))
    
ArrayPushArray(g_aItemseItem)
    
g_iTotalItems++
    
    for(new 
iArraySize(g_aSounds); i++)
    {
        
ArrayGetString(g_aSoundsiszSoundcharsmax(szSound))
        
        if(
equal(szSoundeItem[iSound]))
        {
            
blPrecache false
            
break
        }
    }
    
    if(
blPrecache)
    {
        
precache_sound(eItem[iSound])
        
ArrayPushString(g_aSoundseItem[iSound])
    }
    
    return 
g_iTotalItems 1
}

public 
bool:_cshopHasItem(iPluginiParams)
    return 
g_blHasItem[get_param(1)][get_param(2)] ? true false
    
public bool:_cshopPointsEnabled(iPluginiParams)
    return 
g_eSettings[stgPointsEnable] ? true false
    
public _cshopGetLimit(iPluginiParams)
    return 
get_user_limit(get_param(1), get_param(2))
    
public 
_cshopRemoveItem(iPluginiParams)
    
removeItem(get_param(1), get_param(2))

public 
_cshopErrorSound(iPluginiParams)
    
speakSound(get_param(1), g_eSettings[stgSoundError])
    
public 
_cshopTotalItems(iPluginiParams)
    return 
g_iTotalItems
    
public _cshopGivePoints(iPluginiParams)
    
g_iPoints[get_param(1)] += get_param(2)
    
public 
_ColorChat(iPluginiParams)
{
    new 
szMessage[191]
    
vdformat(szMessagecharsmax(szMessage), 23)
    
ColorChat(get_param(1), szMessage)
}
    
ColorChat(const id, const szInput[], any:...)
{
    new 
iPlayers[32], iCount 1
    
static szMessage[191]
    
vformat(szMessagecharsmax(szMessage), szInput3)
    
format(szMessage[0], charsmax(szMessage), "%s %s"g_eSettings[stgPrefix], szMessage)
    
    for(new 
isizeof(g_szColorReplace); += 2)
        
replace_all(szMessagecharsmax(szMessage), g_szColorReplace[i], g_szColorReplace[1])
        
    for(new 
isizeof(g_szHideChat); i++)
        
replace_all(szMessagecharsmax(szMessage), g_szHideChat[i], "")
    
    if(
id)
        
iPlayers[0] = id
    
else
        
get_players(iPlayersiCount"ch")
    
    for(new 
iiCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMessage)
            
message_end()
        }
    }

__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 07-20-2016 , 15:47   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #28

How u made Golden AK47 shot Multi-Color?
__________________
Airkish is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-20-2016 , 19:20   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #29

Quote:
Originally Posted by Airkish View Post
How u made Golden AK47 shot Multi-Color?
If you're talking about the shoot sprite - that's not a part of the plugin. It's just I have modified my game files. Sorry if the picture confused you, but I'm used to using those colors and totally forget that they are different.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
sirerick
Senior Member
Join Date: Jul 2012
Location: Venezuela
Old 07-20-2016 , 23:30   Re: OciXCrom's Custom Shop 3.3 + API
Reply With Quote #30

This look very well. I think I will use this for a mod. Ty for share
__________________
√ Zombie plague + greats updates. finished.
√ Surf-Mod level + greats updates Finished.
√ Zombie Scenario like cso. Finished.
Click Here
√ Call Of Duty MOD. Finished.
Click Here


Sorry for my bad english. I'm using translate.
sirerick is offline
Reply


Thread Tools
Display Modes

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 13:09.


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