/* This plugin contains stuff that responds to 'say' commands */ /* $Id: plugin_dice.sma,v 1.0 Compu-Core Creations$ */ /* Godmode = 2 & 12, Noclip = 3 & 4, Death = 7, Slap = 5 & 6, Glow = 8 & 9, Stuck = 10 & 11*/ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_ALL 0 #define ACCESS_FUN 8192 #define ACCESS_GAMES 37017 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.2"; new MessageMode[MAX_PLAYERS][MAX_DATA_LENGTH]; new Games = 0; new Roll = 0; new name_dice[MAX_NAME_LENGTH]; new Time = 30; new God[MAX_NAME_LENGTH]; new HoldTime = 5; new X; new Y; new Z; new Held[MAX_NAME_LENGTH]; public Stop() { new Text[MAX_TEXT_LENGTH]; if(HoldTime==10) { get_userorigin(Held, X, Y, Z); Z = Z-50; teleport(Held, X, Y, Z); } else if (HoldTime==0) { Z = Z+60; teleport(Held, X, Y, Z); HoldTime = 5; } snprintf(Text, MAX_TEXT_LENGTH, "You are being held for %d seconds.", HoldTime); messageex(Held, Text, print_tty); HoldTime = HoldTime-1; return HoldTime; } public Delay() { new Text[MAX_TEXT_LENGTH]; new Red; new Green; new Blue; Time = Time-1; snprintf(Text, MAX_TEXT_LENGTH, "%s is God for %d", name_dice, Time); Red = random(256); Green = random(256); Blue = random(256); typesay(Text, 1, Red, Green, Blue); if(Time==0) { Time = 30; godmode(God, 0); snprintf(Text, MAX_TEXT_LENGTH, "Godmode Disabled on %s", God); typesay(Text, 1, Red, Green, Blue); } return Time; } public GodWin() { new Text[MAX_TEXT_LENGTH]; new Red; new Green; new Blue; snprintf(Text, MAX_TEXT_LENGTH, "%s Godmode Winner!", name_dice); Red = random(256); Green = random(256); Blue = random(256); centersay(Text, 1, Red, Green, Blue); } public NoclipWin() { new Text[MAX_TEXT_LENGTH]; new Red; new Green; new Blue; snprintf(Text, MAX_TEXT_LENGTH, "%s Noclip Winner!", name_dice); Red = random(256); Green = random(256); Blue = random(256); centersay(Text, 1, Red, Green, Blue); } public admin_games(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; new Red; new Green; new Blue; convert_string(HLCommand,Command,MAX_NAME_LENGTH); convert_string(HLData,Data,MAX_NAME_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); if(check_param(Data)==1) { Games = 1; snprintf(Text, MAX_TEXT_LENGTH, "Let the games begin!"); Red = random(256); Green = random(256); Blue = random(256); centersay(Text, 5, Red, Green, Blue); } else { Games = 0; snprintf(Text, MAX_TEXT_LENGTH, "The casino is now closed."); Red = random(256); Green = random(256); Blue = random(256); centersay(Text, 5, Red, Green, Blue); } return PLUGIN_HANDLED; } public roll_the_dice(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; new Red = random(256); new Green = random(256); new Blue = random(256); convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strstripquotes(Data); if (strlen(MessageMode[UserIndex]) != 0 && UserIndex != 0) { if ( strcasestr(MessageMode[UserIndex], "admin_") >= 0 ) { plugin_exec( MessageMode[UserIndex], Data ); return PLUGIN_HANDLED; } else { snprintf(Text, MAX_TEXT_LENGTH, "%s %s", MessageMode[UserIndex], Data); execclient(User,Text); return PLUGIN_HANDLED; } } else if (streq(Data, "roll the dice") && Games==1) { glow(User,0,0,0); new Dieone = random(6); new Dietwo = random(6); Dieone = Dieone+1; Dietwo = Dietwo+1; Roll = Dieone+Dietwo; if ( (Roll==2) || (Roll==12) ) { snprintf(Text, MAX_TEXT_LENGTH, "You rolled [%d] [%d]", Dieone, Dietwo); say(Text); strcpy(name_dice, User, MAX_NAME_LENGTH); snprintf(Text, MAX_TEXT_LENGTH, "Congratulations %s you've won Godmode!", User); say(Text); set_timer("GodWin", 1, 5); godmode(User, 1); set_timer("Delay", 1, 30); strcpy(God, User, MAX_TEXT_LENGTH); } else if ( (Roll==3) || (Roll==4) ) { snprintf(Text, MAX_TEXT_LENGTH, "You rolled [%d] [%d]", Dieone, Dietwo); say(Text); snprintf(Text, MAX_TEXT_LENGTH, "Congratulations %s you've won Noclip!", User); say(Text); set_timer("NoclipWin", 1, 10); noclip(User, 1); } else if ( (Roll==5) || (Roll==6) ) { snprintf(Text, MAX_TEXT_LENGTH, "You rolled [%d] [%d]", Dieone, Dietwo); say(Text); snprintf(Text, MAX_TEXT_LENGTH, "Congratulations %s you've won a slap!", User); say(Text); slap(User); } else if (Roll==7) { snprintf(Text, MAX_TEXT_LENGTH, "You rolled [%d] [%d]", Dieone, Dietwo); say(Text); snprintf(Text, MAX_TEXT_LENGTH, "Congratulations %s you've won Death!", User); say(Text); slay(User); } else if ( (Roll==8) || (Roll==9) ) { snprintf(Text, MAX_TEXT_LENGTH, "You rolled [%d] [%d]", Dieone, Dietwo); say(Text); snprintf(Text, MAX_TEXT_LENGTH, "Congratulations %s you've won Glow!", User); say(Text); glow(User, Red, Green, Blue); } else if ( (Roll==10) || (Roll==11) ) { strcpy(name_dice, User, MAX_TEXT_LENGTH); snprintf(Text, MAX_TEXT_LENGTH, "You rolled [%d] [%d]", Dieone, Dietwo); say(Text); snprintf(Text, MAX_TEXT_LENGTH, "Oooh! you lose %s your stuck!", User); say(Text); strcpy(Held, name_dice, MAX_NAME_LENGTH); HoldTime = 10; set_timer("Stop", 1, 11); } else { snprintf(Text, MAX_TEXT_LENGTH, "Operation Failure"); say(Text); } } return PLUGIN_CONTINUE; } public plugin_connect(HLUserName, HLIP, UserIndex) { if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { strinit(MessageMode[UserIndex]); } return PLUGIN_CONTINUE; } public plugin_disconnect(HLUserName, UserIndex) { if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { strinit(MessageMode[UserIndex]); } return PLUGIN_CONTINUE; } public plugin_init() { plugin_registerinfo("Roll The Dice Plugin","Roll to win!.",STRING_VERSION); plugin_registercmd("say", "roll_the_dice", ACCESS_ALL); plugin_registercmd("admin_games","admin_games",ACCESS_GAMES,"admin_games <^"on^" | ^"off^">: Turns games on or off."); return PLUGIN_CONTINUE; }