
Originally Posted by
m34tcode
The tutorial doesn't quite show it.
Which tutorial, and what do you want to do? My scripts are never really multiplayer (don't really need multiplayer...), but I do still have some grasp of how to do it.
I truthfully just copy a basic one I made that I know works.
Simba Code:
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Pin := ''; // Bank Pin - leave alone if you don't have one.
Member := False;
Active := True;
end;
end;
Now, you can store much more data within each "player".
Let's take a look at the TUser;
Simba Code:
TUser = record
Name: string; // * User Name
Pass: string; // * User Pass
Pin: string; // * Current Users Pin Number
Member: boolean; // * For Login
WorldInfo: TVariantArray; // * [Members {Boolean}, World {Integer}, PVP {Boolean}]
Nick: string; // * Screen Name for random detection
{NickTPA: TPointArray; // * TPA Of Player Name}
Level: array[0..24] of Integer; // * Levels of all skills.
Active: Boolean; // * Set to True if Ok, False if Lost.
Loc: string; // * User Location
Status: string; // * User Status
Skill: string; // * User Action to Perform
Worked: Integer; // * Time User has worked
Banked: Integer; // * Number of Banks User has done
Rand: string; // * Current Random
Booleans: array of Boolean; // * For reports, etc.
Integers: array of Integer; // * For reports, etc.
Strings: array of string; // * For reports, etc.
Extendeds: array of Extended; // * For reports, etc.
Arrays: array of TVariantArray; // * For custom arrays.
BoxRewards: TStringArray; // * Partial texts for rewards, place in desired order.
end;
They are fairly well commented, so what to do with them is up to you. They are all optional, technically - but a few basic ones are needed [just about] every time:
Name
Pass
Nick
Active
Member
[and usually] Pin
------
"But niggleous, how do I add these to the player?"
Well, Let's say I want to set some extra crap
Simba Code:
procedure DeclarePlayers;
begin
HowManyPlayers := 2;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
with Players[0] do
begin
Name := 'z00zima';
Pass := 'waffles';
Nick := '0zi';
Pin := '1243'; // Bank Pin - leave alone if you don't have one.
Member := False;
Active := True;
Integers[0] := 2000; //bows to fletch
integers[1] := 376; //this is also important, i guess....
booleans[0] := true; //Make the player dance on level up?
loc := 'VWB' //where are we currently?
end;
with Players[1] do
begin
Name := 'idontknowfamouspeople';
Pass := ''fapfapfap;
Nick := 'oxinsox';
Pin := '5831'; // Bank Pin - leave alone if you don't have one.
Member := True;
Active := True;
Integers[0] := 20056; //bows to fletch
integers[1] := 265; //this is also important, i guess....
booleans[0] := true; //Make the player dance on level up?
loc := 'VEB' //where are we currently?
end;
end;
Additionally, ALL the data values in TUser are there. They just aren't in that list - if that makes sense. Let me explain. Let's say we're using the Players array above.
So, since we're using several players, we can't just make a global variable to hold the number of bows made. How do we record the number of bows we've already made, but only for that player?
Well, like this.
Simba Code:
Procedure Cutbows;
begin
//blahblahblah
if mouse(x,y,5,5,true) then //if we cut a bow
inc(players[currentplayer].integers[3]) //notice it's the 3rd integer value, not set above
end;
I hope that clears things up a bit. If not, explain your problemm better?