![]() |
Score Board - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: Score Board (/showthread.php?tid=350) |
- Dark Echo - 05-10-2006 I browsed through quickly, and i found that you used a new function that you didnt provide the code for.. GetScore.. Also, you didnt declare a new player variable.. Score.. Look at the code for GetPlayerStr and look at your types module.. :wink: There might be a couple of other things.. In future, dont provide just code and tell us it doesnt work.. Explain the problems you are having and what errors are popping up.. It makes life easier for us.. :wink: Thanks dude.. - Leighland - 05-10-2006 Okay, think I've got it. This is basically what I thought you were trying to do, by having each player have a score, and then having a scoreboard to display it on. So here goes. :::::::::::::::::::::: :: SERVER SIDE :: :::::::::::::::::::::: In ModDatabase find "Sub LoadPlayer" and add this: Code: Player(Index).Char(Player(Index).CharNum).Score = GetVar(FileName, "CHAR" & i, "Score") then find "Sub SavePlayaer" and add this: Code: Call PutVar(FileName, "CHAR" & i, "Score") Now add the following subs to the bottom of your ModDatabase, delete any of the subs you have written previously: Code: Sub LoadScore() In modGameLogic, Add these three subs: Code: Sub ClearScore() in modServerTCP, add this: Code: Sub SendScoreList(ByVal Index As Long) in modTypes, add this: Code: Type ScoreRec Also in modTypes, find "Type PlayerRec", and add this line to it: Code: Score As String in modGlobals add this: Code: Public Score(1 To MAX_PLAYERS) As ScoreRec in modHandleData, add this: (you allready have it I'm assuming) Code: ' ::::::::::::::::: That's it for the server side. Now I'll explain it to you. Basically what I did was remove the MAX_SCORE command all together. Because of how I chose to set this code up, if MAX_PLAYERS and MAX_SCORE weren't the same it would probably cause all kinds of errors, or just give undesired results. So I took it out, and Used MAX_PLAYERS as my "to" variable. When LoadScores is called, it loads the saved scores from the ini file which is what we want it to do. When SaveScores is called, it makes a call to UpdateScores. This goes through every player in the game and reassigns the data to the .Name and .Score variables in the ScoreRec, then it saves them. This allows the scoreboard variables to be saved, and the players to each have their own personal scores recorded as well in their player file. Now, the other things added up to this point do the sending and recieveing of the scoreboard from the server to the client. So moving on... ::::::::::::::::::::: :: CLIENT SIDE :: ::::::::::::::::::::: in modTypes add this: Code: Public Type ScoreRec in modGlobals add this: Code: Public Score(1 To MAX_PLAYERS) As ScoreRec in modHandleData, add this: (you allready have it, so just rewrite) Code: ' :::::::::::::::::::::: That's it. What this will do, or should do, is read the scoreboard list from the server and add it to the ScoreRec variables. Then it will display them on lstScore in the following fashion: Quote:1. Harry (363) I didn't test this is any way so please tell me if it does what you had hoped. If not I'm willing to modify it, just tell me what you need ![]() note: you'll most likely get a couple of duplicate declaration errors, just delete the highlighted lines if this occurs. - William - 06-10-2006 Fix Replace Code: Sub SendScoreList(ByVal Index As Long) Code: Sub SendScoreList() Replace Code: Call PutVar(FileName, "CHAR" & i, "Score") Call PutVar(FileName, "CHAR" & i, "Score", INSERTTHESCORETYPE) Also you need to make it so it sends packet to the server that tells the server to send a packet to the client so the list updates itself. ANd also, shouldn't score be a long and not a string? There are more things that needs to be fixed. |