semlemsushi Posted September 7, 2010 Author Share Posted September 7, 2010 Ok im trying to add a button to the options panel for every character and is there a way so that a specified job can only click or view the button? Id prefer view but click is better.Example: If the characters job is gundealer, and they click the gundealer button, then they are warped to a map? Heres this code I took from the admin panel, where they enter the map ID and then they click the button and theyre warped to the ID they entered if its valid:```If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then AddText "You need to be a high enough staff member to do this!", AlertColor Exit Sub End If```Where it says "ADMIN_MAPPER", I was thinking if theres a way to make something that says "JOB_GUNDLR" and just replace the code but how do I add that custom thing?BTW IM USING ORIGINS! Link to comment Share on other sites More sharing options...
Yxxe Posted September 7, 2010 Share Posted September 7, 2010 You may be better off using a Gundealer Class:```If GetPlayerClass(Index) = # Then 'replace # with the number of the class btnGundealer.visible = trueEnd If```Or you could add an extra variable at the bottom of _PlayerRec_ found in _modTypes_ (do this server and client side)You could then set the players job like this:```Player(Index).Job = JOB_GUNDEALER```Which would also require you to go to modConstants (in the server and client) and add some Job constants, for example:```'Job ConstantsPublic Const JOB_GUNDEALER As Byte = 1Public Const JOB_FARMER As Byte = 2Public Const JOB_PROTECTOR As Byte = 3```You could then determine the players job like this:```If Player(Index).Job = JOB_GUNDEALER Then btnGunDealer.Visible = TrueEnd If```Regards,Lightning Link to comment Share on other sites More sharing options...
semlemsushi Posted September 7, 2010 Author Share Posted September 7, 2010 Okay so I'm in modTypes and I found the 2nd PlayerRec, heres what the code lookes like:```Private Type PlayerRec ' General Name As String Class As Byte Sprite As Integer Level As Byte EXP As Long Access As Byte PK As Byte ' Vitals Vital(1 To Vitals.Vital_Count - 1) As Long ' Stats Stat(1 To Stats.stat_count - 1) As Byte POINTS As Byte ' Worn equipment Equipment(1 To Equipment.Equipment_Count - 1) As Byte ' Position Map As Integer X As Byte Y As Byte Dir As Byte ' Client use only MaxHP As Long MaxMP As Long MaxSP As Long XOffset As Integer YOffset As Integer Moving As Byte Attacking As Byte AttackTimer As Long MapGetTimer As Long Step As ByteEnd Type```You said add an extra variable at the bottom? Im not really sure what that means because Im a noob lol. Link to comment Share on other sites More sharing options...
Yxxe Posted September 7, 2010 Share Posted September 7, 2010 Change your old code:```Private Type PlayerRec ' General Name As String Class As Byte Sprite As Integer Level As Byte EXP As Long Access As Byte PK As Byte ' Vitals Vital(1 To Vitals.Vital_Count - 1) As Long ' Stats Stat(1 To Stats.stat_count - 1) As Byte POINTS As Byte ' Worn equipment Equipment(1 To Equipment.Equipment_Count - 1) As Byte ' Position Map As Integer X As Byte Y As Byte Dir As Byte ' Client use only MaxHP As Long MaxMP As Long MaxSP As Long XOffset As Integer YOffset As Integer Moving As Byte Attacking As Byte AttackTimer As Long MapGetTimer As Long Step As ByteEnd Type```To this:```Private Type PlayerRec ' General Name As String Class As Byte Sprite As Integer Level As Byte EXP As Long Access As Byte PK As Byte ' Vitals Vital(1 To Vitals.Vital_Count - 1) As Long ' Stats Stat(1 To Stats.stat_count - 1) As Byte POINTS As Byte ' Worn equipment Equipment(1 To Equipment.Equipment_Count - 1) As Byte ' Position Map As Integer X As Byte Y As Byte Dir As Byte ' Client use only MaxHP As Long MaxMP As Long MaxSP As Long XOffset As Integer YOffset As Integer Moving As Byte Attacking As Byte AttackTimer As Long MapGetTimer As Long Step As Byte Job As ByteEnd Type```You see the "Job As Byte" at the bottom? That is the new variable. The only thing is you might have to delete all your old players for this to take effect. Try it without deleting first - if that doesn't work then delete them and try again. Remember to add this server and client side. Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 Okay I changed the code and added the variable at the bottom, now I opened it in modTypes in the serverside, and Im not sure where to put it. Here are the playerrecs I found:```Private Type PlayerRec ' Account Login As String * NAME_LENGTH Password As String * NAME_LENGTH ' General Name As String * NAME_LENGTH Sex As Byte Class As Byte Sprite As Integer Level As Byte exp As Long Access As Byte PK As Byte ' Vitals Vital(1 To Vitals.Vital_Count - 1) As Long ' Stats Stat(1 To Stats.Stat_Count - 1) As Byte POINTS As Byte ' Worn equipment Equipment(1 To Equipment.Equipment_Count - 1) As Byte ' Inventory Inv(1 To MAX_INV) As PlayerInvRec Spell(1 To MAX_PLAYER_SPELLS) As Byte ' Position Map As Integer x As Byte y As Byte Dir As ByteEnd Type```and…```Public Type TempPlayerRec ' Non saved local vars Buffer As clsBuffer InGame As Boolean AttackTimer As Long DataTimer As Long DataBytes As Long DataPackets As Long PartyPlayer As Long InParty As Byte TargetType As Byte Target As Byte PartyStarter As Byte GettingMap As Byte SpellBuffer As Long SpellBufferTimer As Long SpellCD(1 To MAX_PLAYER_SPELLS) As Long InShop As Long StunTimer As Long StunDuration As Long InBank As Boolean ' trade TradeRequest As Long InTrade As Long TradeOffer(1 To MAX_INV) As PlayerInvRec AcceptTrade As BooleanEnd Type```Where do I put it now? After I put it in serverside, am I ready to get a code for the button yet? Or do I have to do any other things? Link to comment Share on other sites More sharing options...
Ertzel Posted September 8, 2010 Share Posted September 8, 2010 Put it right belowDir As ByteinPrivate Type PlayerRec Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 okay let me do that right now, because the first method i tried it was unrecognized and i coudnt compile Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 Ugh guys I am so close! I do everything correctly but I'm pretty sure I have to change the "(Index)" to "1 or 70" because that's what It said when I hovered my mouse over it. Here is the code in which I have to change the "(Index)":> If Player(Index).Job = JOB_GUNDEALER Then> btnGunDealer.Visible = True> End IfSo what should I change it to? I tried compiling and the error I got was "Variable not defined."So all I have to do is get this fixed and Ill be set for a while. Thanks for all your help guys! Link to comment Share on other sites More sharing options...
westin444 Posted September 8, 2010 Share Posted September 8, 2010 make sure your player rec has job as a variable, and JOB_GUNDEALER is defined in constants Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 it should because i put> 'Job Constants> Public Const JOB_GUNDEALER As Byte = 1in modConstants (server and client)and i also put> Job As Byteat the bottom of Private Type PlayerRec (in the client files) and also at the bottom of Private Type PlayerRec (the server files one), so why isn't it working? Link to comment Share on other sites More sharing options...
westin444 Posted September 8, 2010 Share Posted September 8, 2010 *hits oneself on head*Its in client right?Change Index to MyIndex Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 hmm the compile worked lol, but i set the job gundealer as a byte to 1 and my job id is 1 but i cant still see the button =P Link to comment Share on other sites More sharing options...
westin444 Posted September 8, 2010 Share Posted September 8, 2010 add this to frmMainGamesub Form_Load```If Player(Index).Job = JOB_GUNDEALER Then btnGunDealer.Visible = TrueelsebtnGunDealer.Visible = FalseEnd if``` Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 nope, the button was also set to visible.false but i just added the code to frmMainGame, and i changed the button status to Visible.true so idk :huh:you wanna come over on teamviewer and check it out because i gtg soon Link to comment Share on other sites More sharing options...
westin444 Posted September 8, 2010 Share Posted September 8, 2010 sure… PM Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 ok i left the source open, i gotta wake up at 4am tomorrow so just handle the source, if u need u can download a whole new copy of origins. Link to comment Share on other sites More sharing options...
westin444 Posted September 8, 2010 Share Posted September 8, 2010 yeah I think there's something wrong with your source… Link to comment Share on other sites More sharing options...
Yxxe Posted September 8, 2010 Share Posted September 8, 2010 @semlemsushi:> nope, the button was also set to visible.false but I just added the code to frmMainGame, and I changed the button status to Visible.true so idk :huh:> > you wanna come over on teamviewer and check it out because I gtg soonIf you added the bit of code 314piwm added above then it won't show unless you are a Gundealer, in which case comment it out and see whether the label is visible then. If not, I would download a vanilla copy of the source. Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 okay ill try everything you said lightning, and if it doesnt work then do you think you could personally help me? Link to comment Share on other sites More sharing options...
Yxxe Posted September 8, 2010 Share Posted September 8, 2010 @semlemsushi:> okay ill try everything you said lightning, and if it doesnt work then do you think you could personally help me?Sure, I'll have to find some time though as I'll be very busy from tomorrow onwards. Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 No problem, should I put```If Player(Index).Job = JOB_GUNDEALER Then btnGunDealer.Visible = TrueEnd If```As the button_click, button_load, where should the code go? Link to comment Share on other sites More sharing options...
Yxxe Posted September 8, 2010 Share Posted September 8, 2010 @semlemsushi:> No problem, should I put> > ```> If Player(Index).Job = JOB_GUNDEALER Then> btnGunDealer.Visible = True> End If> ```> As the button_click, button_load, where should the code go?In the forms load event. frmMainGame for EO, frmStable for ES.You can also put it wherever the player can change their job, after they have changed their job. Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 ```Private Sub Form_Load() picAdmin.Left = 10 picCurrency.Left = txtMyChat.Left picCurrency.Top = txtMyChat.Top Me.width = 10545End Sub```that code is already in teh load sequence, where should i put it in there, anywhere? Link to comment Share on other sites More sharing options...
Yxxe Posted September 8, 2010 Share Posted September 8, 2010 @semlemsushi:> ```> Private Sub Form_Load()> picAdmin.Left = 10> picCurrency.Left = txtMyChat.Left> picCurrency.Top = txtMyChat.Top> Me.width = 10545> End Sub> ```> that code is already in teh load sequence, where should I put it in there, anywhere?Just underneath Me.width = 10545 Link to comment Share on other sites More sharing options...
semlemsushi Posted September 8, 2010 Author Share Posted September 8, 2010 well it failed, even if im not a gundealer i can still see the button =P. if you could take a look at this source that would be great, and im using origins if you didnt know Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now