Mirage Source http://www.miragesource.net/forums/ |
|
MS4 Simple Question. http://www.miragesource.net/forums/viewtopic.php?f=184&t=5510 |
Page 1 of 50 |
Author: | deathknight [ Fri Apr 17, 2009 6:03 am ] |
Post subject: | MS4 Simple Question. |
Ok, I'm creating a player rep system that allows for players to give rep to other players. I've based this on the /setaccess command. Here is what I have for the handlesetrep Code: ' :::::::::::::::::::::::::: ' :: Set access packet :: ' :::::::::::::::::::::::::: Private Sub HandleSetRep(ByVal Index As Long, ByRef Parse() As String) Dim n As Long Dim i As Long n = FindPlayer(Parse(1)) i = CLng(Parse(2)) End If Call SetPlayerRep(n, i) Call SendPlayerData(n) Call AddLog(GetPlayerName(Index) & " has modified " & GetPlayerName(n) & "'s reputation.", ADMIN_LOG) Else Call PlayerMsg(Index, "Player is not online.", White) End If End Sub My problem is with this part here Code: Call SetPlayerRep(n, i) it sets the player rep to i, i need it to add to the player rep, so it needs to look something like this Code: CallSetPlayerRep(n, (code for players rep) + i) If it were setting the players own rep, it wouldn't be a problem, but I don't know how to code it to affect someone else's rep. The rep is located in the stat enum. Any help? |
Author: | jsventor [ Fri Apr 17, 2009 11:13 pm ] |
Post subject: | Re: MS4 Simple Question. |
It would probably have to have the players name in the command to, so it knows what player to set the rep. /setrep jsventor 2. The server has a Function called FindPlayer(Name) i think. |
Author: | Tony [ Fri Apr 17, 2009 11:25 pm ] |
Post subject: | Re: MS4 Simple Question. |
n = find player's index player(n) - n is that player's index. So you don't have to do anything because in receiving the packet we already looked for the player's index that we asked for (n = findplayer(parse). Also in the SetPlayerFunction, it's obviously setting the players rep in that function correct? Then when it sets it inside that function, player(n).rep = player(n).rep + i That's the current reputation plus the given reputation. Get it? |
Author: | deathknight [ Sat Apr 18, 2009 12:19 am ] |
Post subject: | Re: MS4 Simple Question. |
Ok, as I said, I have everything set up just like set access command. The SetPlayerRep is below. Code: Public Sub SetPlayerRep(ByVal Index As Long, ByVal Rep As Long) Player(Index).Char(TempPlayer(Index).CharNum).Skills(Skills.Rep) = Rep End Sub So I think I got it working correctly. Here is my Set Rep Packet. It works how I want it to, but my question, is this the best way to do it, or is there a different way? Code: ' ::::::::::::::::::::
' :: Set Rep Packet :: ' :::::::::::::::::::: Private Sub HandleSetRep(ByVal Index As Long, ByRef Parse() As String) Dim n As Long Dim i As Long Dim r As Long n = FindPlayer(Parse(1)) ' The access i = CLng(Parse(2)) r = Player(n).Char(TempPlayer(n).CharNum).Skills(Skills.Rep) Call SetPlayerRep(n, (r + i)) Call SendPlayerData(n) Call AddLog(GetPlayerName(Index) & " has modified " & GetPlayerName(n) & "'s reputation.", ADMIN_LOG) Else Call PlayerMsg(Index, "Player is not online.", White) End If End Sub |
Author: | Tony [ Sat Apr 18, 2009 1:54 am ] |
Post subject: | Re: MS4 Simple Question. |
I plan on doing a reputation system in my game Naruto Realm too. What I plan to do is limit giving reputation points per month and gains by kill, only if the user killed has higher reputation than the killer and in which the killed loses a rep. |
Author: | deathknight [ Sat Apr 18, 2009 2:40 am ] |
Post subject: | Re: MS4 Simple Question. |
I'm planning on doing 2 rep systems. 1 the standard faction rep (kind of like mmorpg's where you have rep with factions) and a player rep whereyou get 3 points a day to give to whomever you feel deserve it. The next step in building my system is going to be limiting it to giving 3 points, and checks to see if you have enough rep to give to them. Then I plan on adding a check so it records the date that you were given less, and if the current date is higher than that, give the rep points and set the date to that days date. It's all going to be based on the server date, so I don't know how I'm going to do that (I don't know any code for calling the date from the server computer) |
Author: | Tony [ Sat Apr 18, 2009 2:12 pm ] |
Post subject: | Re: MS4 Simple Question. |
deathknight wrote: I'm planning on doing 2 rep systems. 1 the standard faction rep (kind of like mmorpg's where you have rep with factions) and a player rep whereyou get 3 points a day to give to whomever you feel deserve it. The next step in building my system is going to be limiting it to giving 3 points, and checks to see if you have enough rep to give to them. Then I plan on adding a check so it records the date that you were given less, and if the current date is higher than that, give the rep points and set the date to that days date. It's all going to be based on the server date, so I don't know how I'm going to do that (I don't know any code for calling the date from the server computer) Sounds great! Hope it all goes well for both of us. |
Author: | wanai [ Thu Jan 13, 2022 6:05 pm ] |
Post subject: | Re: MS4 Simple Question. |
Econ |
Author: | wanai [ Thu Jan 13, 2022 6:07 pm ] |
Post subject: | Re: MS4 Simple Question. |
134.1 |
Author: | wanai [ Thu Jan 13, 2022 6:08 pm ] |
Post subject: | Re: MS4 Simple Question. |
Bett |
Author: | wanai [ Thu Jan 13, 2022 6:09 pm ] |
Post subject: | Re: MS4 Simple Question. |
Bett |
Author: | wanai [ Thu Jan 13, 2022 6:10 pm ] |
Post subject: | Re: MS4 Simple Question. |
Kobo |
Author: | wanai [ Thu Jan 13, 2022 6:11 pm ] |
Post subject: | Re: MS4 Simple Question. |
Abba |
Author: | wanai [ Thu Jan 13, 2022 6:12 pm ] |
Post subject: | Re: MS4 Simple Question. |
Wird |
Author: | wanai [ Thu Jan 13, 2022 6:13 pm ] |
Post subject: | Re: MS4 Simple Question. |
Piet |
Author: | wanai [ Thu Jan 13, 2022 6:14 pm ] |
Post subject: | Re: MS4 Simple Question. |
Loui |
Author: | wanai [ Thu Jan 13, 2022 6:16 pm ] |
Post subject: | Re: MS4 Simple Question. |
Spla |
Author: | wanai [ Thu Jan 13, 2022 6:17 pm ] |
Post subject: | Re: MS4 Simple Question. |
Cent |
Author: | wanai [ Thu Jan 13, 2022 6:18 pm ] |
Post subject: | Re: MS4 Simple Question. |
Deko |
Author: | wanai [ Thu Jan 13, 2022 6:19 pm ] |
Post subject: | Re: MS4 Simple Question. |
Bist |
Author: | wanai [ Thu Jan 13, 2022 6:20 pm ] |
Post subject: | Re: MS4 Simple Question. |
Norm |
Author: | wanai [ Thu Jan 13, 2022 6:21 pm ] |
Post subject: | Re: MS4 Simple Question. |
Abra |
Author: | wanai [ Thu Jan 13, 2022 6:22 pm ] |
Post subject: | Re: MS4 Simple Question. |
Ridl |
Author: | wanai [ Thu Jan 13, 2022 6:23 pm ] |
Post subject: | Re: MS4 Simple Question. |
Vali |
Page 1 of 50 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |