Author Topic: How to random?  (Read 769 times)

0 Members and 1 Guest are viewing this topic.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
How to random?
« on: June 12, 2013, 06:16:17 am »
How to random?
Personally I do so:
But crashes unknown error.

Code: [Select]
var:
addscore: array [1..32] of string;
add: byte;

...

procedure WriteAndSet(ID: byte; typ: integer);
begin
if typ = 2 then begin
case add of
1: addscore := 1;
2: addscore := 2;
end;
SetScore(ID,GetPlayerStat(ID,'Kills')+addscore);
WriteConsole(0,'***  '+idtoname(ID)+' + '+addscore+'***',color);
end;

...

Offline JotEmI

  • Soldier
  • **
  • Posts: 188
Re: How to random?
« Reply #1 on: June 12, 2013, 07:10:14 am »
I don't know what your code has to do with randomness but you've got several errors:
1. addscore is declared as an array yet you assign to it without specifying an index
Code: [Select]
case add of
1: addscore := 1;
2: addscore := 2;
end;

2. addscore is of type string and you try to add it to player kills
Code: [Select]
   SetScore(ID,GetPlayerStat(ID,'Kills')+addscore);

You need to change couple of things:
Code: [Select]
var:
addscore: byte;
add: byte;

...

procedure WriteAndSet(ID: byte; typ: integer);
begin
if typ = 2 then begin
case add of
1: addscore := 1;
2: addscore := 2;
end;
SetScore(ID,GetPlayerStat(ID,'Kills')+addscore);
WriteConsole(0,'***  '+idtoname(ID)+' + '+IntToStr(addscore)+'***',color);
end;

...
« Last Edit: June 13, 2013, 03:27:11 am by JotEmI »

DarkCrusade

  • Guest
Re: How to random?
« Reply #2 on: June 12, 2013, 07:59:55 am »
Questions like this one perfectly show dominikk26's expertise in scripting, and how all of his scripts are but mere rip-offs. This may be an offtopic post, but I cannot stand this bullocks no more and I want to voice my opinion publicly, so #yolo.

dominikk26, we have had this discussion before. Please read some guides on Pascal or any other coding language like Java or C#. You have not even grasped the basic concepts of scripting after 2 years of tryhard'ing, and another 2 years are to come for you to understand that as it seems to me. Please do not feel (too) offended. I am just losing my patience.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: How to random?
« Reply #3 on: June 12, 2013, 09:40:23 am »
Questions like this one perfectly show dominikk26's expertise in scripting, and how all of his scripts are but mere rip-offs. This may be an offtopic post, but I cannot stand this bullocks no more and I want to voice my opinion publicly, so #yolo.

dominikk26, we have had this discussion before. Please read some guides on Pascal or any other coding language like Java or C#. You have not even grasped the basic concepts of scripting after 2 years of tryhard'ing, and another 2 years are to come for you to understand that as it seems to me. Please do not feel (too) offended. I am just losing my patience.

Honestly I did not think problem is the type of variables but merely I forgot that the text does not administered directly by the variable, because the last time I wrote by using a lot of variables but not in the text. So if you have a problem it shut up if you do not intend to help. JotEmI thank you so much for explaining the error.

DarkCrusade

  • Guest
Re: How to random?
« Reply #4 on: June 12, 2013, 09:48:24 am »
And here we go again. Anyone with only the most basic of experience with coding knows how to find a bug like that. If I was ever to ask on this forum for help on this kind of bug, I would shit my pants from embarassment. You should have already noticed the bug's source the moment you pasted the code to your post. Don't pretend you know what you are doing, because you clearly do not.
« Last Edit: June 12, 2013, 11:48:35 am by DarkCrusade »