Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Little Help with News
#1
Ok, I ended up making a code that does not seem to want to work for me, the Issue is that I can not get it to load on to the frmMainMenu.News.text and it will not save client side. Here is the code please tell me if you see anything missing.
Serverside
modHandleData
Code:
' :::::::::::::::::::::
' :: Set NEWS packet ::
' :::::::::::::::::::::
If LCase(Parse(0)) = "setNews" Then
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_MAPPER Then
Call HackingAttempt(Index, "Admin Cloning")
Exit Sub
End If

Call PutVar(App.Path & "\data\News.ini", "NEWS", "Msg", Parse(1))
Call GlobalMsg("News changed to: " & Parse(1), Yellow)
Call AddLog(GetPlayerName(Index) & " changed NEWS to: " & Parse(1), ADMIN_LOG)
Exit Sub
End If
modservertcp
Code:
Sub SendNewsTo(ByVal index As Long)
Dim Packet As String

Packet = "NEWS" & SEP_CHAR & ReadINI("DATA", "ServerNews", App.Path & "\Data\News.ini") & SEP_CHAR & END_CHAR

Call SendDataTo(index, Packet)
End Sub
clientside
modclienttcp
Code:
Sub SendNEWSChange(ByVal NEWS As String)
Dim packet As String

packet = "SETNEWS" & SEP_CHAR & NEWS & SEP_CHAR & END_CHAR
Call SendData(packet)
End Sub
modhandledata
Code:
' :::::::::::::::::::::::::::::::::
' :: News Recieved packet ::
' :::::::::::::::::::::::::::::::::
If LCase(Parse(0)) = "news" Then
Call WriteINI("DATA", "News", Parse(1), (App.Path & "\Data\News.ini"))
Exit Sub
End If
modGameLogic
Code:
Public sub InitNews
Dim I as long  
Dim News As String
Dim News2 As String
   News= ""
        News2 = ReadINI("DATA", "Desc", App.Path & "\Data\News.ini")
        For I = 1 To Len(News)
           If Mid$(News, I, 1) = "*" Then
                News2 = News2
           Else
                News2 = News2 & Mid$(News, I, 1)
           End If
        Next

        frmMainMenu.News.Text =  News2
End Sub
Reply
#2
I only looked briefly, but why are you saving / loading to an .ini client side. Just store it to a variable.

Change
Code:
If LCase(Parse(0)) = "setNews"
To
Code:
If LCase(Parse(0)) = "setnews"
Reply
#3
I'm not around my VBsoftware right now but, would changing the cap size of letters in a packet actually make that much of a diffrence?
Reply
#4
Well, if Parse(0) = SETNEWS than it's LCase (lower case) isn't going to be setNews
Reply
#5
I told you Shadow, the last thing I wrote was that BlackJack code I did for your request.
So do you think that could solve my issue?
Reply
#6
Ok that makes sense, might explain why most of my other codes have slight bugs in them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)