Spawn-For-Fun (Simple/understandable OnPlayerSpawned RollDice plugin)
DISCLAIMER: Due to @JariZ zx and others working on a bigger/better version of this (see the sticky-ed thread in the plugins forums)
I was asked to wait releasing this. And so I did
Changelog / Updates:
26-03-2012 16:30 - Update v1.1 (Fixes Predatorstreak being smoke grenade)
Please +Rep. me, if you enjoy using this Plugin / Source!
Please +Rep. me, if you enjoy using this Plugin / Source!
Now that you've all seen his plugin (Great work btw! looks Awsome!)
Here's what I was running on my servers the past few days, i actually allready finished it before OnPlayerSpawned was implemented in the addon (Damn you whoever added it to the docs before implementing!)
What the plugin does? a video can tell a lot !
Just to clarify on the plugin and the viceo:
My servers have always been running with
- Infinite Ammo
- Lowgrav, High speed, No Fall Damage
- Custom predefined classes
This is the main reason why you dont find rolls about ammo, weapons or speed
OpenSource (As always!) And you might find some famillair code from the FunDropper by yamraj in it
see it in action on the servers in my signature
Please +Rep. me, if you enjoy using this Plugin / Source!
Please +Rep. me, if you enjoy using this Plugin / Source!
DISCLAIMER: Due to @JariZ zx and others working on a bigger/better version of this (see the sticky-ed thread in the plugins forums)
I was asked to wait releasing this. And so I did
Changelog / Updates:
26-03-2012 16:30 - Update v1.1 (Fixes Predatorstreak being smoke grenade)
Please +Rep. me, if you enjoy using this Plugin / Source!
Download it here! (Click to View)
Download the DLL and drop it into your plugins folder!
SpawnForFun_V1_1.zip (Size: 4.48 KB / Downloads: 152)
SpawnForFun_V1_1.zip (Size: 4.48 KB / Downloads: 152)
Now that you've all seen his plugin (Great work btw! looks Awsome!)
Here's what I was running on my servers the past few days, i actually allready finished it before OnPlayerSpawned was implemented in the addon (Damn you whoever added it to the docs before implementing!)
What the plugin does? a video can tell a lot !
Just to clarify on the plugin and the viceo:
My servers have always been running with
- Infinite Ammo
- Lowgrav, High speed, No Fall Damage
- Custom predefined classes
This is the main reason why you dont find rolls about ammo, weapons or speed
OpenSource (As always!) And you might find some famillair code from the FunDropper by yamraj in it
Source (all in 1 file) (Click to View)
CSHARP Code
- using System;
- using Addon;
- using System.Runtime.InteropServices;
- using System.Collections.Generic;
- using System.Text;
-
- // Initial coding/build : 15-3-2012 13:44
- // First testing/live on servers : 16-3-2012 22:30
- // last update (v1.0 - release) : 26-3-2012 9:00
- // If you want nicer code, use JariZ's version! it has 50 differrent roles!!
- // find it at: <a href="http://www.itsmods.com/forum/Thread-Release-Roll-the-Dice-MOD-for-MW3.html" target="_blank" rel="noopener" class="mycode_url">http://www.itsmods.com/forum/Thread-Rele...r-MW3.html</a>
- //
- // imho rolling dices is only 1 - 12 (two dices) ;-) :umad:
-
- namespace SpawnFun
- {
- public class SPFClass : CPlugin
- {
- [DllImport("kernel32.dll", SetLastError = true)]
- public static extern bool WriteProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
- unsafe public override void OnServerLoad()
- {
- ServerPrint("[SpawnForFun] v1.0 (26-3-2012) (By Pieter) has loaded... \n[SpawnForFun] RollDice on every player spawn!");
- int oP;
- byte[] bytes = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
- WriteProcessMemory(((IntPtr)(-1)), 0x0047EFD2, bytes, bytes.Length, out oP);
- SetDvar("perk_grenadedeath", "flash_grenade_mp");
- }
- public override void OnFastRestart()
- {
- OnMapChange();
- }
- public override void OnMapChange()
- {
- SetDvar("perk_grenadedeath", "smoke_grenade_mp"); //incase no one rolls a deathperk set it to smoke
- }
- public override void OnPlayerConnect(ServerClient Client)
- {
- iPrintLnBold("[^1Spawn-Fun^7]^2 (by ^3Pieter^2) Welcome ^3and ^7Have-Fun^1!", Client);
- TellClient(Client.ClientNum, "[^1!Spawn-FUN!^7] ^2This is a ^1FUN-SERVER^7 !!!", true);
- TellClient(Client.ClientNum, "[^1!Spawn-FUN!^7] ^2Every Respawn you ^1roll the dice^7 !!!", true);
- TellClient(Client.ClientNum, "[^1!Spawn-FUN!^7] ^2And might earn a ^1SURPRISE^7 !!!", true);
- iPrintLn("[^1Spawn-Fun^7]^2by ^3Pieter^2 from ^7www.itsmods.com (-: ", Client);
- }
- public override void OnPlayerSpawned(ServerClient Client)
- {
- int FunMaker;
- FunMaker = RandomNumber.Next(1, 12); // two dices! as it should be!
- iPrintLnBold("[^3Spawn-FUN^7]^2 You rolled ^7("+ FunMaker +")^2 \\o/", Client);
-
- // and here are the rewards/surprizes
- // i know this can be coded better using variables and settings, but i wrote this all quickly during office hours ;-)
-
- if (FunMaker == 3) // Flying Spawn
- {
- Client.OriginZ = (Client.OriginZ+1500);
- SetClientDvar(Client.ClientNum, "r_colormap \"1\"");
- SetClientDvar(Client.ClientNum, "r_detail \"1\"");
- SetClientDvar(Client.ClientNum, "r_fog \"1\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"1\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"0\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^2Heavenly respawn!^7 Fly like an Eagle!", true);
- iPrintLn("[^3SpawnForFun^7]^2You can leave the server safely during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^3All client settings have been set to normal!", Client);
- }
- else if (FunMaker == 5) // Thirdperson view - Funny colormap-settings
- {
- SetClientDvar(Client.ClientNum, "r_colormap \"3\"");
- SetClientDvar(Client.ClientNum, "r_detail \"1\"");
- SetClientDvar(Client.ClientNum, "r_fog \"0\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"1\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"2\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^2GTA ^7 view!!", true);
- iPrintLn("[^3SpawnForFun^7]^3Do ^1NOT^3 leave ^7the server during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^3Or you will be ^1stuck^3 with this appearance!", Client);
- }
- else if (FunMaker == 6) // EMP Deathstreak for all and no crosshair
- {
- SetDvar("perk_grenadedeath", "emp_grenade_mp");
- SetClientDvar(Client.ClientNum, "r_colormap \"1\"");
- SetClientDvar(Client.ClientNum, "r_detail \"1\"");
- SetClientDvar(Client.ClientNum, "r_fog \"1\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"1\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"0\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"0\"");
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^2EMP Deathstreak for all!^7 Oh! and we stole your crosschair! muhaha!", true);
- ServerSay("[^3SpawnForFun^7] ^2"+Client.Name+"^3 Rolled 6 and changed Deathstreak to EMP for all!", true);
- iPrintLn("[^3SpawnForFun^7]^2You can leave the server safely during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^3All client settings have been set to normal!", Client);
- }
- else if (FunMaker == 7) // Thirdperson view - Normal Graphics
- {
- SetClientDvar(Client.ClientNum, "r_colormap \"1\"");
- SetClientDvar(Client.ClientNum, "r_detail \"1\"");
- SetClientDvar(Client.ClientNum, "r_fog \"1\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"1\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"2\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^23rd Person ^7 view!!", true);
- iPrintLn("[^3SpawnForFun^7]^3Do ^1NOT^3 leave ^7the server during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^3Or you will be ^1stuck^3 with this appearance!", Client);
- }
- else if (FunMaker == 8) // colormap tweaks (firstperson view)
- {
- SetClientDvar(Client.ClientNum, "r_colormap \"3\"");
- SetClientDvar(Client.ClientNum, "r_detail \"0\"");
- SetClientDvar(Client.ClientNum, "r_fog \"0\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"0\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"0\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^2HalfLife 2 VIEW! ^1You Luck0r^7!", true);
- iPrintLn("[^3SpawnForFun^7]^2Do ^3NOT^2 leave ^7the server during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^2Or you will be ^3stuck^2 with this appearance!", Client);
- }
- else if (FunMaker == 9) // Predator DeathStreak (for all) and Flying respawn!
- {
- SetDvar("perk_grenadedeath", "remotemissile_projectile_mp"); // correction: accidently pasted emp in here!
- Client.OriginZ = (Client.OriginZ + 1500);
- SetClientDvar(Client.ClientNum, "r_colormap \"1\"");
- SetClientDvar(Client.ClientNum, "r_detail \"1\"");
- SetClientDvar(Client.ClientNum, "r_fog \"1\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"1\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"0\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^2Predator Deathstreak for all!^7 (B.F.G)!! And a Heavenly respawn!", true);
- ServerSay("[^3SpawnForFun^7] ^2" + Client.Name + "^3 Rolled 9 and changed Deathstreak to ^2PREDATOR^3 for all!", true);
- iPrintLn("[^3SpawnForFun^7]^2You can leave the server safely during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^3All client settings have been set to normal!", Client);
- }
- else if (FunMaker == 10) // Smoke Deathstreak and Darkness
- {
- SetDvar("perk_grenadedeath", "smoke_grenade_mp");
- SetClientDvar(Client.ClientNum, "r_colormap \"0\"");
- SetClientDvar(Client.ClientNum, "r_detail \"1\"");
- SetClientDvar(Client.ClientNum, "r_fog \"0\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"1\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"0\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^2Smoke Grenade Deathstreak for all!^7 (And you are back to BLACK!)!!", true);
- ServerSay("[^3SpawnForFun^7] ^2" + Client.Name + "^3 Rolled 10 and changed Deathstreak to ^2Smoke Grenade^3 for all!", true);
- iPrintLn("[^3SpawnForFun^7]^3Do ^1NOT^3 leave ^7the server during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^2Or you will be ^3stuck^2 with this appearance!", Client);
- }
- else if (FunMaker == 11) // Colormap fun and flying spawn
- {
- SetClientDvar(Client.ClientNum, "r_colormap \"3\"");
- SetClientDvar(Client.ClientNum, "r_detail \"0\"");
- SetClientDvar(Client.ClientNum, "r_fog \"0\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"3\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"0\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- Client.OriginZ = (Client.OriginZ + 1500);
- TellClient(Client.ClientNum, "[^1SURPRISE!^7] ^2HalfLife2-VIEW!^7 AND ^2Heavenly spawn^7!! ^1You Luck0r^7!", true);
- iPrintLn("[^3SpawnForFun^7]^3Do ^1NOT^3 leave ^7the server during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^3Or you will be ^1stuck^3 with this appearance!", Client);
- }
- else // reset all to basic
- {
- SetClientDvar(Client.ClientNum, "r_colormap \"1\"");
- SetClientDvar(Client.ClientNum, "r_detail \"1\"");
- SetClientDvar(Client.ClientNum, "r_fog \"1\"");
- SetClientDvar(Client.ClientNum, "r_specularMap \"1\"");
- SetClientDvar(Client.ClientNum, "camera_thirdperson \"0\"");
- SetClientDvar(Client.ClientNum, "ui_drawCrosshair \"1\"");
- TellClient(Client.ClientNum, "[^1BUMMER!^7] ^1:-(^7 No ^2SURPRISE^7 on this spawn ^1(no prize!)^7 !", true);
- iPrintLn("[^3SpawnForFun^7]^2You can leave the server safely during this spawn!", Client);
- iPrintLn("[^3SpawnForFun^7]^3All client settings have been set to normal!", Client);
- }
-
- }
-
- public ServerClient GetClientByName(string name)
- {
- if (name == null)
- return null;
-
- ServerClient client = null;
-
- for (int i = 0; i < 18; i++)
- {
- client = GetClient(i);
-
- if (client == null)
- continue;
-
- if (client.Name.ToLower().Contains(name.ToLower()))
- return client;
- }
-
- return null;
- }
- }
-
-
-
- }
Credits (Click to View)
Code:
Nukem
Jariz
zxz0O0
yamraj
and the players in my servers for providing feedback on things!
Download it here! (Click to View)
Download the DLL and drop it into your plugins folder!
SpawnForFun_V1_1.zip (Size: 4.48 KB / Downloads: 152)
SpawnForFun_V1_1.zip (Size: 4.48 KB / Downloads: 152)
Had a life, Got a modem..