Author Topic: Clips (beta)  (Read 6636 times)

0 Members and 1 Guest are viewing this topic.

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Clips (beta)
« on: August 19, 2009, 02:42:55 pm »
Script Name: Clips (beta)
Script Description Limited clips (ammo) for players, currently beta
Author: croat1gamer_v1.0
Compile Test: Passed
Core Version: 2.6.5
Hosted by: Soldat Central - http://soldatcentral.com/

Full Description:
As the name says, you have limited clips with each weapon.
You can edit the amount off the clips in the .pas file.

It is still a beta, because of 3 bugs:
1. Spas ammo- I might have an idea, but its for now too hard.
2. M79 shoots after reloading inside of 1 second- Blame the
AppOnIdle calling it just each second.
3. Changing weapons while reloading- 80% fixed, could need
something more reliable than the current fix

It is still a beta, the Bugged weapons (Spas and M79) are disabled
via SetWeaponActive.

For those who dont know what i mean by clips:
When you reload you loose one clip, no matter how many bullets
you had in it, so the ammo in it is lost.
When you get to 0 clips and fire all shots from it the weapon gets
removed (trying to find a way to spawn a gun with 0 bullets in it,
unsuccessful still).

Also, its my first script. :P

*NOTE:
Do not use weapon mods which have reload shorter than 1
second, as the script is based on AppOnIdle.

Also, it seems that the SetWeaponActive has some problems if
there are other scripts that use the same procedure.

RC version might come soon.



(Size 1.35 KB)
- http://soldatcentral.com/index.php?page=script&f=132 -


** Script hosted by Soldat Central! Please visit the author's script page and Rate this script **
« Last Edit: August 21, 2009, 02:46:54 pm by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: Clips (beta)
« Reply #1 on: August 20, 2009, 03:21:01 am »
I am very interesting in your script. Fix the bugs and I'll give it a try.

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #2 on: August 20, 2009, 04:26:32 am »
The weapon changing should be repaired soon, while Spas ammo will take some longer time.

The reload inside one secon is currently hard to make due to AppOnIdle being called just each second.

When i finish the weapon changing one it will be a rc version, as for Spas, i might need to nag EnEsCe for that.
« Last Edit: August 20, 2009, 04:29:56 am by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline Croatian

  • Major
  • *
  • Posts: 85
  • :)
Re: Clips (beta)
« Reply #3 on: August 20, 2009, 04:35:28 am »
Try to share it with Curt, he might help

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #4 on: August 20, 2009, 05:24:36 am »
Notice the first comment in the script (credits).

Also, it seems that the SetWeaponActive has some problems if there are other scripts that use the same procedure.
« Last Edit: August 20, 2009, 05:27:17 am by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Clips (beta)
« Reply #5 on: August 20, 2009, 10:14:12 pm »
thanks for the moustache {:

DarkCrusade

  • Guest
Re: Clips (beta)
« Reply #6 on: August 21, 2009, 09:52:42 am »
This could be interesting for -Niko-. He tried to do exactly what you did but thought it wouldn´t work because of the ScriptCore. It´s a great idea, I hope that I´ll see a server with that script soon somewhere since it adds more realism to game [pigtail]

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #7 on: August 21, 2009, 10:42:38 am »
But some things would need a bit upgraded scriptcore, as the current one has some flaws for the script.

Also, this is currently how im trying to fix the weapon changing bug, but as im at my workplace i dont have access to make a server and try it.

Code: [Select]
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);

begin
for i := 1 to 32 do
if c[i] = false then begin
if r[i] = true then dec(clip[SecondaryNum][i], -1);
c[i] := true;
end;
end;

It still needs a double check, as i dont think that this will suffice to solve it.
Also, excessive weapon changing has 2 things that will happen if im right:
1) Lag
2) You will loose/get clips (not sure which one will happen)

Note:
This is experimental, and not yet tested.
If someone wants to try it, here is the whole script (dev one)
http://pastebin.com/m34198e6a

Also, the current script was made on the July 10, 2009, while the original version (which called 64 GetPlayerStats per second and created +50 additional ping, lol) was made a week before it.
« Last Edit: August 21, 2009, 10:52:25 am by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline Serial K!ller

  • Camper
  • ***
  • Posts: 408
    • Soldat Mods Archive
Re: Clips (beta)
« Reply #8 on: August 21, 2009, 12:50:20 pm »
You should check if slot is active, no point in checking player stats on unused slots :p
Code: [Select]
for i := 1 to 32 do begin
   if (GetPlayerStat(ID, 'Active') = true) then begin


   end;
end;

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #9 on: August 21, 2009, 01:36:20 pm »
Something like this?
http://pastebin.com/m36d45301

Not sure if it works though.
Working for another 25 minutes, then going home to test the dev version.
« Last Edit: August 21, 2009, 01:49:22 pm by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #10 on: August 21, 2009, 02:50:57 pm »
The OnWeaponChange quickfix released.
It isnt too reliable in some cases, but should work fine for now.

For Spas users- Wait, still no ideas how to fix it. I might nag EnEsCe for that one.
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline Shard

  • Camper
  • ***
  • Posts: 449
  • yeet
Re: Clips (beta)
« Reply #11 on: August 24, 2009, 04:03:41 am »
Just wondering, what did you do for the law? Did you give a player just one? Or did you give them a few, like 3 shots?

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #12 on: August 24, 2009, 04:25:14 am »
Read the .pas file.
Good that you mentioned that one, i see that i missed some amounts (accidentally, but also might intentionally), will fix it later (~4 hours, when i return from work).

There are 2 settings that i will use:
Realistic (default)
Normal
I might do something with ReadINI so it changes, depending which gamemode is being used.

And no, law wont have 1 shot by default, no matter what.
« Last Edit: August 24, 2009, 04:31:13 am by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline Shard

  • Camper
  • ***
  • Posts: 449
  • yeet
Re: Clips (beta)
« Reply #13 on: August 24, 2009, 11:00:00 am »
7 law shots is too much, if I read that right.

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #14 on: August 24, 2009, 12:23:19 pm »
Fixing now.
Yeh, i was too lazy to update it then.
^._.^

Current one:
4 // Desert Eagles
3 // MP-5
2 // AK-74
3 // Steyr AUG
21 // Spas-12 /IGNORE THIS
2 // Ruger
7 // M79 /You can ignore it, but dont need to
2 // Barret M82A1
2 // FN Minimi
4 // Minigun
6 // M72 Law /Its balanced imo
7 // USSocom
21 // Chainsaw

*NOTE: It is an realistic/tw balance, as the amount of clips is partially for spraying.
And as i said, if you have any problems with it, mention them here:
http://forums.soldat.pl/index.php?topic=35271

I would need a few people who would like to test it in some sooner time.
« Last Edit: August 24, 2009, 12:41:03 pm by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline F4||3N

  • Soldier
  • **
  • Posts: 245
Re: Clips (beta)
« Reply #15 on: August 25, 2009, 05:04:20 am »
For knife, you could have 5 or so. (automatically respawn in your hand, or reload to respawn)

but once you throw it, the knife disappears.

this will be mad if it works!

Offline Mittsu

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 617
Re: Clips (beta)
« Reply #16 on: August 25, 2009, 06:09:27 am »
i think Barrett should have only 1 clip and law 3 bullets

and nice cript, cant wait for the bugs to be fixed
Realistic-Soldat.net
<+elerok> soldat is dead
<+AThousandD> shit happens

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Clips (beta)
« Reply #17 on: August 25, 2009, 07:46:49 am »
A forum member mentioned to me for the SNI Pro Climb server, and that it gets times by milliseconds, so any ways to speak to the script maker of its script, as it might be a solution to the Spas and M79 bugs.


NOTICE:
Also, i will host tomorrow an server with the script, realistic, probably tw (except stated otherwise), which will have the script, to test it, also i will include a script to comment any bugs you find out, with an possible uptime of 23/7.

My ip is dynamic, so i wont be able to provide it (unless changing the ip stated here every 24 hours) except the name.
Hosted in Europe, Croatia, 6+ mbps speed (home hosted, aye), but the ping kick will be +1k so anyone can test it.
« Last Edit: August 25, 2009, 07:56:46 am by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: Clips (beta)
« Reply #18 on: September 02, 2009, 03:45:09 pm »
Hi Croat, i've found what you've been searching for :P
Code: [Select]
const
TIMER = 100; //It means: 100 times per second

Procedure AppOnIdle(Ticks: integer);
var
  i: integer;
begin
  for i:=0 to TIMER do begin
     WriteConsole(0,'works',$E4C3C3C) // Change that line for whatever you want.
    Sleep(1000/TIMER);
  end;
end;
It is currently like Milliseconds, you can change it to a higher number to get more precise.
CHEERS!

Offline Serial K!ller

  • Camper
  • ***
  • Posts: 408
    • Soldat Mods Archive
Re: Clips (beta)
« Reply #19 on: September 02, 2009, 04:01:57 pm »
Can't use sleep() it stops all activity on the server creating massive lag :/

I read somewhere to use a bot and createbullet above the bot and the time the bullet takes to fall will create a loop with delay on onplayerdamage().
« Last Edit: September 02, 2009, 04:06:35 pm by Serial K!ller »