Cerere plugin welcome-ammopacks

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
User avatar
Sokar
Membru, skill +1
Membru, skill +1
Posts: 452
Joined: 13 Jan 2018, 21:18
Detinator Steam: Da
CS Status: connect relax.kript.ro:27015
Detinator server CS: RELAX.KRIPT.RO
Fond eXtream: 0
Location: Constanța
Has thanked: 5 times
Been thanked: 3 times

31 Oct 2019, 15:56

Plugin Cerut: /welcome
Descriere (adica ce face el mai exact): cand scrii /welcome sa-ti dea 500 ammo packs gratuit (sa mearga folosit doar o data) cu 2 mesaje
[Zombie OutStanding] Your welcome gift was received.
[Zombie OutStanding] You have already received the welcome gift.
Cu tagul [Zombie OutStanding] de culoare verde.

Serverul ruleaza (HLDS/ReHLDS): REHLDS
Versiune AMX Mod X: 1.8.2
Modul Serverului: zombie outstanding
Enix
User avatar
Jucator
Membru, skill +1
Membru, skill +1
Posts: 203
Joined: 15 Jul 2017, 20:38
Detinator Steam: Da
Fond eXtream: 0
Has thanked: 26 times
Been thanked: 11 times
Contact:

03 Nov 2019, 21:14

Sokar wrote:
31 Oct 2019, 15:56
Plugin Cerut: /welcome
Descriere (adica ce face el mai exact): cand scrii /welcome sa-ti dea 500 ammo packs gratuit (sa mearga folosit doar o data) cu 2 mesaje
[Zombie OutStanding] Your welcome gift was received.
[Zombie OutStanding] You have already received the welcome gift.
Cu tagul [Zombie OutStanding] de culoare verde.

Serverul ruleaza (HLDS/ReHLDS): REHLDS
Versiune AMX Mod X: 1.8.2
Modul Serverului: zombie outstanding


Poți edita și singur:D

https://forum.kgb-hosting.com/showthread.php?t=86267 :closed_lips:
User avatar
Sokar
Membru, skill +1
Membru, skill +1
Posts: 452
Joined: 13 Jan 2018, 21:18
Detinator Steam: Da
CS Status: connect relax.kript.ro:27015
Detinator server CS: RELAX.KRIPT.RO
Fond eXtream: 0
Location: Constanța
Has thanked: 5 times
Been thanked: 3 times

03 Nov 2019, 21:21

ce sa pot edita singur?
User avatar
The Kalu
eXtream Mod
eXtream Mod
Posts: 12057
Joined: 09 Oct 2010, 11:39
Detinator Steam: Da
Reputatie: Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra
Has thanked: 134 times
Been thanked: 287 times

03 Nov 2019, 23:43

Sokar wrote:
03 Nov 2019, 21:21
ce sa pot edita singur?
El se refera sa editezi tu in plugin dar butul nu stie ca tu ai si alte cerinte, ce sa ii ceri unui copil cu iq de lingura.Dar de inceput este bun si pluginul asta, mai trebuie aia cu ammo doar odata pe runda si scos sa dea ammo la nu stiu cate minute!

@LEVIN?
User avatar
Sokar
Membru, skill +1
Membru, skill +1
Posts: 452
Joined: 13 Jan 2018, 21:18
Detinator Steam: Da
CS Status: connect relax.kript.ro:27015
Detinator server CS: RELAX.KRIPT.RO
Fond eXtream: 0
Location: Constanța
Has thanked: 5 times
Been thanked: 3 times

03 Nov 2019, 23:56

abea acum am văzut link-ul lui.. păi eu chiar am făcut ceva exact după același plugin dar e buguit.. când dă ammo respectiv când nu.
User avatar
The Kalu
eXtream Mod
eXtream Mod
Posts: 12057
Joined: 09 Oct 2010, 11:39
Detinator Steam: Da
Reputatie: Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra
Has thanked: 134 times
Been thanked: 287 times

04 Nov 2019, 00:00

Sokar wrote:
03 Nov 2019, 23:56
abea acum am văzut link-ul lui.. păi eu chiar am făcut ceva exact după același plugin dar e buguit.. când dă ammo respectiv când nu.
Nu ai editat corect, pune aici ce ai tu si roaga un scripter sa il verifice.
User avatar
Sokar
Membru, skill +1
Membru, skill +1
Posts: 452
Joined: 13 Jan 2018, 21:18
Detinator Steam: Da
CS Status: connect relax.kript.ro:27015
Detinator server CS: RELAX.KRIPT.RO
Fond eXtream: 0
Location: Constanța
Has thanked: 5 times
Been thanked: 3 times

04 Nov 2019, 00:11

faza este ca intre timp m-am razgandit, vreau odata pe saptamana sa iti dea 1000.

Code: Select all

#include <amxmodx>
#include <zombieplague>
#include <nvault>

#define NV_NAME "GET_AMMOWEEK"
#define TAG "[Zombie OutStanding]"

enum player_struct {
    mtime,bool:ftime,key[64]
}
new g_player[33][player_struct];

new cvar_save_type,cvar_time,cvar_ap;

#pragma tabsize 0

public plugin_init() {

    register_plugin("Get Ammo Packs", "1.0", "Clauu");
    
    cvar_save_type = register_cvar("get_ammo_save_type_week","1"); // how to save data 1 by authid, 2 by ip or 3 by name
    cvar_time = register_cvar("get_ammo_minutes_week","10080"); // time in minutes, 720minutes=12hours it will be auto calculated
    cvar_ap = register_cvar("get_ammo_packs_week","1000"); // how many ammo packs to give
    
    register_clcmd("say /week", "cmd_ap");
    register_clcmd("say_team /week", "cmd_ap");
}
        
public cmd_ap(id) {

    new nv = nvault_open(NV_NAME);
    
    if(nv == INVALID_HANDLE) {
        print_cc(id, ".g%s.n For the moment getting ammo packs system is inactive..",TAG);
        return;
    }
    
    new txt_min[32],txt_ap[10];
    new ap = get_pcvar_num(cvar_ap),pminutes = get_pcvar_num(cvar_time);
    copy(txt_ap,charsmax(txt_ap),(ap==1)?"pack":"packs");
    build_time(pminutes,txt_min,charsmax(txt_min));
    
        if(g_player[id][ftime]) {
        print_cc(id, ".g%s.n You have just received 1000 ammo packs, get another next week %s !",TAG,ap,txt_ap,txt_min);
        zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ap);
        g_player[id][ftime]=false;
        nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
        nvault_close(nv);
        return;
    } 
    
    new user_time=get_systime()-g_player[id][mtime];
    new diff_min=(user_time<(pminutes*60))?pminutes-(user_time/60):pminutes;
    build_time(diff_min,txt_min,charsmax(txt_min));
    
    if(user_time>=(pminutes*60)) {
        print_cc(id, ".g%s.n You have just received %d ammo %s since %s passed !",TAG,ap,txt_ap,txt_min);
        zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ap);
        nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
    }
    else
        print_cc(id, ".g%s.n Retry again in %s for getting %d more ammo %s !",TAG,txt_min,ap,txt_ap);
        
    nvault_close(nv);
}

public client_putinserver(id) {
        
    new nv,data[32];
    get_auth(id,g_player[id][key],charsmax(g_player[][key]));
    g_player[id][mtime]=get_systime();
    g_player[id][ftime]=false;
    formatex(data,charsmax(data),"%d",g_player[id][mtime]);
    
    if((nv=nvault_open(NV_NAME))==INVALID_HANDLE)
        return;
    
    if(!nvault_lookup(nv,g_player[id][key],data,charsmax(data),g_player[id][mtime])) {
        nvault_set(nv,g_player[id][key],data);
        g_player[id][ftime]=true;
    }
    
    nvault_close(nv);
}    

public client_disconnect(id) {
    
    g_player[id][mtime]=0;
    g_player[id][ftime]=false;
}

stock get_auth(id,data[],len)
    switch(get_pcvar_num(cvar_save_type)) {
        case 1: get_user_authid(id,data,len);
        case 2: get_user_ip(id,data,len,1);
        case 3: get_user_name(id,data,len);
    }

stock build_time(pminutes,data[],len)
    if(pminutes==1)
        copy(data,len,"1 minute");
    else if(pminutes!=1&&pminutes<60)
        formatex(data,len,"%d minutes",pminutes);
    else if(pminutes==60)
        copy(data,len,"1 hour");
    else {
        new ptime=pminutes/60;
        if(ptime*60==pminutes)
            formatex(data,len,"%d %s",ptime,(ptime==1)?"hour":"hours");
        else {
            new diff=pminutes-ptime*60;
            formatex(data,len,"%d %s and %d %s",ptime,(ptime==1)?"hour":"hours",diff,(diff==1)?"minute":"minutes");
        }
    }
print_cc(id, fmt[], any:...)
{
	static saytext = 0, fake_user;
	if (!saytext)
	{
		saytext = get_user_msgid("SayText");
		fake_user = get_maxplayers() + 1;
	}
	new msg[192];
	vformat(msg, charsmax(msg), fmt, 3)
	replace_all(msg, sizeof(msg) - 1, ".g", "^x04");
	replace_all(msg, sizeof(msg) - 1, ".n", "^x01");
	replace_all(msg, sizeof(msg) - 1, ".t", "^x03");
	message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, saytext, _, id);
	write_byte(id ? id : fake_user);
	write_string(msg);
	message_end();
}
cam asta am facut eu..
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2556
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 37 times
Been thanked: 388 times
Contact:

04 Nov 2019, 01:29

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <nvault>
#include <zombieplague>

const MESAJE = 5
new const COMANDA[]="/welcome"
new const Mesaje[MESAJE][]=
{
	"nvault_wa",//n ai voie
	"Eroare la deschiderea nvault",
	
	"Because you are new on the server, you can type %t to get %t2 ammo",//%t=COMANDA / %t2=AMMO CVAR
	"Your welcome gift was received.",
	"You have already received the welcome gift."
}
new const PREFIX[]="^4[Zombie OutStanding]^1"
new set[33],g_szNick[33][32],g_Vault,ane,g_pExpireDays

public plugin_init() {
	
	register_clcmd("say","SF")
	register_clcmd("say_team","SF")
	
	ane=register_cvar("ammo_ne","1000")
	
	// Add your code here...
}
public plugin_cfg()
{
	g_pExpireDays = register_cvar( "ane_expiredays" , "7" );
	for(new i;i<sizeof(Mesaje);i++)
	{
		g_Vault = nvault_open( Mesaje[0] );
		if ( g_Vault == INVALID_HANDLE )	set_fail_state( Mesaje[1] );
		break
	}
	nvault_prune( g_Vault , 0 , get_systime() - ( 86400 * get_pcvar_num( g_pExpireDays ) ) );
}

public plugin_end()	if ( g_Vault != INVALID_HANDLE )	nvault_close( g_Vault );

public client_putinserver(id)
{
	if(is_user_bot(id)||is_user_hltv(id))	return
	
	get_user_name( id , g_szNick[id] , charsmax( g_szNick[] ) );
	
	new szKey[40];
	formatex( szKey , charsmax( szKey ) , "%sWA" , g_szNick[id] );
	if ( !nvault_get( g_Vault , szKey ) )
	{
		for(new i;i<sizeof(Mesaje);i++)
		{
			print_cc(id,Mesaje[2])
			break
		}
		set[id]=0
	}
}

public SF(id)
{
	new sf[190]
	read_args(sf,charsmax(sf))
	remove_quotes(sf)
	
	if(equal(sf,COMANDA,strlen(COMANDA)))
	{
		for(new i;i<sizeof(Mesaje);i++)
		{
			if(!set[id])
			{
				new szVW[7],szKey[40];
				formatex( szKey , charsmax( szKey ) , "%sWA" , g_szNick[id] );
				formatex( szVW , charsmax( szVW ) , "%d" , set[id] );
				nvault_set( g_Vault , szKey , szVW );
				print_cc(id,Mesaje[3])
				zp_set_user_ammo_packs(id,get_pcvar_num(ane)+zp_get_user_ammo_packs(id))
				set[id]=1
			}
			else	print_cc(id,Mesaje[4])
			break
		}
	}
}

print_cc(id, fmt[], any:...)
{
	static saytext = 0, fake_user;
	if (!saytext)
	{
		saytext = get_user_msgid("SayText");
		fake_user = get_maxplayers() + 1;
	}
	
	new msg[192],text[10]
	vformat(msg, charsmax(msg), fmt, 3)
	format(msg, charsmax(msg), "%s %s", PREFIX, msg)
	
	replace_all(msg, sizeof(msg) - 1, ".g", "^x04");
	replace_all(msg, sizeof(msg) - 1, ".n", "^x01");
	replace_all(msg, sizeof(msg) - 1, ".t", "^x03");
	
	replace(msg, sizeof(msg) - 1, "%t", COMANDA);
	num_to_str(get_pcvar_num(ane),text,charsmax(text))
	replace(msg, sizeof(msg) - 1, "%t2", text);
	
	message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, saytext, _, id);
	write_byte(id ? id : fake_user);
	write_string(msg);
	message_end();
}

sursa ta-

Code: Select all

#include <amxmodx>
#include <zombieplague>
#include <nvault>

#pragma tabsize 0

#define NV_NAME "GET_AMMO"
#define TAG "^4[Zombie OutStanding]^1"

enum player_struct {
	mtime,
	bool:ftime,
	key[64]
}
new g_player[33][player_struct];

new cvar_save_type,cvar_time,cvar_ap;

public plugin_init() {

    register_plugin("Get Ammo Packs", "1.0", "Clauu");
    
    cvar_save_type = register_cvar("get_ammo_save_type","3"); // how to save data 1 by authid, 2 by ip or 3 by name
    cvar_time = register_cvar("get_ammo_minutes","10080"); // time in minutes, 60minutes=1hour it will be auto calculated
    cvar_ap = register_cvar("get_ammo_packs","1000"); // how many ammo packs to give
    
    register_clcmd("say /welcome", "cmd_ap");
    register_clcmd("say_team /welcome", "cmd_ap");
}
        
public cmd_ap(id) {
    new nv = nvault_open(NV_NAME);
    
    if(nv == INVALID_HANDLE) {
	print_cc(id,"%s For the moment getting ammo packs system is inactive..",TAG);
	return;
    }
    
    new txt_min[32],txt_ap[10];
    new ap = get_pcvar_num(cvar_ap),pminutes = get_pcvar_num(cvar_time);
    copy(txt_ap,charsmax(txt_ap),(ap==1)?"pack":"packs");
    build_time(pminutes,txt_min,charsmax(txt_min));
    
    if(g_player[id][ftime]) {
	print_cc(id,"%s You have already received the welcome gift.",TAG);
	zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ap);
	g_player[id][ftime]=false;
	nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
	nvault_close(nv);
	return;
    }
    
    new user_time=get_systime()-g_player[id][mtime];
    new diff_min=(user_time<(pminutes*60))?pminutes-(user_time/60):pminutes;
    build_time(diff_min,txt_min,charsmax(txt_min));
    
    if(user_time>=(pminutes*60)) {
        print_cc(id,"%s Your welcome gift was received.",TAG);
        zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ap);
        nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
    }
    else	print_cc(id,"%s Retry again in %s for getting %d more ammo %s !",TAG,txt_min,ap,txt_ap);
    
    nvault_close(nv);
}

public client_putinserver(id) {
    new nv,data[32];
    get_auth(id,g_player[id][key],charsmax(g_player[][key]));
    g_player[id][mtime]=get_systime();
    g_player[id][ftime]=false;
    formatex(data,charsmax(data),"%d",g_player[id][mtime]);
    
    if((nv=nvault_open(NV_NAME))==INVALID_HANDLE)	return;
    
    if(!nvault_lookup(nv,g_player[id][key],data,charsmax(data),g_player[id][mtime])) {
        nvault_set(nv,g_player[id][key],data);
        g_player[id][ftime]=true;
    }
    
    nvault_close(nv);
}    

public client_disconnect(id) {
    g_player[id][mtime]=0;
    g_player[id][ftime]=false;
}

stock get_auth(id,data[],len)
    switch(get_pcvar_num(cvar_save_type)) {
        case 1: get_user_authid(id,data,len);
        case 2: get_user_ip(id,data,len,1);
        case 3: get_user_name(id,data,len);
}

stock build_time(pminutes,data[],len)
    if(pminutes==1)	copy(data,len,"1 minute");
    else if(pminutes!=1&&pminutes<60)	formatex(data,len,"%d minutes",pminutes);
    else if(pminutes==60)	copy(data,len,"1 hour");
    else {
        new ptime=pminutes/60;
        if(ptime*60==pminutes)	formatex(data,len,"%d %s",ptime,(ptime==1)?"hour":"hours");
        else {
            new diff=pminutes-ptime*60;
            formatex(data,len,"%d %s and %d %s",ptime,(ptime==1)?"hour":"hours",diff,(diff==1)?"minute":"minutes");
        }
}
    
print_cc(id, fmt[], any:...)
{
	static saytext = 0, fake_user;
	if (!saytext)
	{
		saytext = get_user_msgid("SayText");
		fake_user = get_maxplayers() + 1;
	}
	new msg[192];
	vformat(msg, charsmax(msg), fmt, 3)
	replace_all(msg, sizeof(msg) - 1, ".g", "^x04");
	replace_all(msg, sizeof(msg) - 1, ".n", "^x01");
	replace_all(msg, sizeof(msg) - 1, ".t", "^x03");
	message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, saytext, _, id);
	write_byte(id ? id : fake_user);
	write_string(msg);
	message_end();
}
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
Sokar
Membru, skill +1
Membru, skill +1
Posts: 452
Joined: 13 Jan 2018, 21:18
Detinator Steam: Da
CS Status: connect relax.kript.ro:27015
Detinator server CS: RELAX.KRIPT.RO
Fond eXtream: 0
Location: Constanța
Has thanked: 5 times
Been thanked: 3 times

04 Nov 2019, 20:54

L E V I N wrote:
04 Nov 2019, 01:29

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <nvault>
#include <zombieplague>

const MESAJE = 5
new const COMANDA[]="/welcome"
new const Mesaje[MESAJE][]=
{
	"nvault_wa",//n ai voie
	"Eroare la deschiderea nvault",
	
	"Because you are new on the server, you can type %t to get %t2 ammo",//%t=COMANDA / %t2=AMMO CVAR
	"Your welcome gift was received.",
	"You have already received the welcome gift."
}
new const PREFIX[]="^4[Zombie OutStanding]^1"
new set[33],g_szNick[33][32],g_Vault,ane,g_pExpireDays

public plugin_init() {
	
	register_clcmd("say","SF")
	register_clcmd("say_team","SF")
	
	ane=register_cvar("ammo_ne","1000")
	
	// Add your code here...
}
public plugin_cfg()
{
	g_pExpireDays = register_cvar( "ane_expiredays" , "7" );
	for(new i;i<sizeof(Mesaje);i++)
	{
		g_Vault = nvault_open( Mesaje[0] );
		if ( g_Vault == INVALID_HANDLE )	set_fail_state( Mesaje[1] );
		break
	}
	nvault_prune( g_Vault , 0 , get_systime() - ( 86400 * get_pcvar_num( g_pExpireDays ) ) );
}

public plugin_end()	if ( g_Vault != INVALID_HANDLE )	nvault_close( g_Vault );

public client_putinserver(id)
{
	if(is_user_bot(id)||is_user_hltv(id))	return
	
	get_user_name( id , g_szNick[id] , charsmax( g_szNick[] ) );
	
	new szKey[40];
	formatex( szKey , charsmax( szKey ) , "%sWA" , g_szNick[id] );
	if ( !nvault_get( g_Vault , szKey ) )
	{
		for(new i;i<sizeof(Mesaje);i++)
		{
			print_cc(id,Mesaje[2])
			break
		}
		set[id]=0
	}
}

public SF(id)
{
	new sf[190]
	read_args(sf,charsmax(sf))
	remove_quotes(sf)
	
	if(equal(sf,COMANDA,strlen(COMANDA)))
	{
		for(new i;i<sizeof(Mesaje);i++)
		{
			if(!set[id])
			{
				new szVW[7],szKey[40];
				formatex( szKey , charsmax( szKey ) , "%sWA" , g_szNick[id] );
				formatex( szVW , charsmax( szVW ) , "%d" , set[id] );
				nvault_set( g_Vault , szKey , szVW );
				print_cc(id,Mesaje[3])
				zp_set_user_ammo_packs(id,get_pcvar_num(ane)+zp_get_user_ammo_packs(id))
				set[id]=1
			}
			else	print_cc(id,Mesaje[4])
			break
		}
	}
}

print_cc(id, fmt[], any:...)
{
	static saytext = 0, fake_user;
	if (!saytext)
	{
		saytext = get_user_msgid("SayText");
		fake_user = get_maxplayers() + 1;
	}
	
	new msg[192],text[10]
	vformat(msg, charsmax(msg), fmt, 3)
	format(msg, charsmax(msg), "%s %s", PREFIX, msg)
	
	replace_all(msg, sizeof(msg) - 1, ".g", "^x04");
	replace_all(msg, sizeof(msg) - 1, ".n", "^x01");
	replace_all(msg, sizeof(msg) - 1, ".t", "^x03");
	
	replace(msg, sizeof(msg) - 1, "%t", COMANDA);
	num_to_str(get_pcvar_num(ane),text,charsmax(text))
	replace(msg, sizeof(msg) - 1, "%t2", text);
	
	message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, saytext, _, id);
	write_byte(id ? id : fake_user);
	write_string(msg);
	message_end();
}

sursa ta-

Code: Select all

#include <amxmodx>
#include <zombieplague>
#include <nvault>

#pragma tabsize 0

#define NV_NAME "GET_AMMO"
#define TAG "^4[Zombie OutStanding]^1"

enum player_struct {
	mtime,
	bool:ftime,
	key[64]
}
new g_player[33][player_struct];

new cvar_save_type,cvar_time,cvar_ap;

public plugin_init() {

    register_plugin("Get Ammo Packs", "1.0", "Clauu");
    
    cvar_save_type = register_cvar("get_ammo_save_type","3"); // how to save data 1 by authid, 2 by ip or 3 by name
    cvar_time = register_cvar("get_ammo_minutes","10080"); // time in minutes, 60minutes=1hour it will be auto calculated
    cvar_ap = register_cvar("get_ammo_packs","1000"); // how many ammo packs to give
    
    register_clcmd("say /welcome", "cmd_ap");
    register_clcmd("say_team /welcome", "cmd_ap");
}
        
public cmd_ap(id) {
    new nv = nvault_open(NV_NAME);
    
    if(nv == INVALID_HANDLE) {
	print_cc(id,"%s For the moment getting ammo packs system is inactive..",TAG);
	return;
    }
    
    new txt_min[32],txt_ap[10];
    new ap = get_pcvar_num(cvar_ap),pminutes = get_pcvar_num(cvar_time);
    copy(txt_ap,charsmax(txt_ap),(ap==1)?"pack":"packs");
    build_time(pminutes,txt_min,charsmax(txt_min));
    
    if(g_player[id][ftime]) {
	print_cc(id,"%s You have already received the welcome gift.",TAG);
	zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ap);
	g_player[id][ftime]=false;
	nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
	nvault_close(nv);
	return;
    }
    
    new user_time=get_systime()-g_player[id][mtime];
    new diff_min=(user_time<(pminutes*60))?pminutes-(user_time/60):pminutes;
    build_time(diff_min,txt_min,charsmax(txt_min));
    
    if(user_time>=(pminutes*60)) {
        print_cc(id,"%s Your welcome gift was received.",TAG);
        zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ap);
        nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
    }
    else	print_cc(id,"%s Retry again in %s for getting %d more ammo %s !",TAG,txt_min,ap,txt_ap);
    
    nvault_close(nv);
}

public client_putinserver(id) {
    new nv,data[32];
    get_auth(id,g_player[id][key],charsmax(g_player[][key]));
    g_player[id][mtime]=get_systime();
    g_player[id][ftime]=false;
    formatex(data,charsmax(data),"%d",g_player[id][mtime]);
    
    if((nv=nvault_open(NV_NAME))==INVALID_HANDLE)	return;
    
    if(!nvault_lookup(nv,g_player[id][key],data,charsmax(data),g_player[id][mtime])) {
        nvault_set(nv,g_player[id][key],data);
        g_player[id][ftime]=true;
    }
    
    nvault_close(nv);
}    

public client_disconnect(id) {
    g_player[id][mtime]=0;
    g_player[id][ftime]=false;
}

stock get_auth(id,data[],len)
    switch(get_pcvar_num(cvar_save_type)) {
        case 1: get_user_authid(id,data,len);
        case 2: get_user_ip(id,data,len,1);
        case 3: get_user_name(id,data,len);
}

stock build_time(pminutes,data[],len)
    if(pminutes==1)	copy(data,len,"1 minute");
    else if(pminutes!=1&&pminutes<60)	formatex(data,len,"%d minutes",pminutes);
    else if(pminutes==60)	copy(data,len,"1 hour");
    else {
        new ptime=pminutes/60;
        if(ptime*60==pminutes)	formatex(data,len,"%d %s",ptime,(ptime==1)?"hour":"hours");
        else {
            new diff=pminutes-ptime*60;
            formatex(data,len,"%d %s and %d %s",ptime,(ptime==1)?"hour":"hours",diff,(diff==1)?"minute":"minutes");
        }
}
    
print_cc(id, fmt[], any:...)
{
	static saytext = 0, fake_user;
	if (!saytext)
	{
		saytext = get_user_msgid("SayText");
		fake_user = get_maxplayers() + 1;
	}
	new msg[192];
	vformat(msg, charsmax(msg), fmt, 3)
	replace_all(msg, sizeof(msg) - 1, ".g", "^x04");
	replace_all(msg, sizeof(msg) - 1, ".n", "^x01");
	replace_all(msg, sizeof(msg) - 1, ".t", "^x03");
	message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, saytext, _, id);
	write_byte(id ? id : fake_user);
	write_string(msg);
	message_end();
}
poti fi mai clar? care din cele doua e bun?... nu mi-ai zis nimic concret.



EDIT: mersi, acum mi-am dat seama.
User avatar
Sokar
Membru, skill +1
Membru, skill +1
Posts: 452
Joined: 13 Jan 2018, 21:18
Detinator Steam: Da
CS Status: connect relax.kript.ro:27015
Detinator server CS: RELAX.KRIPT.RO
Fond eXtream: 0
Location: Constanța
Has thanked: 5 times
Been thanked: 3 times

05 Nov 2019, 14:20

Levin e o problema cu pluginul tau, daca dau retry ma lasa sa folosesc iar comanda /welcome
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2556
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 37 times
Been thanked: 388 times
Contact:

05 Nov 2019, 14:22

ups, linia 81 cu set[id]=1 pune-o deasupra la acel new din if
Nu fac nimic contra cost! Faceți cerere bine detaliată aici, pe forum. Nu-mi mai dați add pe Steam doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz.
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici.
User avatar
Sokar
Membru, skill +1
Membru, skill +1
Posts: 452
Joined: 13 Jan 2018, 21:18
Detinator Steam: Da
CS Status: connect relax.kript.ro:27015
Detinator server CS: RELAX.KRIPT.RO
Fond eXtream: 0
Location: Constanța
Has thanked: 5 times
Been thanked: 3 times

05 Nov 2019, 15:15

merge, mersi
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 11 guests