Plug-ins compatibility with Zombie Escape 1.x only!
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#1
Post
by Raheem » 5 years ago
Coins Gamble
Description:
- This plugin will allow players to gamble with their coins, example gamble 500 there is 50% you will win 500 or you will lose them. This plugin just for fun.
Commands:
say gamble "value"
or say_team gamble "value"
any player can gamble any amount he needs in chat, the value should be higher than MINIMUM_VALUE
.
Code:
/*
* A gamble system, just for FUN - RAHEEM
*/
#include <zombie_escape>
#define MINIMUM_VALUE 250 // Minimum Escape Coins to be gambled
new g_szCommand[] = "gamble" // Change cmd if needed
public plugin_init()
{
register_plugin("Gamble System", "1.0", "Raheem")
register_clcmd("say", "SayHandler");
register_clcmd("say_team", "SayHandler")
}
public SayHandler(id)
{
new szMessage[192]
read_args(szMessage, charsmax(szMessage))
remove_quotes(szMessage) // Important to remove quotes, so parse function works correctly
new szCommand[32], szValue[32]
parse(szMessage, szCommand, charsmax(szCommand), szValue, charsmax(szValue)) //Split the string
if (!equali(g_szCommand, szCommand))
return PLUGIN_CONTINUE;
new iValue = str_to_num(szValue)
if ((ze_get_escape_coins(id) < iValue) && (iValue >= MINIMUM_VALUE))
{
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You have no enough escape coins^1!")
return PLUGIN_CONTINUE
}
if (iValue < MINIMUM_VALUE)
{
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3Minimum value to gamble is ^4%i ^3EC^1.", MINIMUM_VALUE)
return PLUGIN_CONTINUE
}
new iRandomNum = random_num(1, 100) // 50% lose, 50% win
if (iRandomNum >= 1 && iRandomNum < 50)
{
// WIN
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You WON ^1!")
ze_set_escape_coins(id, ze_get_escape_coins(id) + iValue)
}
else
{
// LOSE
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You LOST ^1!")
ze_set_escape_coins(id, ze_get_escape_coins(id) - iValue)
}
return PLUGIN_CONTINUE
}
He who fails to plan is planning to fail
-
Muhammet20
- Veteran Member
- Posts: 407
- Joined: 5 years ago
-
Contact:
-
Quote
-
0
login to like this post
#2
Post
by Muhammet20 » 4 years ago
Raheem wrote: ↑5 years ago
Coins Gamble
Description:
- This plugin will allow players to gamble with their coins, example gamble 500 there is 50% you will win 500 or you will lose them. This plugin just for fun.
Commands:
say gamble "value"
or say_team gamble "value"
any player can gamble any amount he needs in chat, the value should be higher than MINIMUM_VALUE
.
Code:
/*
* A gamble system, just for FUN - RAHEEM
*/
#include <zombie_escape>
#define MINIMUM_VALUE 250 // Minimum Escape Coins to be gambled
new g_szCommand[] = "gamble" // Change cmd if needed
public plugin_init()
{
register_plugin("Gamble System", "1.0", "Raheem")
register_clcmd("say", "SayHandler");
register_clcmd("say_team", "SayHandler")
}
public SayHandler(id)
{
new szMessage[192]
read_args(szMessage, charsmax(szMessage))
remove_quotes(szMessage) // Important to remove quotes, so parse function works correctly
new szCommand[32], szValue[32]
parse(szMessage, szCommand, charsmax(szCommand), szValue, charsmax(szValue)) //Split the string
if (!equali(g_szCommand, szCommand))
return PLUGIN_CONTINUE;
new iValue = str_to_num(szValue)
if ((ze_get_escape_coins(id) < iValue) && (iValue >= MINIMUM_VALUE))
{
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You have no enough escape coins^1!")
return PLUGIN_CONTINUE
}
if (iValue < MINIMUM_VALUE)
{
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3Minimum value to gamble is ^4%i ^3EC^1.", MINIMUM_VALUE)
return PLUGIN_CONTINUE
}
new iRandomNum = random_num(1, 100) // 50% lose, 50% win
if (iRandomNum >= 1 && iRandomNum < 50)
{
// WIN
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You WON ^1!")
ze_set_escape_coins(id, ze_get_escape_coins(id) + iValue)
}
else
{
// LOSE
client_print_color(id, print_team_default, "^1[^4Gamble-System^1] ^3You LOST ^1!")
ze_set_escape_coins(id, ze_get_escape_coins(id) - iValue)
}
return PLUGIN_CONTINUE
}
Nice but i dont love it
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#3
Post
by Raheem » 4 years ago
Why
He who fails to plan is planning to fail
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
Users browsing this forum: No registered users and 1 guest