Suggested Escape Coins Change

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


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

Escape Coins Change

#1

Post by johnnysins2000 » 6 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 6 years ago, edited 1 time in total.
Nobody Is That Busy If They Make Time :roll:

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

#2

Post by Raheem » 6 years ago

+Like, Good job bro.
He who fails to plan is planning to fail

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

#3

Post by Raheem » 6 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()
He who fails to plan is planning to fail

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

#4

Post by Raheem » 5 years 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. }
He who fails to plan is planning to fail

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

#5

Post by johnnysins2000 » 5 years ago

Raheem wrote: 5 years 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
Posts: 2214
Joined: 7 years ago
Contact:

#6

Post by Raheem » 5 years ago

Make sure it's working good first bro if you have time.
He who fails to plan is planning to fail

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: Google [Bot] and 1 guest