PDA

View Full Version : Files for extended Server + Random-Scripts like sliding mapvote on Deathrun



kung foo man
12th January 2013, 20:52
Hey all,

here you can see the scripts used to add MySQL etc. to CoD2: http://killtube.org/downloads/cod2/exampleserver/main/std/

Also random-scripts included like mapvote.gsc and ad.gsc (even surf and bunnyhop, go and awake surf to life! :D)

Functions:


- setVelocity, getVelocity, addVelocity (needed for the mods: portal, surf)
- keyPressed-functions for left, right, forward, backward, leanleft, leanright, jump etc., (needed for: surf, doublejump made by IzNoGod)
- blazing fast astar-implementation (needed for: zombots)
- setAlive-function (needed for: zombots, so xmodels are damagable without damage-trigger... zombots in stockmaps)

Mitch
13th January 2013, 12:32
Very nice, I have been looking into some of the work. I would myself change this:



CREATE TABLE IF NOT EXISTS `players` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user` varchar(32) DEFAULT NULL,
`pass` varchar(32) DEFAULT NULL,
`money` int(10) DEFAULT NULL,
`xp` int(10) DEFAULT NULL,
`kills` int(10) DEFAULT NULL,
`headshots` int(10) DEFAULT NULL,
`melee_kills` int(10) DEFAULT NULL,
`longest_killstreak` int(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


to



CREATE TABLE IF NOT EXISTS `players` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user` varchar(32) DEFAULT NULL,
`pass` varchar(32) DEFAULT NULL,
`money` int(10) DEFAULT 0,
`xp` int(10) DEFAULT 0,
`kills` int(10) DEFAULT 0,
`headshots` int(10) DEFAULT 0,
`melee_kills` int(10) DEFAULT 0,
`longest_killstreak` int(10) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


Now you don't need to set the value for money, xp etc.. Also you don't need to use the function IFNULL to check if the value is null. Like is done here:



CREATE FUNCTION statsDeltaMoney (id_ INT, money_ INT)
RETURNS INT
DETERMINISTIC
BEGIN
DECLARE ret INT;
SET ret = NULL;
UPDATE players SET money=IFNULL(money,0)+money_ WHERE id = id_;
SELECT money FROM players WHERE id = id_ INTO ret;
RETURN ret;
END

kung foo man
19th January 2013, 05:44
Added:
- std\utils::disableGlobalPlayerCollision();
- std\utils::getType(arg);

First function prevents player collision (used for: codjumper, zombots, surf...)

Second function retrieves the type of an argument: std\utils::getType("test") == "STRING" (the function for for EVERY type)

kung foo man
24th January 2013, 09:30
Fixed the earlier disableGlobalPlayerCollision()-implementation (brushmodels didnt move the player anymore). Its working nice in CoD2 1.2/1.3 now.

If somebody got ideas for new functions, please write them here.

serthy
24th January 2013, 14:32
maybe (if you are very bored lol):

- solidTrace( <startPos> , <endPos> , <innerBounds> , <outerBounds> , <hitPlayers> , <ignoredEnt> ) to check if there is something in that qubic-solid trace
- setWeaponAnim( <anim> ) or playWeaponAnim( <anim> ) to play a reload etc. anim
- stopFx( <fxEnt> ) to stop the effect immediately (now you have to wait till the effect dies on its own)
- getClientCvar( <var> )
- getArrayKeys( <array> ) keys = getArrayKeys( arr ); foreach( key ){ arr[key].....
- playSoundToTeam( <alias> )
- improved motions (moveTo()/rotateTo() are looking really "laggy" if the move/rotate too fast)
- setMoveSpeedScale( <speedScale> )
- rcon( <order> ) to exec rcon via script without execClientCmd-method
- maybe apply some global flags/funcs on clients (speed/gravity/timescale/falldamage)
- maybe some simple vehicles, or the ability to move entities on the ground (ground-detection)
- in addition to that collission detection of entities with the worldgeometry
- changeFontscaleOverTime( <time > ) & changeColorOverTime( <time > ) & changeAngleOverTime( <angle> ) for hud elements or improved setText() without the need of precaching
- maybe some scoreboard tweaks
- manipulate /writeconfig to write stats on the clients rig (but hey, u already got mysql... so no need for this)
but for now, the most important one, setCanDamage(), you already implemented :D
so, if you are bored, you can think about my suggestions j4f
i dont know if there are even possible to implement...

IzNoGoD
24th January 2013, 17:46
stopfx already works in normal cod:


fx = playfx(stuff goes here);
wait 1;
fx delete();


Getclientcvar is impossible, is clientside, not serverside. Also opens the door for keystealers.

Playsoundtoteam() should be easily achievable, as it is in sd.gsc already.

Motions can be improved by upping sv_fps, which in turn causes timings to fuck up.

ent-world geometry detection can be done by spawning a few trigger-radiusses on the outside of your ent, then check istouching() with worldspawn (getent("worldspawn", "targetname"))

changeangleovertime() can be done using setclock(), but only in one direction. Is a clientside problem though, cant really be fixed. Until then, just manually call the functions again and again. Only works for images.


+1-ing these suggestions:

playweaponanim
setmovespeedscale (+0.5 here, not really +1 as it is kinda achievable through weapons)
rconcommand() should be very, very useful, especially if you can restart the server with it to get rid of bots. Or just add a proper kickbot() command. Hey, that shouldnt be too hard?
global flags on client (speed, grav, falldamage, but NOT timescale (how would that even work?))


Solidtrace() can sorta be replaced by some built-in function that uses the player's size to trace, but only returns the last origin a player can stand. (forgot function name)

Mitch
24th January 2013, 20:03
Would it be possible to make a trace that gets the entity of a misc model? For example in a hide and seek mod you can clone the model you are looking at.

Jeplaa
24th January 2013, 20:35
kickbot() function sounds good, cause kicking bots after map restart is really annoying...

Earliboy
24th January 2013, 22:39
There is allready a way to get Bots out of the Server, I'm not able to say how, but its with rcon + sort of server restart

randall
24th January 2013, 22:58
players = getEntArray("player", "classname");
for (i = 0; i < players.size; i++)
{
player = players[i];

if (getSubStr(player.name,0,3) == "bot" )
player kick();
}

IzNoGoD
24th January 2013, 23:04
That doesnt free the ZMBI slot left by the kicked bot

Earliboy
25th January 2013, 00:47
Try that out, then do /rcon status ;) You will get buggy Slots if u just kick them, idk what the "ghost" slots are doing (never tryed that out), but i think it won't be that good.

Mitch
25th January 2013, 13:22
players = getEntArray("player", "classname");
for (i = 0; i < players.size; i++)
{
player = players[i];

if (getSubStr(player.name,0,3) == "bot" )
player kick();
}

Every real player that starts with bot gets kicked as well =]

Earliboy
25th January 2013, 14:02
Just at the Bot adding add a player.pers["bot"] = true; or something like that. Thats how i control my bots when i test something new out.

Sp1re
25th January 2013, 23:20
how to kick bots?

/rcon login (PW)
/rcon kick (NAME OF BOT)

i think it was this, if its wrong i am sorry.

Earliboy
26th January 2013, 00:07
Sp1re, if you just kick them, you get a "Ghost/Zombie" slot. You need to kick them via script, but only kick player doesnt works. Like i said, a sort of server restart is needed.

php
30th January 2013, 19:00
Animations playable on any entity with a single method.

Sp1re
12th February 2013, 14:41
yes, after you kick the bots, and you restart the map, the bots will be back.
but if you restart the server there gone.

Mitch
19th May 2013, 09:29
Maybe hashing like md5 would be nice for saving someone password.

kung foo man
19th May 2013, 19:06
MySQL does that for you :)


SELECT md5('test')

Mitch
20th May 2013, 13:06
MySQL does that for you :)


SELECT md5('test')
Thanks. I have been looking into mysql's security functions. It is safer to use SHA2.



DELIMITER $$

DROP FUNCTION IF EXISTS generateSalt$$

CREATE FUNCTION generateSalt()
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
DECLARE x INT;
DECLARE s VARCHAR(255);
SET s = '';
SET x = 0;

WHILE x < 10 DO
SET s = CONCAT(s,CHAR(FLOOR(34+(RAND()*93))));
SET x = x + 1;
END WHILE;

RETURN s;
END$$

DELIMITER ;




SET s = generateSalt();
SET pass = SHA2(CONCAT(s, pass), 256);

Mitch
13th June 2013, 19:51
If you have got an account system and you often search your user on their username. Then it would be better to make this an index. This will increase performance 10 times.



CREATE INDEX players_user ON players(user);


If you want to see or drop your one of your indexes


SHOW INDEX FROM players;
DROP INDEX players_user ON players;

ARTOTTO
31st July 2019, 13:53
Decent, need to accomplish something like this with mine.