Русское сообщество по скриптингу

Request for plugin [Buy Access]

Scripting help for english speaking users. While not very active, you still have a chance to get help here.
Правила форума
We cannot maintain english version version of our forum rules, but shortly (it's simple) - Don't be a dick. If you really want to know our rules you should check appropriate thread.

Request for plugin [Buy Access]

Сообщение VenomIvanof » 22 апр 2016, 18:43

I want plugin that when someone write /buy to show menu with flags
for e.x.
1. Kick
2. Slap
3. Slay
and to cost 16 000$
and when someone buy something in chat to say> You have buyed Kick access
Аватара пользователя
VenomIvanof
 
Сообщения: 66
Зарегистрирован: 02 апр 2016, 13:26
Благодарил (а): 17 раз.
Поблагодарили: 1 раз.
Языки программирования: Counter-Strike 1.6

Re: Request for plugin [Buy Access]

Сообщение Pafos » 22 апр 2016, 19:12

here is an example buying kick access.
Код: Выделить всё
#include <amxmodx>
#include <cstrike>

#define MAX_PLAYERS 32

new Trie:g_Access;

new const 
szMessageBuyAccess[] = "You have buyig Kick access";

new const 
g_szAccessFlags  "c";
const 
iNeedMoney 16000;

new 
g_szAuthid[MAX_PLAYERS+1][28];

public 
plugin_init()
{
    
register_plugin("Buy access" "1.0" "Pafos");
    
    
register_clcmd("say /kick" "CmdKick");
    
    
g_Access TrieCreate();
}
public 
plugin_end()
{
    
TrieDestroy(g_Access);
}
public 
client_putinserver(nClientIndex)
{
    
get_user_authid(nClientIndex g_szAuthid[nClientIndex] , charsmax(g_szAuthid[]));
    if(
TrieKeyExists(g_Access g_szAuthid[nClientIndex])) set_user_flags(nClientIndex read_flags(g_szAccessFlags));
}
public 
CmdKick(nClientIndex)
{
    if(
is_user_connected(nClientIndex))
    {
        if(
TrieKeyExists(g_Access g_szAuthid[nClientIndex])
            return 
PLUGIN_HANDLED;
        new 
iMoney cs_get_user_money(nClientIndex);
        if(
iMoney iNeedMoney)
            return 
PLUGIN_HANDLED;
        
cs_set_user_money(nClientIndex iMoney iNeedMoney 1);
        
set_user_flags(nClientIndex read_flags(g_szAccessFlags));
        
TrieSetString(g_Access g_szAuthid[nClientIndex] , g_szAccessFlags);
        
client_print(nClientIndex print_chat szMessageBuyAccess);
    }
    return 
PLUGIN_HANDLED;
}
 
Аватара пользователя
Pafos
 
Сообщения: 574
Зарегистрирован: 07 апр 2014, 18:03
Откуда: pfnClientConnect
Забанен
Благодарил (а): 129 раз.
Поблагодарили: 97 раз.
Опыт программирования: Больше трех лет
Языки программирования: Pawn

Re: Request for plugin [Buy Access]

Сообщение VenomIvanof » 22 апр 2016, 19:24

Pafos писал(а):here is an example buying kick access.
Код: Выделить всё
#include <amxmodx>
#include <cstrike>

#define MAX_PLAYERS 32

new Trie:g_Access;

new const szMessageBuyAccess[] = "You have buyig Kick access";

new const g_szAccessFlags  = "c";
const iNeedMoney = 16000;

new g_szAuthid[MAX_PLAYERS+1][28];

public plugin_init()
{
    register_plugin("Buy access" , "1.0" , "Pafos");
    
    register_clcmd
("say /kick" , "CmdKick");
    
    g_Access 
= TrieCreate();
}
public plugin_end()
{
    TrieDestroy(g_Access);
}
public client_putinserver(nClientIndex)
{
    get_user_authid(nClientIndex , g_szAuthid[nClientIndex] , charsmax(g_szAuthid[]));
    if(TrieKeyExists(g_Access , g_szAuthid[nClientIndex])) set_user_flags(nClientIndex , read_flags(g_szAccessFlags));
}
public CmdKick(nClientIndex)
{
    if(is_user_connected(nClientIndex))
    {
        if(TrieKeyExists(g_Access , g_szAuthid[nClientIndex])
            return PLUGIN_HANDLED;
        new iMoney = cs_get_user_money(nClientIndex);
        if(iMoney < iNeedMoney)
            return PLUGIN_HANDLED;
        cs_set_user_money(nClientIndex , iMoney - iNeedMoney , 1);
        set_user_flags(nClientIndex , read_flags(g_szAccessFlags));
        TrieSetString(g_Access , g_szAuthid[nClientIndex] , g_szAccessFlags);
        client_print(nClientIndex , print_chat , szMessageBuyAccess);
    }
    return PLUGIN_HANDLED;
}
 

Thx for the fast answer!

Posted after 2 minutes 10 seconds:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Argument type mismatch (argument 1) on line 30
Error: Expected token: ")", but found "return" on line 37
Error: Argument type mismatch (argument 1) on line 42
Error: Argument type mismatch (argument 3) on line 43
Warning: Symbol is never used: "g_szAccessFlags" on line 49

4 Errors.
Could not locate output file C:\Users\Venom\Desktop\buyaccess.amx (compile failed).
Аватара пользователя
VenomIvanof
 
Сообщения: 66
Зарегистрирован: 02 апр 2016, 13:26
Благодарил (а): 17 раз.
Поблагодарили: 1 раз.
Языки программирования: Counter-Strike 1.6

Re: Request for plugin [Buy Access]

Сообщение Pafos » 22 апр 2016, 19:41

VenomIvanof, corrected.
Код: Выделить всё
#include <amxmodx>
#include <cstrike>

#define MAX_PLAYERS 32

new Trie:g_Access;

new const 
szMessageBuyAccess[] = "You have buyig Kick access";

new const 
g_szAccessFlags[] = "c";
const 
iNeedMoney 16000;

new 
g_szAuthid[MAX_PLAYERS+1][28];

public 
plugin_init()
{
    
register_plugin("Buy access" "1.0" "Pafos");
    
    
register_clcmd("say /kick" "CmdKick");
    
    
g_Access TrieCreate();
}
public 
plugin_end()
{
    
TrieDestroy(g_Access);
}
public 
client_putinserver(nClientIndex)
{
    
get_user_authid(nClientIndex g_szAuthid[nClientIndex] , charsmax(g_szAuthid[]));
    if(
TrieKeyExists(g_Access g_szAuthid[nClientIndex]))
        
set_user_flags(nClientIndex read_flags(g_szAccessFlags));
}
public 
CmdKick(nClientIndex)
{
    if(
is_user_connected(nClientIndex))
    {
        if(
TrieKeyExists(g_Access g_szAuthid[nClientIndex]))
            return 
PLUGIN_HANDLED;
        new 
iMoney cs_get_user_money(nClientIndex);
        if(
iMoney iNeedMoney)
            return 
PLUGIN_HANDLED;
        
cs_set_user_money(nClientIndex iMoney iNeedMoney 1);
        
set_user_flags(nClientIndex read_flags(g_szAccessFlags));
        
TrieSetString(g_Access g_szAuthid[nClientIndex] , g_szAccessFlags);
        
client_print(nClientIndex print_chat szMessageBuyAccess);
    }
    return 
PLUGIN_HANDLED;
}
 
Аватара пользователя
Pafos
 
Сообщения: 574
Зарегистрирован: 07 апр 2014, 18:03
Откуда: pfnClientConnect
Забанен
Благодарил (а): 129 раз.
Поблагодарили: 97 раз.
Опыт программирования: Больше трех лет
Языки программирования: Pawn


Вернуться в Scripting

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 2