Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 10:24 am

All times are UTC




Post new topic Reply to topic  [ 273 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject: My Code Not Working...
PostPosted: Thu Dec 06, 2007 7:26 am 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
The code I made tonight isn't working. When I try to compile the Server.exe with the code I made, it gives me errors. I tried fixing them but I just don't understand how to. I would really appreciate if some one could help me fix this code up...I put the code in the ModServerTCP if you needed to know that.

Code:
Function DeletePlayer(ByVal PlayerAccess As Long, index As Long, DeleteCharacter As Long, SaveCharacter As Long, SaveAccount As Long, AlertMsg As String, Player As Long)
    If "/delete(PlayerName)" Then
    If PlayerAccess <= 4 Then
        Call DeleteCharacter(index)
        Call SaveCharacter(index)
        Call SaveAccount(index)
        Call AlertMsg(Player, "You have been deleted.")
    End If
End Function


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 8:55 am 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
First off, add that code into your client. Preferably in the Sub HandleKeypresses(ByVal KeyAscii As Integer).

Ok now change:
Code:
If "/delete(PlayerName)" Then
    If PlayerAccess <= 4 Then
        Call DeleteCharacter(index)
        Call SaveCharacter(index)
        Call SaveAccount(index)
        Call AlertMsg(Player, "You have been deleted.")
    End If
End If

To
Code:
If LCase(Mid(MyText, 1, 7)) = "/delete" Then
    If Len(MyText) > 7 Then
        MyText = Mid(MyText, 9, Len(MyText) - 7)
        Call SendDeleteChar(MyText)
        Call SendSaveChar(MyText)
        Call SendSaveAcc(MyText)
    End If

    MyText = ""
    Exit Sub
End If

Then of course the Call Send stuff is what you need to code in. They will obviously send a packet to the server with the players name and then have the server delete the player. I just came out with that code on the top my head, so let me know whats up.


Last edited by Beres on Thu Dec 06, 2007 9:00 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 8:59 am 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
Well... that's alot of extra work.

None of the chat is sent through handle keypresses, so I'm not sure why he'd do that either.
and Mirage doesn't have SaveAcc.

He just needs to add it into the chat commands, and when the packet is received server side, call sub DelChar.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 9:02 am 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
Yeah i know saveacc isnt there, i just made it up to give him an idea. And I just wrote that because in that sub I showed has all the chat commands (in MSE 1). So I thought I would add it there.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 9:05 am 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
Just Call Menu_State_Delchar.

There's already a packet in place and everything.
Just change the server side part to stop checking if they aren't playing.


I thought you wrote Keydown, that's why I was confused, sice that's only used for attack/running.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 9:12 am 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
Quote:
Just Call Menu_State_Delchar.

I totally forgot about that lol >.> But yeah. Anyway from what I seen what he wrote, you dont even need a function for that. AND thats not even how you use a function lol. But I think he got our point. Do what Rezeyu said and delete the char with that menu state. :)


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 1:10 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
But if you do it with the menustate, dont you only delete your character?

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 1:37 pm 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
Well since he was going by playername, isn't that what he wanted?

:|


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 7:49 pm 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
I want the code to delete whatever player the Admin wants to delete, then pop up a message to the player that was deleted saying "You have been deleted.".

Example:

I want to delete a player name Zain.
/delete Zain
The server deletes the player named Zain.
The player that was deleted receives a pop up message saying "You have been deleted.".

Also, I added the code you gave me Beres and it keeps saying "Sub or Function Not Defined" on the "Call SendDeleteChar" part of the code. I tried to define it but it didn't work.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 9:02 pm 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
Dude thats not the right call function, I was giving you an example of how to do the /delete code. lol


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 9:04 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
His code was incomplete, you can implement that function if you wish.

However, can I comment that I wouldn't add this feature. If there is something in the game that would cause a player to be deleted, have the computer and only the computer do it. When you get into letting people control who suffers, there becomes this "power" issue.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 9:05 pm 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
True.. And also, if you want to delete him, just kick him and then delete his name from the server. But, if you want the command, I could whip it up for you.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 9:27 pm 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
If you don't mind Beres please do. I could probably learn something from the code you make. Also, I will be the only one with the power to delete. And I am only putting this in the game so then I don't have to go through the hassle of deleting his character from the files.

Also I made another code based on the one you showed me. Would this work? Sorry for the hassle of this.

Code:
' Jail command
If LCase(Mid(MyText, 1, 7)) = "/jail" Then
    If Len(MyText) > 7 Then
    MyText = Mid(MyText, 9, Len(MyText) - 7)
    Call SetPlayerMap(Index, 100)
    Call SetPlayerX(Index, 10)
    Call SetPlayerY(Index, 12)
    Call Msg(Index, "You have been put into Jail.", 1)
    Call GlobalMsg(Index, "(PlayerName) has been sent to jail.")
  End If
 
  MyText = ""
  Exit Sub
End If


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 10:15 pm 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
lol..
Code:
If LCase(Mid(MyText, 1, 7)) = "/jail" Then

Count the amount of characters of /jail. Its 5.. So change it to
Code:
If LCase(Mid(MyText, 1, 5)) = "/jail" Then

Anyway, I will write you the code for this in a few, when I get back..


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 10:16 pm 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
Oops, lol. And thank you very much.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 10:44 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
This code is client side, so you can't really do anything to other players. You need to send a packet to the server, and have the server determine if A) You can move them to jail, and B) They can be moved to jail then do it if appropriate.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 10:47 pm 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
So then would this work? If not, mind explaining why?

Code:
' Jail command
If LCase(Mid(MyText, 1, 7)) = "/jail" Then
    If Len(MyText) > 7 Then
    MyText = Mid(MyText, 9, Len(MyText) - 7)
    Call SendPlayerMap(Index, 100)
    Call SendPlayerX(Index, 10)
    Call SendPlayerY(Index, 12)
    Call Msg(Index, "You have been put into Jail.", 1)
    Call GlobalMsg(Index, "(PlayerName) has been sent to jail.")
  End If
 
  MyText = ""
  Exit Sub
End If


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 10:53 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
No, it wouldn't work.

SetPlayerX and SetPlayerY are client side functions, and they do exist so it was good that you thought those would do what you want them to do.

However, those are used client side, when other players move. If you were to call that, the player would move ONLY to you, and they themselves wouldnt move, nor would they move for anyone else.

To get things to happen to players, you need to send the command to the server. You can see this happening in what's called a Packet. Mirage uses string packets, and you can probably determine how to write and send a packet if you just search the word "Packet"

Similarily, server side, you need to receive the packet, this is done in modHandleData, in sub HandleData. You should be able to figure this out, too, if you think about it.

So your jail command should construct a packet containing the necessary information (in this case, it would need a name and the index number of the player you want to jail) and send it.

The server would then receive the packet, check that you have the authority to jail someone, check that the person you're jailing is indeed online, and then it would move the player to the jail, and if you want it would say a global message, or a private message to the jailed player saying they were jailed.

get it?

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 11:10 pm 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
That makes sense thanks. I'll look "Packet" up.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 11:29 pm 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
Sorry for the double post...But I tried making a packet and I think I have it all screwed up. lol And thank you all for your help.

Code:
'     :::::::::::::::::
'     :: Jail Packet ::
'     :::::::::::::::::
    If (LCase(Parse(0)) = "/jail") Then
        Player = Val(Parse(1))
    If GetPlayerAccess <= 4 Then
        Player = Map(Index, 100)
        Player = MapX(Index, 10)
        Player = MapY(Index, 10)
    End If
End Sub


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 11:42 pm 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
Good lord lol!! Its ok though, because you still learning. Now I got to run to school in a few, but I would change the operator you got there..
Code:
If GetPlayerAccess <= 4 Then

First off, that means anyone with an access of 4 and below can use it. So if I was access 0, I could jail someone. Make it >=. Well, I will help you with more in a few, do you have msn or yahoo?


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 11:52 pm 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
Yes, my MSN is zainisdemonic666@hotmail.com . And I'll change that right now. lol


Top
 Profile  
 
PostPosted: Fri Dec 07, 2007 3:13 am 
Offline
Knowledgeable

Joined: Sun Jul 29, 2007 12:23 am
Posts: 199
i at school right now.. i add u when i get home


Top
 Profile  
 
PostPosted: Fri Dec 07, 2007 4:03 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Use the playerwarp function server side.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Fri Dec 07, 2007 7:17 am 
Offline
Regular
User avatar

Joined: Sat Oct 27, 2007 3:42 am
Posts: 26
Location: in a distant memory...
Google Talk: a.azure.night13@gmail.com
Beres I don't actually need you to make the code now. Rezeyu helped me allot and now I have the /save and /delete codes working. I have a basic understanding of Packets now as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 273 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 53 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group