Author Topic: need help with rank system  (Read 910 times)

0 Members and 1 Guest are viewing this topic.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
need help with rank system
« on: July 30, 2010, 02:25:20 am »
hey guys, having some trouble with a rank system im trying to set up, which basically adds 10 damage for every 1 rank, say if the are rank 3 it should be adding 30 damage, only, with the code i have its stopping damage altogether

also seems to be stopping commands from going through

man, what?

i have attached the code

edit: reuploaded

i really really need help with this, this is the only place i can come for help, i will accept any answer i get, but Constructive Posts only please

if it helps, heres the code im using for the rank system

http://pastebin.com/ZuUMi0T7
« Last Edit: July 30, 2010, 02:51:15 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: need help with rank system
« Reply #1 on: July 30, 2010, 04:29:20 am »
Code: [Select]
result := Damage;... You're really missing the basics  ::)

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: need help with rank system
« Reply #2 on: July 30, 2010, 05:05:34 am »
thanks swompie, :D

but im getting Duplicate identifier if i try to redefine what Result is in OnDamage, but its not in vars so i dont know why it errors with duplicate identifier, its erroring in This section:

Code: (pascal) [Select]
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
var Result:Integer
begin
RankDam[Shooter]:=RankNum[Shooter]*RankDamageMult;
Result:=Damage+RankDam[Shooter];
WriteLn('should be adding damage');
end;

Result is already used in other functions as a boolean i think so how do i redefine it for use in OnDamage? (Split the code?) i cant becuase i need the code for the ini functions, since Result is used in the ini functions then this might also cause an error

btw when i added this part of code it actually recompile ingame fine, btw wouldnt compile until i removed var Result from OnDamage, then i killed a couple of zombies, then server crashed due to type mismatches in both OnPlayerKill and OnDamage, the type mismatch in OnPlaerKill only happened AFTER adding Result and removing "var Result" in OnDamage

File attached
« Last Edit: July 30, 2010, 05:16:39 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: need help with rank system
« Reply #3 on: July 30, 2010, 09:10:36 am »
result is a reserver variable, it is in every function you define, and it's type is defined right in the end of your line saying "function bla bla"

for example here:

function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;

result is an integer.

TLDR: dont declare it, just use it

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: need help with rank system
« Reply #4 on: July 30, 2010, 07:01:39 pm »
thanks so much dnmr, that makes so much more sense :), makes it easier, you guys wouldnt happen to have the original weapons.ini by chance? ive changed my weapons.ini, i want to go back to original weapons settings

From: July 30, 2010, 08:12:37 pm
edit:nvm fixed it :)
« Last Edit: July 30, 2010, 10:46:48 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D