Suggested Get Escape Coins

Plug-ins compatibility with Zombie Escape 1.x only!


johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

Get Escape Coins

#1

Post by johnnysins2000 » 6 years ago

Get Escape Coins

Description:
  • This Plugin will give u escape Coins After every 12 hours! Enjoy!
Cvars:
  • get_coins_save_type 1 How to save data 1 by authid, 2 by ip or 3 by name.
  • get_coins_minutes 720 Time in minutes, 720 minutes = 12 hours it will be auto calculated.
  • get_escape_coins 200 How many coins to give (You will get 200 Coins).
Code:
    1. #include <zombie_escape>
    2. #include <nvault>
    3.  
    4. #define NV_NAME "GET_COINS"
    5.  
    6. enum player_struct {
    7.     mtime,bool:ftime,key[64]
    8. }
    9. new g_player[33][player_struct];
    10.  
    11. new cvar_save_type,cvar_time,cvar_coins;
    12.  
    13. public plugin_init() {
    14.  
    15.     register_plugin("Get Escape Coins", "1.0", "ZE DEV TEAM");
    16.    
    17.     cvar_save_type = register_cvar("get_coins_save_type","1"); // how to save data 1 by authid, 2 by ip or 3 by name
    18.     cvar_time = register_cvar("get_coins_minutes","720"); // time in minutes, 720minutes=12hours it will be auto calculated
    19.     cvar_coins = register_cvar("get_escape_coins","200"); // how many coins to give
    20.    
    21.     register_clcmd("say /get", "cmd_coins");
    22.     register_clcmd("say_team /get", "cmd_coins");
    23. }
    24.        
    25. public cmd_coins(id) {
    26.  
    27.     new nv = nvault_open(NV_NAME);
    28.    
    29.     if(nv == INVALID_HANDLE) {
    30.         ze_colored_print(id, "!tFor the moment getting escape coins system is inactive..");
    31.         return;
    32.     }
    33.    
    34.     new txt_min[32],txt_coins[10];
    35.     new coins = get_pcvar_num(cvar_coins),pminutes = get_pcvar_num(cvar_time);
    36.     copy(txt_coins,charsmax(txt_coins),(coins==1)?"coin":"coins");
    37.     build_time(pminutes,txt_min,charsmax(txt_min));
    38.    
    39.     if(g_player[id][ftime]) {
    40.         ze_colored_print(id, "!tYou have just received !g%d !tescape %s, get another in %s!y!",coins,txt_coins,txt_min);
    41.         ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);
    42.         g_player[id][ftime]=false;
    43.         nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
    44.         return;
    45.     }
    46.    
    47.     new user_time=get_systime()-g_player[id][mtime];
    48.     new diff_min=(user_time<(pminutes*60))?pminutes-(user_time/60):pminutes;
    49.     build_time(diff_min,txt_min,charsmax(txt_min));
    50.    
    51.     if(user_time>=(pminutes*60)) {
    52.         ze_colored_print(id, "!tYou have just received !g%d escape %s !tsince !g%s !tpassed !",coins,txt_coins,txt_min);
    53.         ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);  
    54.         nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
    55.     }
    56.     else
    57.         ze_colored_print(id, "!tRetry again in !g%s !tfor getting %d more !gescape %s !",txt_min,coins,txt_coins);
    58.        
    59.     nvault_close(nv);
    60. }
    61.  
    62. public client_putinserver(id) {
    63.        
    64.     new nv,data[32];
    65.     get_auth(id,g_player[id][key],charsmax(g_player[][key]));
    66.     g_player[id][mtime]=get_systime();
    67.     g_player[id][ftime]=false;
    68.     formatex(data,charsmax(data),"%d",g_player[id][mtime]);
    69.    
    70.     if((nv=nvault_open(NV_NAME))==INVALID_HANDLE)
    71.         return;
    72.    
    73.     if(!nvault_lookup(nv,g_player[id][key],data,charsmax(data),g_player[id][mtime])) {
    74.         nvault_set(nv,g_player[id][key],data);
    75.         g_player[id][ftime]=true;
    76.     }
    77.    
    78.     nvault_close(nv);
    79. }    
    80.  
    81. public client_disconnect(id) {
    82.    
    83.     g_player[id][mtime]=0;
    84.     g_player[id][ftime]=false;
    85. }
    86.  
    87. stock get_auth(id,data[],len)
    88.     switch(get_pcvar_num(cvar_save_type)) {
    89.         case 1: get_user_authid(id,data,len);
    90.         case 2: get_user_ip(id,data,len,1);
    91.         case 3: get_user_name(id,data,len);
    92.     }
    93.  
    94. stock build_time(pminutes,data[],len)
    95.     if(pminutes==1)
    96.         copy(data,len,"1 minute");
    97.     else if(pminutes!=1&&pminutes<60)
    98.         formatex(data,len,"%d minutes",pminutes);
    99.     else if(pminutes==60)
    100.         copy(data,len,"1 hour");
    101.     else {
    102.         new ptime=pminutes/60;
    103.         if(ptime*60==pminutes)
    104.             formatex(data,len,"%d %s",ptime,(ptime==1)?"hour":"hours");
    105.         else {
    106.             new diff=pminutes-ptime*60;
    107.             formatex(data,len,"%d %s and %d %s",ptime,(ptime==1)?"hour":"hours",diff,(diff==1)?"minute":"minutes");
    108.         }
    109.     }

Installation & Instructions:
  • Simply install it like any plugin

Screenshots:
  • hl 2017-06-07 16-28-25-71.png
Downloads:
  • Coins.rar
    [ZE] Addon Get Coins
    (5.27 KiB) Downloaded 961 times
    Coins.rar
    [ZE] Addon Get Coins
    (5.27 KiB) Downloaded 961 times
Last edited by johnnysins2000 6 years ago, edited 4 times in total.
Nobody Is That Busy If They Make Time :roll:

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#2

Post by johnnysins2000 » 6 years ago

I will Update This Rar file with the code ...

Raheem When I used ze_colored_print

The Plugin got some Run time errors
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#3

Post by Raheem » 6 years ago

Good job bro, +Like and can you show me the error?
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#4

Post by johnnysins2000 » 6 years ago

Raheem wrote: 6 years ago Good job bro, +Like and can you show me the error?
Error is this


L 06/07/2017 - 23:17:13: String formatted incorrectly - parameter 6 (total 5)
L 06/07/2017 - 23:17:13: [AMXX] Displaying debug trace (plugin "ze_get_coins.amxx", version "1.0")
L 06/07/2017 - 23:17:13: [AMXX] Run time error 25: parameter error
L 06/07/2017 - 23:17:13: [AMXX] [0] zombie_escape_stocks.inc::ze_colored_print (line 67)
L 06/07/2017 - 23:17:13: [AMXX] [1] ze_get_coins.sma::cmd_coins (line 57)
$h@DoW : /get

Code is this :-
    1. #include <zombie_escape>
    2. #include <nvault>
    3.  
    4. #define NV_NAME "GET_COINS"
    5.  
    6. enum player_struct {
    7.     mtime,bool:ftime,key[64]
    8. }
    9. new g_player[33][player_struct];
    10.  
    11. new cvar_save_type,cvar_time,cvar_coins;
    12.  
    13. public plugin_init() {
    14.  
    15.     register_plugin("Get Escape Coins", "1.0", "ZE DEV TEAM");
    16.    
    17.     cvar_save_type = register_cvar("get_coins_save_type","1"); // how to save data 1 by authid, 2 by ip or 3 by name
    18.     cvar_time = register_cvar("get_coins_minutes","720"); // time in minutes, 720minutes=12hours it will be auto calculated
    19.     cvar_coins = register_cvar("get_escape_coins","200"); // how many coins to give
    20.    
    21.     register_clcmd("say /get", "cmd_coins");
    22.     register_clcmd("say_team /get", "cmd_coins");
    23. }
    24.        
    25. public cmd_coins(id) {
    26.  
    27.     new nv = nvault_open(NV_NAME);
    28.    
    29.     if(nv == INVALID_HANDLE) {
    30.         ze_colored_print(id, "!g%s !tFor the moment getting escape coins system is inactive..");
    31.         return;
    32.     }
    33.    
    34.     new txt_min[32],txt_coins[10];
    35.     new coins = get_pcvar_num(cvar_coins),pminutes = get_pcvar_num(cvar_time);
    36.     copy(txt_coins,charsmax(txt_coins),(coins==1)?"coin":"coins");
    37.     build_time(pminutes,txt_min,charsmax(txt_min));
    38.    
    39.     if(g_player[id][ftime]) {
    40.         ze_colored_print(id, "%s You have just received %d escape %s, get another in %s !",coins,txt_coins,txt_min);
    41.         ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);
    42.         g_player[id][ftime]=false;
    43.         nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
    44.         return;
    45.     }
    46.    
    47.     new user_time=get_systime()-g_player[id][mtime];
    48.     new diff_min=(user_time<(pminutes*60))?pminutes-(user_time/60):pminutes;
    49.     build_time(diff_min,txt_min,charsmax(txt_min));
    50.    
    51.     if(user_time>=(pminutes*60)) {
    52.         ze_colored_print(id, "!g%s !tYou have just received !g%d escape %s !tsince !g%s !tpassed !",coins,txt_coins,txt_min);
    53.         ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);  
    54.         nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
    55.     }
    56.     else
    57.         ze_colored_print(id, "!g%s !tRetry again in !g%s !tfor getting %d more !gescape %s !",txt_min,coins,txt_coins);
    58.        
    59.     nvault_close(nv);
    60. }
    61.  
    62. public client_putinserver(id) {
    63.        
    64.     new nv,data[32];
    65.     get_auth(id,g_player[id][key],charsmax(g_player[][key]));
    66.     g_player[id][mtime]=get_systime();
    67.     g_player[id][ftime]=false;
    68.     formatex(data,charsmax(data),"%d",g_player[id][mtime]);
    69.    
    70.     if((nv=nvault_open(NV_NAME))==INVALID_HANDLE)
    71.         return;
    72.    
    73.     if(!nvault_lookup(nv,g_player[id][key],data,charsmax(data),g_player[id][mtime])) {
    74.         nvault_set(nv,g_player[id][key],data);
    75.         g_player[id][ftime]=true;
    76.     }
    77.    
    78.     nvault_close(nv);
    79. }    
    80.  
    81. public client_disconnect(id) {
    82.    
    83.     g_player[id][mtime]=0;
    84.     g_player[id][ftime]=false;
    85. }
    86.  
    87. stock get_auth(id,data[],len)
    88.     switch(get_pcvar_num(cvar_save_type)) {
    89.         case 1: get_user_authid(id,data,len);
    90.         case 2: get_user_ip(id,data,len,1);
    91.         case 3: get_user_name(id,data,len);
    92.     }
    93.  
    94. stock build_time(pminutes,data[],len)
    95.     if(pminutes==1)
    96.         copy(data,len,"1 minute");
    97.     else if(pminutes!=1&&pminutes<60)
    98.         formatex(data,len,"%d minutes",pminutes);
    99.     else if(pminutes==60)
    100.         copy(data,len,"1 hour");
    101.     else {
    102.         new ptime=pminutes/60;
    103.         if(ptime*60==pminutes)
    104.             formatex(data,len,"%d %s",ptime,(ptime==1)?"hour":"hours");
    105.         else {
    106.             new diff=pminutes-ptime*60;
    107.             formatex(data,len,"%d %s and %d %s",ptime,(ptime==1)?"hour":"hours",diff,(diff==1)?"minute":"minutes");
    108.         }
    109.     }
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 6 years ago

Bro, Please attach the nvault.inc to the ZIP. About the color message problem. It seems you define 4 %s and uses only three so you should remove one.

EX of this problem:
    1. ze_colored_print(id, "!g%s !tFor the moment getting escape coins system is inactive..")
Should be:
    1. ze_colored_print(id, "!tFor the moment getting escape coins system is inactive..");
So final code should be:
  • Code: Select all

    #include <zombie_escape>
    #include <nvault>
     
    #define NV_NAME "GET_COINS"
     
    enum player_struct {
        mtime,bool:ftime,key[64]
    }
    new g_player[33][player_struct];
     
    new cvar_save_type,cvar_time,cvar_coins;
     
    public plugin_init() {
     
        register_plugin("Get Escape Coins", "1.0", "ZE DEV TEAM");
       
        cvar_save_type = register_cvar("get_coins_save_type","1"); // how to save data 1 by authid, 2 by ip or 3 by name
        cvar_time = register_cvar("get_coins_minutes","720"); // time in minutes, 720minutes=12hours it will be auto calculated
        cvar_coins = register_cvar("get_escape_coins","200"); // how many coins to give
       
        register_clcmd("say /get", "cmd_coins");
        register_clcmd("say_team /get", "cmd_coins");
    }
           
    public cmd_coins(id) {
     
        new nv = nvault_open(NV_NAME);
       
        if(nv == INVALID_HANDLE) {
            ze_colored_print(id, "!tFor the moment getting escape coins system is inactive..");
            return;
        }
       
        new txt_min[32],txt_coins[10];
        new coins = get_pcvar_num(cvar_coins),pminutes = get_pcvar_num(cvar_time);
        copy(txt_coins,charsmax(txt_coins),(coins==1)?"coin":"coins");
        build_time(pminutes,txt_min,charsmax(txt_min));
       
        if(g_player[id][ftime]) {
            ze_colored_print(id, "!tYou have just received !g%d !tescape %s, get another in %s!y!",coins,txt_coins,txt_min);
            ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);
            g_player[id][ftime]=false;
            nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
            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)) {
            ze_colored_print(id, "!tYou have just received !g%d escape %s !tsince !g%s !tpassed !",coins,txt_coins,txt_min);
            ze_set_escape_coins(id, ze_get_escape_coins(id) + coins);  
            nvault_touch(nv,g_player[id][key],g_player[id][mtime]=get_systime());
        }
        else
            ze_colored_print(id, "!tRetry again in !g%s !tfor getting %d more !gescape %s !",txt_min,coins,txt_coins);
           
        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");
            }
        }
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#6

Post by johnnysins2000 » 6 years ago

OK I SEE ! Thnx for telling the mistake
Nobody Is That Busy If They Make Time :roll:

User avatar
sam_bhosale4
Mod Tester
Mod Tester
India
Posts: 109
Joined: 7 years ago
Location: INDIA
Contact:

#7

Post by sam_bhosale4 » 6 years ago

thats nice one johny! +like +karma :D
but can you do that to auto give instead of getting manually by /get?
-=SeRious-GaminG|Zombie Escape[Alien vs. Predator]|Asia=-
206.189.132.169:40000
Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#8

Post by johnnysins2000 » 6 years ago

sam_bhosale4 wrote: 6 years ago thats nice one johny! +like +karma :D
but can you do that to auto give instead of getting manually by /get?
I think this will stay better .... since most users who play knows this
/get command that is why i have not done manually

if u want to inform them about the command /get then u can just use advertisiment plugin or i can add client_print which can make flood in chat that is why i am not adding any message to inform this !
Nobody Is That Busy If They Make Time :roll:

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#9

Post by Spir0x » 6 years ago

can anyone convert this into XP not escape coins
we have time presents & Random prize including escape coins let's convert this into random exp when type /get like old mod

juste convers ec into exp and change the cvars

by the way we haven't any plugin give exp execpt of best def/inf or supplybox

ze_get_exp_save_type 1 How to save data 1 by authid, 2 by ip or 3 by name.
ze_get_exp_minutes 720 Time in minutes, 720 minutes = 12 hours it will be auto calculated.
ze_get_exp "300" Random exp to give from 0 to 300.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#10

Post by Raheem » 6 years ago

Simple you can edit natives so it give coins + XP good idea. Author not active anymore so i'll try update it when get time.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#11

Post by Spir0x » 6 years ago

Ok, why he'll not open anymore ?

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#12

Post by johnnysins2000 » 6 years ago

Raheem wrote: 6 years ago Simple you can edit natives so it give coins + XP good idea. Author not active anymore so i'll try update it when get time.
I have Next 2 days free

Tell me what to Update And I will update it!


Sorry For not being active as I told u in telegram I was too much busy in studies !
Nobody Is That Busy If They Make Time :roll:

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#13

Post by Spir0x » 6 years ago

easy update this plugin and name it Daily Awards
plugin give random exp from 50 to 300 example.
say /get.

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#14

Post by johnnysins2000 » 6 years ago

Spir0x wrote: 6 years ago easy update this plugin and name it Daily Awards
plugin give random exp from 50 to 300 example.
say /get.
U don't get it do you ?

This Plugin Concept is not to give somebody xp or something like daily awards

The idea was taken from zp /get ammo packs plugin

Well that daily awards plugin is good idea

I will make it if I get time

Just share the idea what should be in daily awards
Nobody Is That Busy If They Make Time :roll:

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#15

Post by Spir0x » 6 years ago

example
1 buy weapons
2. buy extra-items
3. Daily Award

this daily award will give player random exp from "50 to 300 or + with cvars"
and why not adding escape coins with it so player can get ec or exp.

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#16

Post by johnnysins2000 » 6 years ago

Spir0x wrote: 6 years ago example
1 buy weapons
2. buy extra-items
3. Daily Award

this daily award will give player random exp from "50 to 300 or + with cvars"
and why not adding escape coins with it so player can get ec or exp.
Ok I get it !
Nobody Is That Busy If They Make Time :roll:

BandiT
Member
Member
Romania
Posts: 59
Joined: 4 years ago
Contact:

#17

Post by BandiT » 3 years ago

can some one make this plugin when you saty /to get random xp and coins from 0 to 300, and to can use evry map but 1 time on map ?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#18

Post by Raheem » 3 years ago

BandiT wrote: 3 years ago can some one make this plugin when you saty /to get random xp and coins from 0 to 300, and to can use evry map but 1 time on map ?
Try this:
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#19

Post by czirimbolo » 3 years ago

Raheem wrote: 3 years ago
BandiT wrote: 3 years ago can some one make this plugin when you saty /to get random xp and coins from 0 to 300, and to can use evry map but 1 time on map ?
Try this:
  • rewards.sma
where is exp commands? He means random exp or coins by typing command /get. Here I see only coins
Image

BandiT
Member
Member
Romania
Posts: 59
Joined: 4 years ago
Contact:

#20

Post by BandiT » 3 years ago

Raheem wrote: 3 years ago
BandiT wrote: 3 years ago can some one make this plugin when you saty /to get random xp and coins from 0 to 300, and to can use evry map but 1 time on map ?
Try this:
  • rewards.sma
it-s working good, thank you, but kif you can make it how czirimbolo says to get random xp or coins
czirimbolo wrote: 3 years ago
Raheem wrote: 3 years ago
BandiT wrote: 3 years ago can some one make this plugin when you saty /to get random xp and coins from 0 to 300, and to can use evry map but 1 time on map ?
Try this:
  • rewards.sma
where is exp commands? He means random exp or coins by typing command /get. Here I see only coins

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests