Author Topic: OnWeaponChange Errors...  (Read 1061 times)

0 Members and 1 Guest are viewing this topic.

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
OnWeaponChange Errors...
« on: June 23, 2010, 01:19:24 pm »
Code: [Select]
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: integer);
begin
if (Getplayerstat(ID,'name')='Zombie') and (PrimaryNum <> 15) then
begin
ForceWeapon(ID,15,15,0);
end;
if (Getplayerstat(ID,'name')='Rancid') and (PrimaryNum <> 10) then
begin
ForceWeapon(ID,10,10,0);
end;
if (Getplayerstat(ID,'name')='Mr.Death') and (PrimaryNum <> 10) then
begin
ForceWeapon(ID,10,10,0);
end;
end;

now...

Code: [Select]
[*] [Error] Extreme -> (OnWeaponChange): Out of Global Vars range
[*] [Error] Extreme -> (OnWeaponChange): Invalid Opcode

what the hell is wrong here...? x.x pls help...
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: OnWeaponChange Errors...
« Reply #1 on: June 23, 2010, 01:46:00 pm »
Is it for a zombie server?



Didnt script for quite some while, so it might be a bit crappy.

Code: (pascal) [Select]
procedure AppOnIdle(Ticks: integer);
var
i: integer;
begin
for i := 1 to 32 do
 if GetPlayerStat(i,'human') = false then begin  // unless you want anyone who is who is having the nicks to get the weapon
if Getplayerstat(i,'name')='Zombie' then if GetPlayerStat(i,'primary') <> 15 then ForceWeapon(i,15,255,0);
if Getplayerstat(i,'name')='Rancid' then if GetPlayerStat(i,'primary') <> 10 then ForceWeapon(i,10,255,0);
if Getplayerstat(i,'name')='Mr.Death' then if GetPlayerStat(i,'primary') <> 10 then ForceWeapon(i,10,255,0);
end;
end;
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: OnWeaponChange Errors...
« Reply #2 on: June 23, 2010, 02:03:18 pm »
ill try it :)
btw yes, its for zombie server ^^ im still building my script so im getting a lot of errors every day :P ill release it when i finally make all what i want :D // now i got 3405 lines in script so i think that my PC is too weak for it, ill try to run it on my Sister's PC tomorrow, so if you want to test my server its called "Zombieland"
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: OnWeaponChange Errors...
« Reply #3 on: June 23, 2010, 02:20:53 pm »
It's not your PC, I can trust you ;P

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: OnWeaponChange Errors...
« Reply #4 on: June 23, 2010, 02:28:07 pm »
AccesViolations is not from low CPU / RAM? i have big problems with that when i use skills on my server sometimes, server dying xD
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: OnWeaponChange Errors...
« Reply #5 on: June 23, 2010, 03:40:00 pm »
No, not from CPU/RAM w/e, just not good enough coded, ask if you get errors, we're here to help^^

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: OnWeaponChange Errors...
« Reply #6 on: June 24, 2010, 04:35:04 pm »
Use IDToName instead of GetPlatyerStat(). It's more stable afaik
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: OnWeaponChange Errors...
« Reply #7 on: June 25, 2010, 01:57:29 am »
Use IDToName instead of GetPlatyerStat(). It's more stable afaik
wasn't it exactly the other way?

Offline kosik231

  • Major
  • *
  • Posts: 70
  • Where can I find Your soul?
Re: OnWeaponChange Errors...
« Reply #8 on: June 25, 2010, 03:28:17 am »
so u prefer idtoname? ill try with it ^^ now im in my sis home so i cant update server's script that fast, ill make it soon
For signatures, you are allowed only one image in your signature which may not be wider and taller than 300 and 125 pixels, and may not be over 20kB in file size. No BMPs are allowed.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: OnWeaponChange Errors...
« Reply #9 on: June 25, 2010, 10:28:19 am »
Use IDToName instead of GetPlatyerStat(). It's more stable afaik
wasn't it exactly the other way?
Yes. It is suggested to use GetPlayerStat for name rather than IDtoName.

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: OnWeaponChange Errors...
« Reply #10 on: June 25, 2010, 10:58:42 am »
Since when and why shall it?