Author Topic: Frosty's scripting thread  (Read 21891 times)

0 Members and 1 Guest are viewing this topic.

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #40 on: July 19, 2010, 03:22:36 pm »
Right again! ;)

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #41 on: July 19, 2010, 06:46:36 pm »
it doesnt get rewritten every second


i havent posted whats modifying the Timer, but it is called every 5 minutes, not every second

if u uncomment line 13 on what i posted on the last page, thats the modifier, before posting this however, i had commented out that entire section until i figured out whats going on, realised that
Code: (pascal) [Select]
inisave('Players/'+GetPlayerStat(i,'Name')+'.ini',iniLoad('Players/'+GetPlayerStat(ID,'Name')+'.ini')); 
was actually supposed to be:
inisave('Players/'+GetPlayerStat(i,'Name')+'.ini',iniLoad('Players/'+GetPlayerStat(i,'Name')+'.ini')); 

as there is no ID var in apponidle, like it is for Oncommand, etc, so the script was getting confused

if i was using it as the section was posted then it would have been saving every second, however that was not the case

thanks again for your help guys

From: July 19, 2010, 06:58:33 pm
as a result, the following code works flawlessly

Code: (pascal) [Select]
procedure AppOnIdle(Ticks: integer);
begin
Timer:=Timer - 1;
if Timer = 0 then begin
Writeconsole(0,'Saving all accounts...',$0000FFFF);
//Command('/save');
for i:= 1 to 32 do if Getplayerstat(i,'Ping') > 0 then begin
iniWrite('Players/'+GetPlayerStat(i,'Name')+'.ini','stats','kills',inttostr(trKills[i]));
iniWrite('Players/'+GetPlayerStat(i,'Name')+'.ini','stats','tupred',inttostr(TUPred[i]));
iniWrite('Players/'+GetPlayerStat(i,'Name')+'.ini','stats','barkills',inttostr(barKills[i]));
inisave('Players/'+GetPlayerStat(i,'Name')+'.ini',iniLoad('Players/'+GetPlayerStat(i,'Name')+'.ini'));
end;
iniWrite('scripts/Shop/profit.ini','profit','cash',inttostr(Cash));
Sleep(2000);
Timer:=300;
Writeconsole(0,'Done!',$0000FFFF);
end;
end;

my debugging info was telling me that the files were being writen to fine, but were not saving correctly, thus, that brought my attention to the inisave line
« Last Edit: July 19, 2010, 06:58:33 pm by frosty »
check out my server! click here

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

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Frosty's scripting thread
« Reply #42 on: July 19, 2010, 07:33:06 pm »
good.
now frosty, do me one more little favor:
it seems to me that line 11 is useless as it stands.  the "iniWrite" already saves the file!  if you go to the iniWrite function, you will see that it contains a line "iniSave" which already saves what you update. so just delete the inisave file and you'll make your code less wasteful...
Can't think of anything original to put here...

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #43 on: July 19, 2010, 07:47:09 pm »
onto the next problem: grr DoDamageBy still isnt working, if i have 1 as the damage it doesnt hang, why is it still hanging the server? at the moment its not causing it to crash unless i hit more than one zombie with a barret shot (using shotgun shells), if its just 1 that it hits it still hangs for about 10 seconds then it goes back to normal, after all the targets were killed

this is so frustrating

(file attached)
« Last Edit: July 19, 2010, 08:16:54 pm by frosty »
check out my server! click here

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

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #44 on: July 20, 2010, 02:04:43 am »
Learn from your failures or die!

Link

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Frosty's scripting thread
« Reply #45 on: July 20, 2010, 03:41:52 am »
I'm not sure, but I really think that an admin should lock this.  There may not be an explicit rule about this, but you need to learn programming on your own.  ESPECIALLY when we tell you exactly what to do (ie: give links to tutorials!) and he still doesn't try to read them.
frosty, you're a little boy, and you don't understand things in this world.  You need to do research on your own.  You can't expect to write soldat scripts without having any previous (real) programming experience.  Read what we told you to learn (as posted previously), go through tutorials, and come back when you're done.  It should take you at least a month to grasps SOME basics.

can admin lock this now?  his questions are getting ridiculous...
« Last Edit: July 20, 2010, 03:44:45 am by zyxstand »
Can't think of anything original to put here...

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #46 on: July 20, 2010, 01:08:39 pm »
thanks guys, better not ill just make another topic so locking will be a waste of time
check out my server! click here

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

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #47 on: July 20, 2010, 01:09:30 pm »
If you don't want to help him, ignore him.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #48 on: July 20, 2010, 01:11:02 pm »
umm hold up, for startas, each time i posted, the code was different, so how is it i did not even try to read what you posted? links and such? :P

btw Dark, that code is giving me a syntax error, says line 26, but i dont see where the error is on any of those lines
« Last Edit: July 20, 2010, 01:25:06 pm by frosty »
check out my server! click here

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

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Frosty's scripting thread
« Reply #49 on: July 20, 2010, 01:36:59 pm »
umm hold up, for startas, each time i posted, the code was different, so how is it i did not even try to read what you posted? links and such? :P

btw Dark, that code is giving me a syntax error, says line 26, but i dont see where the error is on any of those lines

there are no syntax error in his code on line 26 (or 25). make sure you copy pasted it correctly... make sure you've changed your Includes file... make sure you learn programming first...
Can't think of anything original to put here...

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #50 on: July 20, 2010, 01:40:09 pm »
Start by stopping the use of global variables like i,Dist and ID. Those should be initialized in the procedures/functions themselves.

I cannot see any possible error source right now, too..

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Frosty's scripting thread
« Reply #51 on: July 20, 2010, 03:38:43 pm »
It doesn't matter if you have i as a global variable, the ones in the procedures will overwrite it, atleast that's what I think  :P
But having ID or similar words also used as params or sth. similar may cause problems I think.

Besides all of that I really have to agree with zyxstand, you are asking lots of basic questions, just take a look at when you just pasted the procedure names of the ini functions with a begin-end; into your script and thought it would work and then ask here >_>
That's just, sorry, but that's the reality, freakin' dumb.

What I just saw:
Code: [Select]
if Getplayerstat(i,'Ping') > 0 then beginIt makes me whine, use GetPlayerStat(i, 'Active') = true because it's the only safe way to check wether a player ID is used or not.

Do what I told you several times, look at simple, not-complex scripts and learn from them step-by-step. (For example get used to LowerCase(), GetPiece(), case .. of in use with OnPlayerCommand() or similar things)
The if Text = '/foobar' method is old, for example it only works with the lowercase cmd /foobar, but not /fOoBaR.
A simple use of LowerCase() would clear that up.
There are tons of other stuff I could tell you in use with OnPlayerCommad(), but they would just irritate you in the moment.

Now go and repeat the basics step-by-step (Like if Text = '!noob' then WriteConsole(ID, 'You are a noob!', $FF0000), ignore the stuff I told you before, add it afterwards when you managed to do the very basics.) or you won't learn proper scripting ever imo.

Hope you guys like lots of text, ;f

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #52 on: July 20, 2010, 07:10:52 pm »
odd, i copied and pasted the whole script and overwrote my code and is still saying syntax error on line 26, like wtf?

and u say change the Inludes file, change to what? its fine as it is

anyways heres the files (attached)

edit: ill fix up the code once we figure out why the hell im getting a syntax error, i have reassigned the i var in onplayerkill and removed i and killer from vars so its now saying syntax error on line 25

heres the full error if it helps
Code: [Select]
Achievement -> [Error] (25:166): Syntax error
edit2: and thanks so much for the help and patience guys, i appreciate it, but its errors like these where my compiler is being a douche and noone can see what the hell is wrong is where i really need help, ive had too many of these stupid errors
« Last Edit: July 20, 2010, 07:20:25 pm by frosty »
check out my server! click here

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

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Frosty's scripting thread
« Reply #53 on: July 20, 2010, 10:18:32 pm »
wtf is wrong with you?
i opened the attached file you sent and the error says its syntax error on line 28 (so line 27 in the .pas file).
it's the line that says:
Code: [Select]
if (RayCast(x,y,x2,y2,Dist,200)) AND (if i <> Killer) AND (GetPlayerStat(i,'Alive') = true) AND (GetPlayerStat(i,'Team') <> GetPlayerStat(Killer,'Team')) then beginand now i just wanna know why you didn't see the extra "if" word in there.  ppl wont' always give u perfect code, but u just have to be a bit less of an idiot to deal with that.
TAKE OUT THE "IF", DO IT AGAIN IN THE OTHER SECTION (same code essentially), AND FIX THE ACTIVATE SERVER INITIALIZATION -> FIGURE OUT THE LAST ONE ON YOUR OWN - IF YOU CAN'T DO IT DON'T BOTHER WITH SCRIPTING.

bye forever, frosty
Can't think of anything original to put here...

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #54 on: July 20, 2010, 10:19:53 pm »
No need for yelling.. he's just asking for help.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #55 on: July 20, 2010, 10:39:13 pm »
FFS u idiot!!

my host said error on line 26, not me u idiot, i even copied and pasted the error from the website which tells me if my server has crashed and lets me stop and start it, Where the f**k did u get line 28 from? or is your compiler "different" to mine? and why the f**k do u think i even bothered with using the {code] tags? read before u post ffs, can't you tell i copied and pasted the code? shows how good u are, not!!! so far all u have done is insult me without even TRYING to help, which proves to me and everyone else that you are naive and not even worth communicating with, so fine, i dont need your help anyways "xystand"

anyways, new problem

i have come accross a wierd bug, i made this script: (attached) which logs everything to a single log file, (Text, Commands, Team Joins and Exceptions)

only problem is, with the OnCommand Section there, instead of the command going through, it just logs the command and then does nothing, how do i get around this? (not released yet due to this bug so dont go searching)

edit2: server is still hanging when i use barret, wtf????????????????? FFS THIS f**kING STUPID SERVER, see attached achievement.pas
« Last Edit: July 20, 2010, 11:47:59 pm by frosty »
check out my server! click here

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

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Frosty's scripting thread
« Reply #56 on: July 21, 2010, 03:30:20 am »
Quote
edit2: server is still hanging when i use barret, wtf?? FFS THIS f**kING STUPID SERVER, see attached achievement.pas
It's not because of the "f**kING STUPID SERVER" but your horrible code. No surprise it hangs on it.

replace the barret part with
Code: [Select]
var x, y, x2, y2: single; team: byte;

// ...

  if Weapon = 'Barrett M82A1' then begin
    team := GetPlayerStat(Killer,'Team');
    GetPlayerXy(Victim, x, y);
    for i := 1 to 32 do
      if i <> Killer then
        if GetPlayerStat(i,'Alive') = true then
          if GetPlayerStat(i,'Team') <> team then begin
            GetPlayerXY(i, x2, y2);
            if RayCast(x,y,x2,y2,Dist,400) then begin
              DoDamageBy(i,Killer,200);
              BioKills[Killer]:=BioKills[Killer]+1;
            end;
          end;
    WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]),$EE81FAA1);
    BioKills[Killer]:=0;
  end;
« Last Edit: July 21, 2010, 03:31:57 am by tk »

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Frosty's scripting thread
« Reply #57 on: July 21, 2010, 01:16:33 pm »
Quote
edit2: server is still hanging when i use barret, wtf?? FFS THIS f**kING STUPID SERVER, see attached achievement.pas
It's not because of the "f**kING STUPID SERVER" but your horrible code. No surprise it hangs on it.

replace the barret part with
Code: [Select]
var x, y, x2, y2: single; team: byte;

// ...

  if Weapon = 'Barrett M82A1' then begin
    team := GetPlayerStat(Killer,'Team');
    GetPlayerXy(Victim, x, y);
    for i := 1 to 32 do
      if i <> Killer then
        if GetPlayerStat(i,'Alive') = true then
          if GetPlayerStat(i,'Team') <> team then begin
            GetPlayerXY(i, x2, y2);
            if RayCast(x,y,x2,y2,Dist,400) then begin
              DoDamageBy(i,Killer,200);
              BioKills[Killer]:=BioKills[Killer]+1;
            end;
          end;
    WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]),$EE81FAA1);
    BioKills[Killer]:=0;
  end;


still hanging, even with JUST this script compiled on its own it still crashes the server, but im not getting any exception messages
« Last Edit: July 21, 2010, 01:19:42 pm by frosty »
check out my server! click here

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

DarkCrusade

  • Guest
Re: Frosty's scripting thread
« Reply #58 on: July 21, 2010, 01:33:29 pm »
You didn't check whether 'i' is active.. when I told you already thrice that you need to!

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Frosty's scripting thread
« Reply #59 on: July 21, 2010, 10:27:53 pm »
frosty, you stubborn fuck, we told you countless times to put the "active" check before everything else in the loop and you still haven't done it? For fucks sake, if you want to get some help here - do what people suggest. If you don't, GTFO