Compatible/Suggested Escape Coins Change

Gameplay Addons
Post Reply
johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

Escape Coins Change

#1

Post by johnnysins2000 » 2 Years Ago

Escape Coins Change

Description:
  • This Plugin will show an random color dhud message when u buy something with coins or u earn coins!
Code:
    1. #include <zombie_escape>
    2.  
    3. new ammo[3][33], string[21], coins
    4.  
    5. public plugin_init()
    6. {
    7.     register_plugin("[ZE] Addons: EC Change", "1.0", "ZE DEV TEAM")
    8. }
    9.  
    10. public ze_game_started()
    11. {
    12.     new players[32], num, i
    13.     get_players(players, num, "ach")
    14.    
    15.     for(i = 1; i < num; i++)
    16.     {
    17.         ammo[0][players[i]] = ze_get_escape_coins(players[i])
    18.     }
    19. }
    20.  
    21. public client_putinserver(id)   set_task(3.0, "func_ammo", id)
    22. public client_disconnect(id)
    23. {
    24.     ammo[0][id] = 0
    25.     ammo[1][id] = 0
    26.     ammo[2][id] = 0
    27. }
    28.  
    29. public func_ammo(id)
    30. {
    31.     coins = ze_get_escape_coins(id)
    32.    
    33.     ammo[0][id] = coins
    34.     ammo[1][id] = coins
    35.     ammo[2][id] = coins
    36.    
    37.     set_task(1.0, "change_ammo", id, _, _, "b")
    38. }
    39.  
    40. public change_ammo(id)
    41. {
    42.     if(get_user_team(id) == 0 || get_user_team(id) == 3)
    43.         return PLUGIN_HANDLED
    44.        
    45.     ammo[1][id] = ze_get_escape_coins(id)
    46.        
    47.     if(ammo[1][id] != ammo[2][id])
    48.     {
    49.         if(ammo[1][id] > ammo[2][id])
    50.         {
    51.             coins = ammo[1][id] - ammo[2][id]
    52.             format(string, charsmax(string), "[+%d Coins]", coins)
    53.         }
    54.         else
    55.         {
    56.             coins = ammo[2][id] - ammo[1][id]
    57.             format(string, charsmax(string), "[-%d Coins]", coins)
    58.         }
    59.        
    60.         ammo[2][id] = ammo[1][id]
    61.        
    62.         set_dhudmessage(random_num(50, 175), random_num(50, 175), random_num(50, 175), -1.0, 0.65, 0, 0.1, 3.0, 0.1, 0.1)
    63.         show_dhudmessage(id, "%s", string)
    64.     }
    65.     return PLUGIN_CONTINUE
    66. }
Installation & Instructions:
  • Simply install it like any plugin.

Screenshots:
  • hl 2017-06-04 21-58-36-72.png
Downloads:
Last edited by johnnysins2000 on 24 Apr 2018, 19:36, edited 1 time in total.
These users thanked the author johnnysins2000 for the post:
Raheem (2 Years Ago)
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#2

Post by Raheem » 2 Years Ago

+Like, Good job bro.
You don't know? Learn and you will know.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#3

Post by Raheem » 2 Years Ago

Please update the plugin with the following:

1-Remove #include <dhudmessage> it's already in amxmodx v 1.8.3 and now we use it.
2-Remove register_logevent("round_start", 2, "1=Round_Start")
3-Replace public round_start() with our mod forward public ze_game_started()
You don't know? Learn and you will know.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#4

Post by Raheem » 1 Year Ago

Please update code, check before get the player coins that he is connected or not like:
    1. #include <zombie_escape>
    2.  
    3. new ammo[3][33], string[21], coins
    4.  
    5. public plugin_init()
    6. {
    7.     register_plugin("[ZE] Addons: EC Change", "1.0", "ZE DEV TEAM")
    8. }
    9.  
    10. public ze_game_started()
    11. {
    12.     new players[32], num, i
    13.     get_players(players, num, "ach")
    14.    
    15.     for(i = 1; i < num; i++)
    16.     {
    17.         if (!is_user_connected(players[i]))
    18.             continue;
    19.        
    20.         ammo[0][players[i]] = ze_get_escape_coins(players[i])
    21.     }
    22. }
    23.  
    24. public client_putinserver(id)   set_task(3.0, "func_ammo", id)
    25. public client_disconnect(id)
    26. {
    27.     ammo[0][id] = 0
    28.     ammo[1][id] = 0
    29.     ammo[2][id] = 0
    30. }
    31.  
    32. public func_ammo(id)
    33. {
    34.     if (!is_user_connected(id))
    35.         return
    36.    
    37.     coins = ze_get_escape_coins(id)
    38.    
    39.     ammo[0][id] = coins
    40.     ammo[1][id] = coins
    41.     ammo[2][id] = coins
    42.    
    43.     set_task(1.0, "change_ammo", id, _, _, "b")
    44. }
    45.  
    46. public change_ammo(id)
    47. {
    48.     if(get_user_team(id) == 0 || get_user_team(id) == 3 || !is_user_connected(id))
    49.         return PLUGIN_HANDLED
    50.        
    51.     ammo[1][id] = ze_get_escape_coins(id)
    52.        
    53.     if(ammo[1][id] != ammo[2][id])
    54.     {
    55.         if(ammo[1][id] > ammo[2][id])
    56.         {
    57.             coins = ammo[1][id] - ammo[2][id]
    58.             format(string, charsmax(string), "[+%d Coins]", coins)
    59.         }
    60.         else
    61.         {
    62.             coins = ammo[2][id] - ammo[1][id]
    63.             format(string, charsmax(string), "[-%d Coins]", coins)
    64.         }
    65.        
    66.         ammo[2][id] = ammo[1][id]
    67.        
    68.         set_dhudmessage(random_num(50, 175), random_num(50, 175), random_num(50, 175), -1.0, 0.65, 0, 0.1, 3.0, 0.1, 0.1)
    69.         show_dhudmessage(id, "%s", string)
    70.     }
    71.     return PLUGIN_CONTINUE
    72. }
You don't know? Learn and you will know.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#5

Post by johnnysins2000 » 1 Year Ago

Raheem wrote:
1 Year Ago
Please update code, check before get the player coins that he is connected or not like:
    1. #include <zombie_escape>
    2.  
    3. new ammo[3][33], string[21], coins
    4.  
    5. public plugin_init()
    6. {
    7.     register_plugin("[ZE] Addons: EC Change", "1.0", "ZE DEV TEAM")
    8. }
    9.  
    10. public ze_game_started()
    11. {
    12.     new players[32], num, i
    13.     get_players(players, num, "ach")
    14.    
    15.     for(i = 1; i < num; i++)
    16.     {
    17.         if (!is_user_connected(players[i]))
    18.             continue;
    19.        
    20.         ammo[0][players[i]] = ze_get_escape_coins(players[i])
    21.     }
    22. }
    23.  
    24. public client_putinserver(id)   set_task(3.0, "func_ammo", id)
    25. public client_disconnect(id)
    26. {
    27.     ammo[0][id] = 0
    28.     ammo[1][id] = 0
    29.     ammo[2][id] = 0
    30. }
    31.  
    32. public func_ammo(id)
    33. {
    34.     if (!is_user_connected(id))
    35.         return
    36.    
    37.     coins = ze_get_escape_coins(id)
    38.    
    39.     ammo[0][id] = coins
    40.     ammo[1][id] = coins
    41.     ammo[2][id] = coins
    42.    
    43.     set_task(1.0, "change_ammo", id, _, _, "b")
    44. }
    45.  
    46. public change_ammo(id)
    47. {
    48.     if(get_user_team(id) == 0 || get_user_team(id) == 3 || !is_user_connected(id))
    49.         return PLUGIN_HANDLED
    50.        
    51.     ammo[1][id] = ze_get_escape_coins(id)
    52.        
    53.     if(ammo[1][id] != ammo[2][id])
    54.     {
    55.         if(ammo[1][id] > ammo[2][id])
    56.         {
    57.             coins = ammo[1][id] - ammo[2][id]
    58.             format(string, charsmax(string), "[+%d Coins]", coins)
    59.         }
    60.         else
    61.         {
    62.             coins = ammo[2][id] - ammo[1][id]
    63.             format(string, charsmax(string), "[-%d Coins]", coins)
    64.         }
    65.        
    66.         ammo[2][id] = ammo[1][id]
    67.        
    68.         set_dhudmessage(random_num(50, 175), random_num(50, 175), random_num(50, 175), -1.0, 0.65, 0, 0.1, 3.0, 0.1, 0.1)
    69.         show_dhudmessage(id, "%s", string)
    70.     }
    71.     return PLUGIN_CONTINUE
    72. }
I will update the rat file thanks
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#6

Post by Raheem » 1 Year Ago

Make sure it's working good first bro if you have time.
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest