Skip to content

Instantly share code, notes, and snippets.

@Rumrusher
Created April 3, 2014 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rumrusher/9958096 to your computer and use it in GitHub Desktop.
Save Rumrusher/9958096 to your computer and use it in GitHub Desktop.
put this on your server if you want invisible Floating autoguns that fire on you.
//Roll The Dice server plugin by lorgan
// current error the new sentry drop causes the plugin to add extra speed and send it plumeting to it's doom, also needs to be server sent so that players can see the orbital strike cannons.
global.canRoll = true;
global.effects = 28;
global.effect[0] = " Exploded!";
global.effect[1] = " Turned into a timebomb! Detonation in 10 seconds!"
global.effect[2] = " froze for 10 seconds!";
global.effect[3] = " Lost health!"
global.effect[4] = " can't jump for 20 seconds!";
global.effect[5] = " has less gravity for 20 seconds!";
global.effect[6] = " has infinite ammo for 10 seconds!";
global.effect[7] = " became invincible for 10 seconds!";
global.effect[8] = " has instakill for 10 seconds!";
global.effect[9] = " can fly for 20 seconds!"
global.effect[10] = " has hyperspeed for 60 seconds!"
global.effect[11] = " healed!";
global.effect[12] = " became confused for 20 seconds!"
global.effect[13] = " Talks about his feelings for 20 seconds!";
global.effect[14] = " lost ammo!";
global.effect[15] = " got full ammo";
global.effect[16] = " got rocketed!";
global.effect[17] = " is poisoned for 10 seconds!";
global.effect[18] = " has instant refire for 10 seconds!";
global.effect[19] = " has health regen for 20 seconds!";
global.effect[20] = " released the spies! All autoguns are sapped!";
global.effect[21] = " is a disguised spy! Kill him before he kills you!";
global.effect[22] = " is slowed for 20 seconds!";
global.effect[23] = " has built an autogun!";
global.effect[24] = " is marked for death for 20 seconds!";
global.effect[25] = " is a pacifist for 10 seconds!";
global.effect[26] = " gunspins for 20 seconds!";
global.effect[27] = " has double clip size for 20 seconds!";
object_event_add(PlayerControl,ev_create,0,"
alarm[0] = 300;
");
object_event_add(PlayerControl,ev_alarm,0,"
if global.isHost {
if !instance_exists(NoticeO) {
ServerMessageString('This server is running an RTD plugin. Taunt to DROP ORBITAL AUTOGUN.',global.sendBuffer);
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = 'This server is running a Modded RTD plugin. Taunt to disguise.';
alarm[0] = 30*5*60;
} else alarm[0] = 7;
}
");
object_event_add(Player,ev_create,0,"iCanRoll = true;");
object_event_add(Player,ev_alarm,10,"iCanRoll = true;");
object_event_add(Character,ev_create,0,"
effect = noone;
");
object_event_add(Character,ev_destroy,0,"
if global.isHost {
if effect != noone {
ServerMessageString(player.name + ' died wile using RTD!',global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' died while using RTD!';
global.canRoll = true;
if player.sentry != noone {
if effect == 23 && player.sentry.special {
//sendEventDestruction(player, -1, -1, 0);
//doEventDestruction(player, -1, -1, 0);
}
}
}
}
");
object_event_add(Character,ev_step,ev_step_normal,"
if global.isHost {
if effect != noone {
switch(effect) {
case 1:
RTDtimer -= 1;
if RTDtimer mod 30 == 0 && RTDtimer <= 90 {
ServerMessageString('Detonation in '+string(RTDtimer/30) ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = 'Detonation in '+string(RTDtimer/30);
}
if RTDtimer <= 0 {
global.canRoll = true;
effect = noone;
with(Character) {
if point_distance(x,y,other.x,other.y) < 64 {
if team != other.team or id == other.id {
lastDamageDealer = other.player;
lastDamageSource = FINISHED_OFF_GIB;
hp = -999;
}
}
}
}
break;
case 2:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer frozen.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer frozen.';
}
break;
case 4:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' can jump again.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' can jump again.';
}
break;
case 5:
if(place_free(x,y+1)) vspeed -= 0.3;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' has normal gravity again.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' has normal gravity again.';
}
break;
case 6:
currentWeapon.ammoCount = currentWeapon.maxAmmo;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' has normal ammo again.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' has normal ammo again.';
}
break;
case 7:
hp = 255;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer invincible.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer invincible.';
hp = hpBkp;
}
break;
case 8:
with(Character) if lastDamageDealer == other.player && timeUnscathed <= 1 hp = -999;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has instakill.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has instakill.';
}
break;
case 9:
doublejumpUsed = false;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' can no longer fly.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' can no longer fly.';
if player.class != CLASS_SCOUT canDoublejump = false;
}
break;
case 10:
RTDtimer -= 1;
runPower = 50;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has hyperspeed.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has hyperspeed.';
runPower = runBkp;
}
break;
case 12:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer confused.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer confused.';
}
break;
case 17:
RTDtimer -= 1;
hp -= 0.2;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer poisoned.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer poisoned.';
}
break;
case 18:
RTDtimer -= 1;
if player.class != CLASS_PYRO && player.class != CLASS_HEAVY
if currentWeapon.refireTime > 5 currentWeapon.refireTime = 5;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has instant reload.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has instant reload.';
}
break;
case 19:
RTDtimer -= 1;
if hp < maxHp hp += 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has health regen.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has health regen.';
}
break;
case 13:
RTDtimer -= 1;
if RTDtimer mod 7 == 0 {
var feeling;
feeling = floor(random(7))
write_ubyte(global.sendBuffer, CHAT_BUBBLE);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ubyte(global.sendBuffer, 22+feeling);
setChatBubble(player, 22+feeling);
}
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' has calmed down.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' has calmed down.';
}
break;
case 22:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer slowed.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer slowed.';
}
break;
case 23:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
if player.sentry != noone {
if player.sentry.special == true {
//sendEventDestruction(player, -1, -1, 0);
//doEventDestruction(player, -1, -1, 0);
}
}
}
break;
case 24:
RTDtimer -= 1;
if RTDtimer mod 7 == 0 {
write_ubyte(global.sendBuffer, CHAT_BUBBLE);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ubyte(global.sendBuffer, 49);
setChatBubble(player, 49);
}
if _hpBkp > hp {
hp -= (_hpBkp-hp)*0.3;
_hpBkp = hp;
}
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer marked for death.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer marked for death.';
}
break;
case 25:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer a pacifist.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer a pacifist.';
}
break;
case 26:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' stopped gunspinning.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' stopped gunspinning.';
}
break;
case 27:
RTDtimer -= 1;
if RTDtimer <= 0 {
currentWeapon.maxAmmo/=2;
currentWeapon.ammo = min(currentWeapon.ammoCount, currentWeapon.maxAmmo);
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has double clip size.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has double clip size.';
}
break;
default:
effect = noone;
}
}
if taunting {
if tauntindex == 0 or tauntindex == tauntlength {
if player.iCanRoll && global.canRoll {
effect = floor(random(global.effects));
if effect == 23 effect = 21;
if effect == 24 effect = 21;
if effect == 26 effect = 21;
if effect == 27 effect = 21;
if effect == 2 effect = 21;
if effect == 3 effect = 21;
if effect == 4 effect = 21;
if effect == 5 effect = 21;
if effect == 6 effect = 21;
if effect == 7 effect = 21;
if effect == 8 effect = 21;
if effect == 9 effect = 21;
if effect == 11 effect = 21;
if effect == 12 effect = 21;
if effect == 13 effect = 21;
if effect == 14 effect = 21;
if effect == 15 effect = 21;
if effect == 16 effect = 21;
if effect == 17 effect = 21;
if effect == 20 effect = 21;
if effect == 22 effect = 21;
if effect == 21 effect = 23;
ServerMessageString(player.name + global.effect[effect],global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + global.effect[effect];
player.iCanRoll = false;
player.alarm[10] = 1;
switch(effect) {
case 0:
effect = noone;
with(Character) {
if point_distance(x,y,other.x,other.y) < 64 {
if team != other.team or id == other.id {
lastDamageDealer = other.player;
lastDamageSource = FINISHED_OFF_GIB;
hp = -999;
}
}
}
break;
case 1:
case 2:
case 6:
case 8:
case 17:
case 18:
case 25:
global.canRoll = true;
RTDtimer = 10*30;
break;
case 3:
hp = 1;
effect = noone;
break;
case 4:
case 5:
case 12:
case 13:
case 19:
case 22:
global.canRoll = true;
RTDtimer = 20*30;
break;
case 7:
global.canRoll = false;
RTDtimer = 10*30;
hpBkp = hp;
break;
case 9:
global.canRoll = false;
RTDtimer = 20*30;
canDoublejump = true;
break;
case 10:
global.canRoll = true;
RTDtimer = 10*60;
runBkp = runPower;
runPower = 40;
break;
case 11:
effect = noone;
hp = maxHp;
case 14:
effect = noone;
currentWeapon.ammoCount = 0;
currentWeapon.alarm[5] = 50;
break;
case 15:
effect = noone;
currentWeapon.ammoCount = currentWeapon.maxAmmo;
currentWeapon.alarm[5] = -1;
break;
case 16:
effect = noone;
vspeed = -15;
moveStatus = 1;
break;
case 20:
effect = noone;
with(Sentry) {
if hp > 25 hp = 25;
else hp = -999;
built = 0;
}
break;
case 21:
if team == TEAM_RED team = TEAM_BLUE;
else team = TEAM_RED;
break;
case 23:
global.canRoll = true;
RTDtimer = 20*30;
if player.sentry != noone {
//sendEventDestruction(player, -1, -1, 0);
//doEventDestruction(player, -1, -1, 0);
}
nutsNBolts += 100;
buildSentry(player,x,y,image_xscale);
player.sentry.special = true;
write_ubyte(global.sendBuffer, BUILD_SENTRY);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ushort(global.sendBuffer, round(x*5));
write_ushort(global.sendBuffer, round(y*5));
write_byte(global.sendBuffer, image_xscale);
break;
case 24:
_hpBkp = hp;
global.canRoll = false;
RTDtimer = 20*30;
break;
case 26:
_aimBkp = aimDirection;
global.canRoll = false;
RTDtimer = 20*30;
break;
case 27:
currentWeapon.maxAmmo*=2;
if currentWeapon.alarm[5] == -1 currentWeapon.alarm[5] = currentWeapon.reloadTime;
global.canRoll = true;
RTDtimer = 20*30;
break;
}
} else {
write_ubyte(global.sendBuffer, CHAT_BUBBLE);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ubyte(global.sendBuffer, 44);
setChatBubble(player, 44);
}
}
}
}
");
//super haxxing of the keybytes so clients don't spazz as much on some effects :)
object_event_clear(Character,ev_other,ev_user1);
object_event_add(Character,ev_other,ev_user1,"
switch(effect) {
case 12:
if (keyState & $20 != 0) {
keyState &= $DF;
keyState |= $40;
} else if (keyState & $40 != 0) {
keyState &= $BF;
keyState |= $20;
}
break;
case 2:
keyState &= $1F;
break;
case 4:
keyState &= $7F;
break;
case 22:
if random(1) < 0.5 keyState &= $9F;
break;
case 25:
keyState &= $E7;
break;
case 26:
aimDirection = _aimBkp + 30;
if aimDirection > 360 aimDirection -= 360;
netAimDirection = aimDirection*65536/360;
_aimBkp = aimDirection;
break;
}
pressedKeys |= keyState & ~lastKeyState;
releasedKeys |= ~keyState & lastKeyState;
lastKeyState = keyState;
");
//sentry requires a whole bunch of changes to work
object_event_add(Sentry,ev_create,0,"special = false;");
object_event_clear(Sentry,ev_step,ev_step_begin);
object_event_add(Sentry,ev_step,ev_step_begin,"
if (global.isHost and (ownerPlayer.class != CLASS_ENGINEER || team != ownerPlayer.team || collision_circle(x,y+10,25,Sentry,false,true)>=0))
{
var bad;
bad = false;
if !instance_exists(ownerPlayer.object) or ownerPlayer.object == -1 bad = true;
else if ownerPlayer.object.effect != 23 bad = true;
if bad {
//sendEventDestruction(ownerPlayer, -1, -1, 0);
//doEventDestruction(ownerPlayer, -1, -1, 0);
exit;
}
}
if built == 0 {
if hp < maxHp hp+=1;
else built = 1;
image_index = floor(hp/maxHp*10);
if landed == 0 {
landed = 1;
playsound(x,y,SentryFloorSnd);
playsound(x,y,SentryBuildSnd);
}
}
if (built == 1 && currentWeapon == -1){
image_index=11;
image_speed=0;
hp=maxHp;
currentWeapon = instance_create(x,y,weapons[0]);
currentWeapon.ownerPlayer=ownerPlayer;
currentWeapon.team=team;
currentWeapon.startDirection=startDirection;
with(currentWeapon) {
event_user(0);
}
}
if (humiliated == 1 && built == 1 && currentWeapon != -1) {
event_user(1);
}
if(place_free(x,y+1)) {
vspeed += 0.00001;
}
if(vspeed>10) {
vspeed=10;
}
if(abs(oldVspeed)!=0 and vspeed==0 and global.isHost)
{
write_ubyte(global.sendBuffer, SENTRY_POSITION);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players, ownerPlayer));
write_ushort(global.sendBuffer, round(x*5));
write_ushort(global.sendBuffer, round(y*5));
}
oldVspeed = vspeed;
");
object_event_add(Sentry,ev_destroy,0,"
if special {
var quote;
quote = chr(39);
ownerPlayer.object.effect = noone;
ownerPlayer.object.RTDtimer = -1;
global.canRoll = true;
ServerMessageString(ownerPlayer.name + quote +'s RTD sentry was destroyed.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = ownerPlayer.name + quote +'s RTD sentry was destroyed.';
}
");
//send your custom event
if keyboard_check_pressed(global.down) && global.myself.object != -1 && !instance_exists(InGameMenuController) {
var spaceBuffer;
spaceBuffer = buffer_create();
write_ubyte(spaceBuffer,ds_list_find_index(global.players,global.myself));
PluginPacketSend(global.spacePacketID,spaceBuffer);
buffer_destroy(spaceBuffer);
if global.isHost {
//The host doesn't send the event to itself so that should be handled here
}
}
//process the custom event
if global.isHost {
while(PluginPacketGetBuffer(global.spacePacketID) != -1) {
var spaceBuffer, space_player;
spaceBuffer = PluginPacketGetBuffer(global.spacePacketID);
space_player = PluginPacketGetPlayer(global.spacePacketID);
if space_player.object != -1 && instance_exists(space_player.object) {
//The host executes the event for other players here (if the player has an object in this case)
with(space_player.object){
nutsNBolts += 100;
buildSentry(player,x,y,image_xscale);
player.sentry.special = true;
write_ubyte(global.sendBuffer, BUILD_SENTRY);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ushort(global.sendBuffer, round(x*5));
write_ushort(global.sendBuffer, round(y*5));
write_byte(global.sendBuffer, image_xscale);
break;
}
buffer_clear(spaceBuffer);
write_ubyte(spaceBuffer, ds_list_find_index(global.players,space_player));
PluginPacketSend(global.spacePacketID,spaceBuffer);
}
buffer_destroy(spaceBuffer);
PluginPacketPop(global.spacePacketID);
}
} else {
while(PluginPacketGetBuffer(global.spacePacketID) != -1) {
var spaceBuffer, space_player;
spaceBuffer = PluginPacketGetBuffer(global.spacePacketID);
space_player = ds_list_find_value(global.players,read_ubyte(spaceBuffer));
if space_player != -1 {
if space_player.object != -1 && instance_exists(space_player.object) {
//The client executes the event for any player here.
with(space_player.object){ nutsNBolts += 100;
buildSentry(player,x,y,image_xscale);
player.sentry.special = true;
write_ubyte(global.sendBuffer, BUILD_SENTRY);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ushort(global.sendBuffer, round(x*5));
write_ushort(global.sendBuffer, round(y*5));
write_byte(global.sendBuffer, image_xscale);
break;
}
}
}
buffer_destroy(spaceBuffer);
PluginPacketPop(global.spacePacketID);
}
}
");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment