Bom, tenho um plugin de tickets só que quando entro no servidor e digito no say /ticket ele não abre o menu de tickets
Se alguém puder me ajudar agradeço..
Se alguém puder me ajudar agradeço..
LSM escreveu:Bom, tenho um plugin de tickets só que quando entro no servidor e digito no say /ticket ele não abre o menu de tickets
Se alguém puder me ajudar agradeço..
Código:
#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <nvault>
#include <zp_tutor_print_fix>
new ticket[33];
new g_vault;
new szText[555 char]
public plugin_precache()
{
for (new i = 0; i < sizeof TUTOR_FILES; i++) precache_generic(TUTOR_FILES[i]);
}
public plugin_init() {
register_plugin("[GM Tickets]", "2.0", "PrinTT");
register_clcmd("say /ticket", "TicketCMD");
register_clcmd("say /tickets", "TicketCMD");
register_clcmd("say_team /ticket", "TicketCMD");
register_clcmd("say_team /tickets", "TicketCMD");
g_vault = nvault_open("GM_Tickets");
}
public SaveData(id)
{
new szName[35];
get_user_name(id, szName, 34);
new vaultkey[64], vaultdata[256];
format(vaultkey,63,"%s-TicketTuto",szName);
format(vaultdata,255,"%i#",ticket[id]);
nvault_set(g_vault,vaultkey,vaultdata);
return PLUGIN_CONTINUE;
}
public LoadData(id)
{
new szName[35];
get_user_name(id, szName, 34);
new vaultkey[64],vaultdata[256];
format(vaultkey,63,"%s-TicketTuto",szName);
format(vaultdata,255,"%i#",ticket[id]);
nvault_get(g_vault,vaultkey,vaultdata,255);
replace_all(vaultdata, 255, "#", " ");
new tckt[32];
parse(vaultdata, tckt, 31);
ticket[id] = str_to_num(tckt);
return PLUGIN_CONTINUE
}
public client_connect(id)
{
LoadData(id)
}
public client_disconnect(id)
{
remove_task(id)
SaveData(id)
}
public client_putinserver(id)
{
set_task(180.0, "TicketADD", id, _, _, "b")
}
public TicketADD(id)
{
ticket[id]++
SaveData(id)
}
public TicketCMD(id)
{
zp_tutor_print(id, Green, 10.0, "Voce recebe tickets a cada 3 minutos no server!")
formatex(szText, charsmax(szText), "\r[GM Tickets]^n\yVoce tem: \w%i \rTickets", ticket[id]);
new menu = menu_create(szText, "tickshandl")
menu_additem(menu, "10 \rAmmo Packs \d= \w5 \yTickets \r.", "5", 0);
menu_additem(menu, "20 \rAmmo Packs \d= \w15 \yTickets \r.", "15", 0);
menu_additem(menu, "30 \rAmmo Packs \d= \w25 \yTickets \r.", "25", 0);
menu_additem(menu, "40 \rAmmo Packs \d= \w35 \yTickets \r.", "35", 0);
menu_additem(menu, "50 \rAmmo Packs \d= \w45 \yTickets \r.", "45", 0);
menu_additem(menu, "60 \rAmmo Packs \d= \w55 \yTickets \r.", "55", 0);
menu_additem(menu, "110 \rAmmo Packs \d= \w100 \yTickets \r.", "100", 0);
menu_setprop(menu, MPROP_EXITNAME, "Sair");
menu_display(id, menu, 0);
}
public tickshandl(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new user_ammo = zp_get_user_ammo_packs(id);
switch(str_to_num(data))
{
case 1:
{
if(is_user_alive(id)) {
if(ticket[id] < 5) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+10);
ticket[id] -= 5;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t10 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "10 Ammo Packs comprados!")
}
}
}
case 2:
{
if(is_user_alive(id)) {
if(ticket[id] < 15) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+20);
ticket[id] -= 15;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t20 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "20 Ammo Packs comprados!")
}
}
}
case 3:
{
if(is_user_alive(id)) {
if(ticket[id] < 25) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+30);
ticket[id] -= 25;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t30 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "30 Ammo Packs comprados!")
}
}
}
case 4:
{
if(is_user_alive(id)) {
if(ticket[id] < 35) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+40);
ticket[id] -= 35;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t40 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "40 Ammo Packs comprados!")
}
}
}
case 5:
{
if(is_user_alive(id)) {
if(ticket[id] < 45) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+50);
ticket[id] -= 45;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t50 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "50 Ammo Packs comprados!")
}
}
}
case 6:
{
if(is_user_alive(id)) {
if(ticket[id] < 55) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+60);
ticket[id] -= 55;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t60 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "60 Ammo Packs comprados!")
}
}
}
case 7:
{
if(is_user_alive(id)) {
if(ticket[id] < 100) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+110);
ticket[id] -= 100;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t110 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "110 Ammo Packs comprados!")
}
}
}
case 8:
{
TicketCMD(id)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
/*===============================================================================
[Mensagem Colorida (client_printcolor)]
=================================================================================*/
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Chat Verde
replace_all(msg, 190, "!y", "^1") // Chat Normal
replace_all(msg, 190, "!t", "^3") // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
LSM escreveu:Código:
#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <nvault>
#include <zp_tutor_print_fix>
new ticket[33];
new g_vault;
new szText[555 char]
public plugin_precache()
{
for (new i = 0; i < sizeof TUTOR_FILES; i++) precache_generic(TUTOR_FILES[i]);
}
public plugin_init() {
register_plugin("[GM Tickets]", "2.0", "PrinTT");
register_clcmd("say /ticket", "TicketCMD");
register_clcmd("say /tickets", "TicketCMD");
register_clcmd("say_team /ticket", "TicketCMD");
register_clcmd("say_team /tickets", "TicketCMD");
g_vault = nvault_open("GM_Tickets");
}
public SaveData(id)
{
new szName[35];
get_user_name(id, szName, 34);
new vaultkey[64], vaultdata[256];
format(vaultkey,63,"%s-TicketTuto",szName);
format(vaultdata,255,"%i#",ticket[id]);
nvault_set(g_vault,vaultkey,vaultdata);
return PLUGIN_CONTINUE;
}
public LoadData(id)
{
new szName[35];
get_user_name(id, szName, 34);
new vaultkey[64],vaultdata[256];
format(vaultkey,63,"%s-TicketTuto",szName);
format(vaultdata,255,"%i#",ticket[id]);
nvault_get(g_vault,vaultkey,vaultdata,255);
replace_all(vaultdata, 255, "#", " ");
new tckt[32];
parse(vaultdata, tckt, 31);
ticket[id] = str_to_num(tckt);
return PLUGIN_CONTINUE
}
public client_connect(id)
{
LoadData(id)
}
public client_disconnect(id)
{
remove_task(id)
SaveData(id)
}
public client_putinserver(id)
{
set_task(180.0, "TicketADD", id, _, _, "b")
}
public TicketADD(id)
{
ticket[id]++
SaveData(id)
}
public TicketCMD(id)
{
zp_tutor_print(id, Green, 10.0, "Voce recebe tickets a cada 3 minutos no server!")
formatex(szText, charsmax(szText), "\r[GM Tickets]^n\yVoce tem: \w%i \rTickets", ticket[id]);
new menu = menu_create(szText, "tickshandl")
menu_additem(menu, "10 \rAmmo Packs \d= \w5 \yTickets \r.", "5", 0);
menu_additem(menu, "20 \rAmmo Packs \d= \w15 \yTickets \r.", "15", 0);
menu_additem(menu, "30 \rAmmo Packs \d= \w25 \yTickets \r.", "25", 0);
menu_additem(menu, "40 \rAmmo Packs \d= \w35 \yTickets \r.", "35", 0);
menu_additem(menu, "50 \rAmmo Packs \d= \w45 \yTickets \r.", "45", 0);
menu_additem(menu, "60 \rAmmo Packs \d= \w55 \yTickets \r.", "55", 0);
menu_additem(menu, "110 \rAmmo Packs \d= \w100 \yTickets \r.", "100", 0);
menu_setprop(menu, MPROP_EXITNAME, "Sair");
menu_display(id, menu, 0);
}
public tickshandl(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new user_ammo = zp_get_user_ammo_packs(id);
switch(str_to_num(data))
{
case 1:
{
if(is_user_alive(id)) {
if(ticket[id] < 5) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+10);
ticket[id] -= 5;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t10 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "10 Ammo Packs comprados!")
}
}
}
case 2:
{
if(is_user_alive(id)) {
if(ticket[id] < 15) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+20);
ticket[id] -= 15;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t20 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "20 Ammo Packs comprados!")
}
}
}
case 3:
{
if(is_user_alive(id)) {
if(ticket[id] < 25) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+30);
ticket[id] -= 25;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t30 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "30 Ammo Packs comprados!")
}
}
}
case 4:
{
if(is_user_alive(id)) {
if(ticket[id] < 35) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+40);
ticket[id] -= 35;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t40 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "40 Ammo Packs comprados!")
}
}
}
case 5:
{
if(is_user_alive(id)) {
if(ticket[id] < 45) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+50);
ticket[id] -= 45;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t50 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "50 Ammo Packs comprados!")
}
}
}
case 6:
{
if(is_user_alive(id)) {
if(ticket[id] < 55) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+60);
ticket[id] -= 55;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t60 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "60 Ammo Packs comprados!")
}
}
}
case 7:
{
if(is_user_alive(id)) {
if(ticket[id] < 100) {
client_printcolor(id, "!g[GM Tickets]!yVoce nao tem !ttickets !ysuficientes");TicketCMD(id);
zp_tutor_print(id, Red, 5.0, "Tickets insuficientes")
return PLUGIN_HANDLED;
} else {
zp_set_user_ammo_packs(id, user_ammo+110);
ticket[id] -= 100;client_printcolor(id, "!g[GM Tickets]!yVoce adquiriu !t110 !yAmmo Packs");TicketCMD(id);
zp_tutor_print(id, Blue, 5.0, "110 Ammo Packs comprados!")
}
}
}
case 8:
{
TicketCMD(id)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
/*===============================================================================
[Mensagem Colorida (client_printcolor)]
=================================================================================*/
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Chat Verde
replace_all(msg, 190, "!y", "^1") // Chat Normal
replace_all(msg, 190, "!t", "^3") // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
LSM escreveu:aqui não será que é por que estou usando o plugin de banco que eu criei nvault ? é algum plugin dando conflito :s
LSM escreveu:Não ):, pois é um banco privado que desenvolvi para um servidor que está próximo de sair.. hehe segredinhoo