Re: [hlcoders] Setting the body index of a model client-side...
Wow, thanks dude! BTW: Using the event API roolz. VALVe 4 EVER! - Original Message - From: "Chris Glein" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 6:37 PM Subject: RE: [hlcoders] Setting the body index of a model client-side... > You can set the body of the gibs. I did the same thing and made the gibs > client-side (cl_gibcount, ah yeah!) > > After you create your temp model, set the curstate's body to be whatever you > want the gib body to be. For example: > pGib->entity.curstate.body = gEngfuncs.pfnRandomFloat( 1, HUMAN_GIB_COUNT - > 1 ); > > Hope that helps. > > -PNB > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Da:Sourcerer > Sent: Tuesday, March 26, 2002 7:51 AM > To: [EMAIL PROTECTED] > Subject: [hlcoders] Setting the body index of a model client-side... > > > OK, I took advantage of the event API and brought several things > client-side. > Like the gibs. Unfortunately I can't set the body of the gibs so if you kill > someone, it is possible he might spawn two skull gibs. > > Any suggestions? > > Greetz, > Da:Sourcerer > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Accessing another client's iuser variable
I didn't want to have that kind of information being retrieved in the hud classes, just wanted something easily accessible from the entity states. I'm gonna try Adrian's suggestion, just checking the sequence flag, that's even better than using iuser in my case. Georges - Original Message - From: "Cortex" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 3:51 PM Subject: Re: [hlcoders] Accessing another client's iuser variable > Why din't you use a MSG_ALL (MESSAGE_BEGIN, etc...). You could add a custom > class derived from CHudBase... Then you implement your class as needed. > > I don't know if it's really interesting, but it could help :) > > - Cortex : mapper & coder www.hlalbator.fr.st > > > - Original Message - > From: Christopher McArthur > To: [EMAIL PROTECTED] > Sent: Tuesday, March 26, 2002 9:15 PM > Subject: Re: [hlcoders] Accessing another client's iuser variable > > > Is the iuser3 variable sent across in the AddToFullPack function in > client.cpp on the server.dll. > If its not in there, then it will not be sent across the network to all > clients like you want. > > > - Original Message - > From: "Georges Giroux" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, March 26, 2002 1:51 PM > Subject: [hlcoders] Accessing another client's iuser variable > > > > This is a multi-part message in MIME format. > > -- > > [ Picked text/plain from multipart/alternative ] > > Hello, > > > > I need some help or advice...this is my problem: > > -Two clients, client A, client B. > > -1 server > > > > -On the server, iuser3 for client A is set to 55 (for example) > > -On the server, iuser3 for client B is set to 45 (for example) > > > > When client A receives entity information, I'd like to be able to access > > client B's iuser3 variable as well. The problem is, it is always set to 0! > > Client A's own iuser3 is properly sent (delta.lst, etc etc) as well > > as Client B's own iuser3. It's just from Client A I want to access > > Client B's iuser3 in these two functions (in cl_dll\entity.cpp): > > > > HUD_ProcessPlayerState > > HUD_TxferPredictionData > > > > Any ideas/suggestions? > > > > Georges > > > > -- > > > > ___ > > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Accessing another client's iuser variable
Why din't you use a MSG_ALL (MESSAGE_BEGIN, etc...). You could add a custom class derived from CHudBase... Then you implement your class as needed. I don't know if it's really interesting, but it could help :) - Cortex : mapper & coder www.hlalbator.fr.st - Original Message - From: Christopher McArthur To: [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 9:15 PM Subject: Re: [hlcoders] Accessing another client's iuser variable Is the iuser3 variable sent across in the AddToFullPack function in client.cpp on the server.dll. If its not in there, then it will not be sent across the network to all clients like you want. - Original Message - From: "Georges Giroux" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 1:51 PM Subject: [hlcoders] Accessing another client's iuser variable > This is a multi-part message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > Hello, > > I need some help or advice...this is my problem: > -Two clients, client A, client B. > -1 server > > -On the server, iuser3 for client A is set to 55 (for example) > -On the server, iuser3 for client B is set to 45 (for example) > > When client A receives entity information, I'd like to be able to access > client B's iuser3 variable as well. The problem is, it is always set to 0! > Client A's own iuser3 is properly sent (delta.lst, etc etc) as well > as Client B's own iuser3. It's just from Client A I want to access > Client B's iuser3 in these two functions (in cl_dll\entity.cpp): > > HUD_ProcessPlayerState > HUD_TxferPredictionData > > Any ideas/suggestions? > > Georges > > -- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Accessing another client's iuser variable
Is the iuser3 variable sent across in the AddToFullPack function in client.cpp on the server.dll. If its not in there, then it will not be sent across the network to all clients like you want. - Original Message - From: "Georges Giroux" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 1:51 PM Subject: [hlcoders] Accessing another client's iuser variable > This is a multi-part message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > Hello, > > I need some help or advice...this is my problem: > -Two clients, client A, client B. > -1 server > > -On the server, iuser3 for client A is set to 55 (for example) > -On the server, iuser3 for client B is set to 45 (for example) > > When client A receives entity information, I'd like to be able to access > client B's iuser3 variable as well. The problem is, it is always set to 0! > Client A's own iuser3 is properly sent (delta.lst, etc etc) as well > as Client B's own iuser3. It's just from Client A I want to access > Client B's iuser3 in these two functions (in cl_dll\entity.cpp): > > HUD_ProcessPlayerState > HUD_TxferPredictionData > > Any ideas/suggestions? > > Georges > > -- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
RE: [hlcoders] Accessing another client's iuser variable
You can always check the sequence number on the client, in the model rendering code for that player. If it's set to your animation you can just tag that player as swinging the sword and do your magic trail thingy =). -Original Message- From: Georges Giroux [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 12:07 PM To: [EMAIL PROTECTED] Subject: Re: [hlcoders] Accessing another client's iuser variable Maybe I'm taking the wrong approach... I want to render a sword trail for any clients that have the iuser3 variable set...but this trail should only be rendered when his sword is swinging. So, in SetAnimation I set iuser3 to a value, and when the animation end, I reset it. All that is sent is 1 bit from iuser3 (specified in the delta.lst file). There is no way information like this is available to all clients without having the server transmit this information via messages? Georges - Original Message - From: "Dynerman David M" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 3:00 PM Subject: RE: [hlcoders] Accessing another client's iuser variable > What you're proposing defeats the point of the client-specific (i.e. > *user*) variables. > > Might as well just maintain the values on the server and transmit to all > clients. > > david > > -Original Message- > From: Georges Giroux [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, March 26, 2002 1:51 PM > To: [EMAIL PROTECTED] > Subject: [hlcoders] Accessing another client's iuser variable > > This is a multi-part message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > Hello, > > I need some help or advice...this is my problem: > -Two clients, client A, client B. > -1 server > > -On the server, iuser3 for client A is set to 55 (for example) > -On the server, iuser3 for client B is set to 45 (for example) > > When client A receives entity information, I'd like to be able to access > client B's iuser3 variable as well. The problem is, it is always set to > 0! > Client A's own iuser3 is properly sent (delta.lst, etc etc) as well > as Client B's own iuser3. It's just from Client A I want to access > Client B's iuser3 in these two functions (in cl_dll\entity.cpp): > > HUD_ProcessPlayerState > HUD_TxferPredictionData > > Any ideas/suggestions? > > Georges > > -- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Accessing another client's iuser variable
Maybe I'm taking the wrong approach... I want to render a sword trail for any clients that have the iuser3 variable set...but this trail should only be rendered when his sword is swinging. So, in SetAnimation I set iuser3 to a value, and when the animation end, I reset it. All that is sent is 1 bit from iuser3 (specified in the delta.lst file). There is no way information like this is available to all clients without having the server transmit this information via messages? Georges - Original Message - From: "Dynerman David M" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 3:00 PM Subject: RE: [hlcoders] Accessing another client's iuser variable > What you're proposing defeats the point of the client-specific (i.e. > *user*) variables. > > Might as well just maintain the values on the server and transmit to all > clients. > > david > > -Original Message- > From: Georges Giroux [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, March 26, 2002 1:51 PM > To: [EMAIL PROTECTED] > Subject: [hlcoders] Accessing another client's iuser variable > > This is a multi-part message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > Hello, > > I need some help or advice...this is my problem: > -Two clients, client A, client B. > -1 server > > -On the server, iuser3 for client A is set to 55 (for example) > -On the server, iuser3 for client B is set to 45 (for example) > > When client A receives entity information, I'd like to be able to access > client B's iuser3 variable as well. The problem is, it is always set to > 0! > Client A's own iuser3 is properly sent (delta.lst, etc etc) as well > as Client B's own iuser3. It's just from Client A I want to access > Client B's iuser3 in these two functions (in cl_dll\entity.cpp): > > HUD_ProcessPlayerState > HUD_TxferPredictionData > > Any ideas/suggestions? > > Georges > > -- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
RE: [hlcoders] Accessing another client's iuser variable
What you're proposing defeats the point of the client-specific (i.e. *user*) variables. Might as well just maintain the values on the server and transmit to all clients. david -Original Message- From: Georges Giroux [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 1:51 PM To: [EMAIL PROTECTED] Subject: [hlcoders] Accessing another client's iuser variable This is a multi-part message in MIME format. -- [ Picked text/plain from multipart/alternative ] Hello, I need some help or advice...this is my problem: -Two clients, client A, client B. -1 server -On the server, iuser3 for client A is set to 55 (for example) -On the server, iuser3 for client B is set to 45 (for example) When client A receives entity information, I'd like to be able to access client B's iuser3 variable as well. The problem is, it is always set to 0! Client A's own iuser3 is properly sent (delta.lst, etc etc) as well as Client B's own iuser3. It's just from Client A I want to access Client B's iuser3 in these two functions (in cl_dll\entity.cpp): HUD_ProcessPlayerState HUD_TxferPredictionData Any ideas/suggestions? Georges -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
[hlcoders] Accessing another client's iuser variable
This is a multi-part message in MIME format. -- [ Picked text/plain from multipart/alternative ] Hello, I need some help or advice...this is my problem: -Two clients, client A, client B. -1 server -On the server, iuser3 for client A is set to 55 (for example) -On the server, iuser3 for client B is set to 45 (for example) When client A receives entity information, I'd like to be able to access client B's iuser3 variable as well. The problem is, it is always set to 0! Client A's own iuser3 is properly sent (delta.lst, etc etc) as well as Client B's own iuser3. It's just from Client A I want to access Client B's iuser3 in these two functions (in cl_dll\entity.cpp): HUD_ProcessPlayerState HUD_TxferPredictionData Any ideas/suggestions? Georges -- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
RE: [hlcoders] Setting the body index of a model client-side...
You can set the body of the gibs. I did the same thing and made the gibs client-side (cl_gibcount, ah yeah!) After you create your temp model, set the curstate's body to be whatever you want the gib body to be. For example: pGib->entity.curstate.body = gEngfuncs.pfnRandomFloat( 1, HUMAN_GIB_COUNT - 1 ); Hope that helps. -PNB -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Da:Sourcerer Sent: Tuesday, March 26, 2002 7:51 AM To: [EMAIL PROTECTED] Subject: [hlcoders] Setting the body index of a model client-side... OK, I took advantage of the event API and brought several things client-side. Like the gibs. Unfortunately I can't set the body of the gibs so if you kill someone, it is possible he might spawn two skull gibs. Any suggestions? Greetz, Da:Sourcerer ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
[hlcoders] Setting the body index of a model client-side...
OK, I took advantage of the event API and brought several things client-side. Like the gibs. Unfortunately I can't set the body of the gibs so if you kill someone, it is possible he might spawn two skull gibs. Any suggestions? Greetz, Da:Sourcerer ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: Re[6]: [hlcoders] problem with GiveNamedItem need help.
- Original Message - From: "Cruise" <[EMAIL PROTECTED]> To: "Christopher Long" <[EMAIL PROTECTED]> Sent: Wednesday, March 27, 2002 12:48 AM Subject: Re[6]: [hlcoders] problem with GiveNamedItem need help. > -BEGIN PGP SIGNED MESSAGE- > Hash: MD5 > > > now its funny cause if i only use just one of them say string1 to do them > > all so replace in the above code all occurences of string2 and string3 and > > put > > string1 in its place. Now i get back to my original problem and yet IF i use > > 3 seperate strings instead of the same one for all then its ok. > > Using what you said cruise say if i did > > char *temp = new char[30]; > > then do the sprintf's for each and give the named items then it works fine > > but ONLY if i don't delete the char at the end of the function... if i put > > delete temp; at the end of the function it goes screwy. But if i don't > > delete it then the memory is gone is it not till the program halts... or is > > it till the machine is > > reset? > Program end I believe. On large objects it would be a problem, but at 30 > bytes a pop, I don't think most users are gonna notice :P Windows restart on the 9x series. Program end on NTx/XP. (I think). ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re[6]: [hlcoders] problem with GiveNamedItem need help.
-BEGIN PGP SIGNED MESSAGE- Hash: MD5 > now its funny cause if i only use just one of them say string1 to do them > all so replace in the above code all occurences of string2 and string3 and > put > string1 in its place. Now i get back to my original problem and yet IF i use > 3 seperate strings instead of the same one for all then its ok. > Using what you said cruise say if i did > char *temp = new char[30]; > then do the sprintf's for each and give the named items then it works fine > but ONLY if i don't delete the char at the end of the function... if i put > delete temp; at the end of the function it goes screwy. But if i don't > delete it then the memory is gone is it not till the program halts... or is > it till the machine is > reset? Program end I believe. On large objects it would be a problem, but at 30 bytes a pop, I don't think most users are gonna notice :P > anyways i am now thinking the giveNamedItem function receives a const char > pointer to the string right so does this mean that if for some reason > the string > lost its scope and was removed that the pointer to it can no longer validly > give the weapon but thats kinda crap isn't it cause it passes through > the givenameditem function gives the weapon... then returns to its place > back in the code which is after the pPlayer->GiveNamedItem call? I don't have the code to hand right now, but I suspect GiveNamedItem passes it on to other functions which store the pointer, so changing that value would be Bad (tm). > Its getting to the stage where this has gone a bit beyond me i'm not sure if > its either a bug in my source that is doing something strange or if just > what i am trying to do is not doing it how i think it is ie something with > variables falling out of scope etc. I doubt it's a bug in your source...have a close look at GiveNamedItem and any functions it calls, and see what they do with the pointer. > Cruise you got any info on this and why its doing it? I'm starting to think > your onto something here and its kinda swaying my views > Any others got input... Botman? Valve Guys? Mom :( ? [ Cruise / www.casual-tempest.net ] -BEGIN PGP SIGNATURE- Version: 2.6 iQCVAwUAPKBuDfdi0Z5STRufAQF0FAP9GuyfSFLs9lMXra6Z+6M4kzXC8iUa7jGn G+z3ish7xLtVB4v4BYSsuSqNZKSxZ90i5OBx9TWU2nQPFLrwvh/F38t785Xm2UYs w+189X4f5rS5qomDVB/U56ehkulVIOtsktaJCGyddI/wD9cZlc+lb2cWaivqeADV aYKIblXr6P4= =lSBC -END PGP SIGNATURE- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: Re[4]: [hlcoders] problem with GiveNamedItem need help.
ok new updated information it does work but i wanna know why it does this way and why it doesn't the other way. there is no use me just getting it to work if i haven't learnt why it wouldn't work... if i can't learn that then its just as good as never doing it. Ok here we go i added to the cbaseplayer class 3 new vars char string1[30]; char string2[30]; char string3[30]; now in the multiplaygamerules my new function void CHalfLifeMultiplay::SetUpCharacter(CBasePlayer *pPlayer) { // 0 = no change in vgui.. 99 = nothing if(pPlayer->m_iPrimaryWeapon != 0 && pPlayer->m_iPrimaryWeapon != 99) { sprintf(pPlayer->string1,"weapon_%s",SpeciesWeapons[0].PrimaryWeaponName[pPl ayer->m_iPrimaryWeapon]); pPlayer->GiveNamedItem(pPlayer->string1); } if(pPlayer->m_iSecondaryWeapon != 0 && pPlayer->m_iSecondaryWeapon != 99) { sprintf(pPlayer->string2, "weapon_%s",SpeciesWeapons[0].SecondaryWeaponName[pPlayer->m_iSecondaryWeapo n]); pPlayer->GiveNamedItem(pPlayer->string2); } if(pPlayer->m_iCloseCombatWeapon != 0 && pPlayer->m_iCloseCombatWeapon != 99) { sprintf(pPlayer->string3, "weapon_%s",SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatW eapon]); pPlayer->GiveNamedItem(pPlayer->string3); } } now its funny cause if i only use just one of them say string1 to do them all so replace in the above code all occurences of string2 and string3 and put string1 in its place. Now i get back to my original problem and yet IF i use 3 seperate strings instead of the same one for all then its ok. Using what you said cruise say if i did char *temp = new char[30]; then do the sprintf's for each and give the named items then it works fine but ONLY if i don't delete the char at the end of the function... if i put delete temp; at the end of the function it goes screwy. But if i don't delete it then the memory is gone is it not till the program halts... or is it till the machine is reset? anyways i am now thinking the giveNamedItem function receives a const char pointer to the string right so does this mean that if for some reason the string lost its scope and was removed that the pointer to it can no longer validly give the weapon but thats kinda crap isn't it cause it passes through the givenameditem function gives the weapon... then returns to its place back in the code which is after the pPlayer->GiveNamedItem call? Its getting to the stage where this has gone a bit beyond me i'm not sure if its either a bug in my source that is doing something strange or if just what i am trying to do is not doing it how i think it is ie something with variables falling out of scope etc. Cruise you got any info on this and why its doing it? I'm starting to think your onto something here and its kinda swaying my views Any others got input... Botman? Valve Guys? Mom :( ? - Original Message - From: Cruise <[EMAIL PROTECTED]> To: Christopher Long <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 9:47 PM Subject: Re[4]: [hlcoders] problem with GiveNamedItem need help. > -BEGIN PGP SIGNED MESSAGE- > Hash: MD5 > > > > being sent as a command??? no no the file is just a header with a complete > > listing of all weapons in a made struct :/ its not actually send from the > > client and picked up in the ClientCommand function. > > > all i pass from the client once vgui picks things is 4 ints which just > > contain the weapon index that i reference to that struct object to get what > > the weapons name is. The alert works fine and displays what the complete > > givenameditem string is > > No, I meant when the client picks a certain weapon. You said that they > were in the list, but not selectable...unless you've completely > changed that part of the code also, switching between weapons sends > the name of the weapon from the client to the server. Make sure that > value is being sent correctly. > > > I appreciate your help none the less... any attemp at a solution is better > > then nothing :). i doubt though that char *temp = new char[20]; would fix > > the problem... its the same as going char temp[20]; string copying into it > > the full weapon name then doing a GiveNamedItem on it its memory has > > been set aside so it shouldn't have an issue... o well maybe my problem is > > unfixable :/. > But it has only been set aside within the confines of the function. > temp is a /local/ variable. Calling new allocates the memory > permanently, so it won't get written over. I agree it shouldn't make > much difference, but something is screwing you over, and that's the > only difference between the working and non-working versions as far > as I can see. > > [ Cruise / www.casual-tempest.net ] > > -BEGIN PGP SIGNATURE- > Version: 2.6 > > iQCVAwUAPKBf3fdi0Z5STRufAQHoSQP6AiURhdMubWn6JvGZoAhvxoyZOxKYCFn8 > zejSOpMHpALOzBFeq+kSl7CabwSQUkFW4jlwq8ElYPOoQGU7Fvp/m/Y8Rn7Wsfvj > 5T2RfJxwUYZMGnGVfV6haI7mFO/H6mpFUMYk4sMexkoKpxPj7bmOpHIFMcODVeNq > SeuDUFg0kAo= > =92hf > -END PGP SIGNATURE- > > _
Re[4]: [hlcoders] problem with GiveNamedItem need help.
-BEGIN PGP SIGNED MESSAGE- Hash: MD5 > being sent as a command??? no no the file is just a header with a complete > listing of all weapons in a made struct :/ its not actually send from the > client and picked up in the ClientCommand function. > all i pass from the client once vgui picks things is 4 ints which just > contain the weapon index that i reference to that struct object to get what > the weapons name is. The alert works fine and displays what the complete > givenameditem string is No, I meant when the client picks a certain weapon. You said that they were in the list, but not selectable...unless you've completely changed that part of the code also, switching between weapons sends the name of the weapon from the client to the server. Make sure that value is being sent correctly. > I appreciate your help none the less... any attemp at a solution is better > then nothing :). i doubt though that char *temp = new char[20]; would fix > the problem... its the same as going char temp[20]; string copying into it > the full weapon name then doing a GiveNamedItem on it its memory has > been set aside so it shouldn't have an issue... o well maybe my problem is > unfixable :/. But it has only been set aside within the confines of the function. temp is a /local/ variable. Calling new allocates the memory permanently, so it won't get written over. I agree it shouldn't make much difference, but something is screwing you over, and that's the only difference between the working and non-working versions as far as I can see. [ Cruise / www.casual-tempest.net ] -BEGIN PGP SIGNATURE- Version: 2.6 iQCVAwUAPKBf3fdi0Z5STRufAQHoSQP6AiURhdMubWn6JvGZoAhvxoyZOxKYCFn8 zejSOpMHpALOzBFeq+kSl7CabwSQUkFW4jlwq8ElYPOoQGU7Fvp/m/Y8Rn7Wsfvj 5T2RfJxwUYZMGnGVfV6haI7mFO/H6mpFUMYk4sMexkoKpxPj7bmOpHIFMcODVeNq SeuDUFg0kAo= =92hf -END PGP SIGNATURE- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: Re[2]: [hlcoders] problem with GiveNamedItem need help.
being sent as a command??? no no the file is just a header with a complete listing of all weapons in a made struct :/ its not actually send from the client and picked up in the ClientCommand function. all i pass from the client once vgui picks things is 4 ints which just contain the weapon index that i reference to that struct object to get what the weapons name is. The alert works fine and displays what the complete givenameditem string is I appreciate your help none the less... any attemp at a solution is better then nothing :). i doubt though that char *temp = new char[20]; would fix the problem... its the same as going char temp[20]; string copying into it the full weapon name then doing a GiveNamedItem on it its memory has been set aside so it shouldn't have an issue... o well maybe my problem is unfixable :/. - Original Message - From: Cruise <[EMAIL PROTECTED]> To: Christopher Long <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 9:03 PM Subject: Re[2]: [hlcoders] problem with GiveNamedItem need help. > -BEGIN PGP SIGNED MESSAGE- > Hash: MD5 > > > so why can't i go > > char temp[20]; > > sprintf(temp, "weapon_%s", > > SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); > pPlayer->>GiveNamedItem(temp); > > > i've done it and on an alert it does indeed contain weapon_knife. And if it > > wasn't working then why would it give me the knife and yet make it > > unselectable on the hud.. well i can select but clicking won't draw it out. > > this also fails > > char temp[30]; > > strcpy(temp, "weapon_knife"); > pPlayer->>GiveNamedItem(temp); > > > it gives and i can see it in the list select it but clicking won't draw > > it yet > pPlayer->>GiveNamedItem("weapon_knife"); > > works fine lets me select and pull out etc. > > The difference between the one that works and the two that don't is > that the first two use a temporary /local/ variable, which is free to > go out of scope and be reallocated at the end of the function...it > could be that that is causing the problem... > > Try: > > char *temp = new char[20]; > sprintf(temp, "weapon_%s",SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatW eapon]); > pPlayer->GiveNamedItem(temp); > > That way the memory is allocated and won't be used by anything > else...see if that makes a difference. > > > The not selectable problem suggests the string passed back from the > client is incorrect...in the ClientCommand function, where it handles > "weapon_" commands, print that out and check it's being sent > correctly... > > [ Cruise / www.casual-tempest.net ] > > -BEGIN PGP SIGNATURE- > Version: 2.6 > > iQCVAwUAPKBVfvdi0Z5STRufAQGeLwQAuQHC+2Q3oLTcA3cM3m9V/nfUGM8s+jP6 > jctWhm2WU5ADXIEI2DZ2aBD5faYLU2IgDI14ptm8+VhmaOblW+0z1Ue7il9HDNDz > P9JFSRuelKQAUtx3bXlQqMtzD6Ap4HGoVMPp0pbSeLStltnk1yi6gU39JRF4xbAw > Nnnt60p0scg= > =+/vI > -END PGP SIGNATURE- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re[2]: [hlcoders] problem with GiveNamedItem need help.
-BEGIN PGP SIGNED MESSAGE- Hash: MD5 > so why can't i go > char temp[20]; > sprintf(temp, "weapon_%s", > SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); pPlayer->>GiveNamedItem(temp); > i've done it and on an alert it does indeed contain weapon_knife. And if it > wasn't working then why would it give me the knife and yet make it > unselectable on the hud.. well i can select but clicking won't draw it out. > this also fails > char temp[30]; > strcpy(temp, "weapon_knife"); pPlayer->>GiveNamedItem(temp); > it gives and i can see it in the list select it but clicking won't draw > it yet pPlayer->>GiveNamedItem("weapon_knife"); > works fine lets me select and pull out etc. The difference between the one that works and the two that don't is that the first two use a temporary /local/ variable, which is free to go out of scope and be reallocated at the end of the function...it could be that that is causing the problem... Try: char *temp = new char[20]; sprintf(temp, "weapon_%s",SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); pPlayer->GiveNamedItem(temp); That way the memory is allocated and won't be used by anything else...see if that makes a difference. The not selectable problem suggests the string passed back from the client is incorrect...in the ClientCommand function, where it handles "weapon_" commands, print that out and check it's being sent correctly... [ Cruise / www.casual-tempest.net ] -BEGIN PGP SIGNATURE- Version: 2.6 iQCVAwUAPKBVfvdi0Z5STRufAQGeLwQAuQHC+2Q3oLTcA3cM3m9V/nfUGM8s+jP6 jctWhm2WU5ADXIEI2DZ2aBD5faYLU2IgDI14ptm8+VhmaOblW+0z1Ue7il9HDNDz P9JFSRuelKQAUtx3bXlQqMtzD6Ap4HGoVMPp0pbSeLStltnk1yi6gU39JRF4xbAw Nnnt60p0scg= =+/vI -END PGP SIGNATURE- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] problem with GiveNamedItem need help.
o sorry when i said this // 0 = no change in vgui.. 99 = nothing if(pPlayer->m_iPrimaryWeapon != 0 && pPlayer->m_iPrimaryWeapon != 99) { pPlayer->GiveNamedItem(SpeciesWeapons[0].PrimaryWeaponName[pPlayer->m_iPrima ryWeapon]); } if(pPlayer->m_iSecondaryWeapon != 0 && pPlayer->m_iSecondaryWeapon != 99) { pPlayer->GiveNamedItem(SpeciesWeapons[0].SecondaryWeaponName[pPlayer->m_iSec ondaryWeapon]); } if(pPlayer->m_iCloseCombatWeapon != 0 && pPlayer->m_iCloseCombatWeapon != 99) { pPlayer->GiveNamedItem(SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iC loseCombatWeapon]); } i was applying that to when i change the struct instantiations for the weapons to "weapon_knife" instead of "knife" and prepending the "weapon_" part but if i had the weapon name wrong then why would i get the weapon see it in the hud but not be able to draw it by clicking? if i type drop in the console to drop all weapons i have i do indeed finally get to it through the weightings but i just can't draw it on my own :(... tis a weid problem and no i'm not having anyone on. - Original Message - From: Cruise <[EMAIL PROTECTED]> To: Christopher Long <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 8:30 PM Subject: Re: [hlcoders] problem with GiveNamedItem need help. > -BEGIN PGP SIGNED MESSAGE- > Hash: MD5 > > [snip] > > > then again in the multiplay game rules when i set them up i do this instead > > > // 0 = no change in vgui.. 99 = nothing > if(pPlayer->>m_iPrimaryWeapon != 0 && pPlayer->m_iPrimaryWeapon != 99) > > { > pPlayer->>GiveNamedItem(SpeciesWeapons[0].PrimaryWeaponName[pPlayer->m_iPrim aryWeapon]); > > } > > if(pPlayer->>m_iSecondaryWeapon != 0 && pPlayer->m_iSecondaryWeapon != 99) > > { > pPlayer->>GiveNamedItem(SpeciesWeapons[0].SecondaryWeaponName[pPlayer->m_iSe condaryWeapon]); > > } > > if(pPlayer->>m_iCloseCombatWeapon != 0 && pPlayer->m_iCloseCombatWeapon != 99) > > { > pPlayer->>GiveNamedItem(SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_i CloseCombatWeapon]); > > } > > > it works 100% fine. Now i don't see how compacting into 1 string with using sprintf and prefixing > > "weapon_" should hurt it or make it work any different > > Because pre-pending "weapon_" makes it a completely different string? > The name you pass to GiveNamedItem should match exactly what you pass > into your LINK_ENTITY_TO_CLASS macro for the respective weapon. If > you've declared your weapon names to be just "mp5", or "knife", then > that's what you'll have to pass to GiveNamedItem. > > > UPDATE > > I tryed some other things after talking to randomnine on it with him suggesting i should > > print the contents of the string character by character after doing so i get something like this > > > sprintf(fullWeapName, "weapon_%s", SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); > > > for(i= 0; i < 30; i++) > > { > > ALERT(at_console, "%c", fullWeapName[i]); > > > if(i == 29) > > ALERT(at_console, "\n"); > > } > > > to the console it prints > > weapon_mp5Bj! and the close combat weapon contains > > weapon_knifej! > > > i dunno what the j! is :/ or the Bj! and how it got there either. > > What's wrong with ALERT(at_console, "%s", fullWeapName[i]); ? > If you print it out character by character like this then you'll go > straight past the end of the string into the undefined regions, which > naturally will have all sorts of random crap in them... > > > [ Cruise / www.casual-tempest.net ] > > -BEGIN PGP SIGNATURE- > Version: 2.6 > > iQCVAwUAPKBNy/di0Z5STRufAQHkIgQAvbLmmYAF7Us62gqk4kQZ3PLyjqJl/97Z > boZMIkOvfPtNNgKKsfFqq+blhc5HCJgfRpvkmsx8N2jviQ1mE5Zbd+1Pe7Nh9cck > BGmOWcjsPz3zAtdz9lyzqW8HBWI73B1bjRrnEz4qy2cN4eyQ0edYpXlCx4rpIWMt > YIhpbcrg0Lo= > =0heP > -END PGP SIGNATURE- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] problem with GiveNamedItem need help.
yes but prepending it makes it what is in my LINK_ENTITY_TO_CLASS knife is called weapon_knife so why can't i go char temp[20]; sprintf(temp, "weapon_%s", SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); pPlayer->GiveNamedItem(temp); i've done it and on an alert it does indeed contain weapon_knife. And if it wasn't working then why would it give me the knife and yet make it unselectable on the hud.. well i can select but clicking won't draw it out. this also fails char temp[30]; strcpy(temp, "weapon_knife"); pPlayer->GiveNamedItem(temp); it gives and i can see it in the list select it but clicking won't draw it yet pPlayer->GiveNamedItem("weapon_knife"); works fine lets me select and pull out etc. If i am missing something you said could you explain to me a little better... but i think something is either not quite right with my compiler, machine OR my sdk version. - Original Message - From: Cruise <[EMAIL PROTECTED]> To: Christopher Long <[EMAIL PROTECTED]> Sent: Tuesday, March 26, 2002 8:30 PM Subject: Re: [hlcoders] problem with GiveNamedItem need help. > -BEGIN PGP SIGNED MESSAGE- > Hash: MD5 > > [snip] > > > then again in the multiplay game rules when i set them up i do this instead > > > // 0 = no change in vgui.. 99 = nothing > if(pPlayer->>m_iPrimaryWeapon != 0 && pPlayer->m_iPrimaryWeapon != 99) > > { > pPlayer->>GiveNamedItem(SpeciesWeapons[0].PrimaryWeaponName[pPlayer->m_iPrim aryWeapon]); > > } > > if(pPlayer->>m_iSecondaryWeapon != 0 && pPlayer->m_iSecondaryWeapon != 99) > > { > pPlayer->>GiveNamedItem(SpeciesWeapons[0].SecondaryWeaponName[pPlayer->m_iSe condaryWeapon]); > > } > > if(pPlayer->>m_iCloseCombatWeapon != 0 && pPlayer->m_iCloseCombatWeapon != 99) > > { > pPlayer->>GiveNamedItem(SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_i CloseCombatWeapon]); > > } > > > it works 100% fine. Now i don't see how compacting into 1 string with using sprintf and prefixing > > "weapon_" should hurt it or make it work any different > > Because pre-pending "weapon_" makes it a completely different string? > The name you pass to GiveNamedItem should match exactly what you pass > into your LINK_ENTITY_TO_CLASS macro for the respective weapon. If > you've declared your weapon names to be just "mp5", or "knife", then > that's what you'll have to pass to GiveNamedItem. > > > UPDATE > > I tryed some other things after talking to randomnine on it with him suggesting i should > > print the contents of the string character by character after doing so i get something like this > > > sprintf(fullWeapName, "weapon_%s", SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); > > > for(i= 0; i < 30; i++) > > { > > ALERT(at_console, "%c", fullWeapName[i]); > > > if(i == 29) > > ALERT(at_console, "\n"); > > } > > > to the console it prints > > weapon_mp5Bj! and the close combat weapon contains > > weapon_knifej! > > > i dunno what the j! is :/ or the Bj! and how it got there either. > > What's wrong with ALERT(at_console, "%s", fullWeapName[i]); ? > If you print it out character by character like this then you'll go > straight past the end of the string into the undefined regions, which > naturally will have all sorts of random crap in them... > > > [ Cruise / www.casual-tempest.net ] > > -BEGIN PGP SIGNATURE- > Version: 2.6 > > iQCVAwUAPKBNy/di0Z5STRufAQHkIgQAvbLmmYAF7Us62gqk4kQZ3PLyjqJl/97Z > boZMIkOvfPtNNgKKsfFqq+blhc5HCJgfRpvkmsx8N2jviQ1mE5Zbd+1Pe7Nh9cck > BGmOWcjsPz3zAtdz9lyzqW8HBWI73B1bjRrnEz4qy2cN4eyQ0edYpXlCx4rpIWMt > YIhpbcrg0Lo= > =0heP > -END PGP SIGNATURE- > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] problem with GiveNamedItem need help.
-BEGIN PGP SIGNED MESSAGE- Hash: MD5 [snip] > then again in the multiplay game rules when i set them up i do this instead > // 0 = no change in vgui.. 99 = nothing if(pPlayer->>m_iPrimaryWeapon != 0 && pPlayer->m_iPrimaryWeapon != 99) > { pPlayer->>GiveNamedItem(SpeciesWeapons[0].PrimaryWeaponName[pPlayer->m_iPrimaryWeapon]); > } if(pPlayer->>m_iSecondaryWeapon != 0 && pPlayer->m_iSecondaryWeapon != 99) > { pPlayer->>GiveNamedItem(SpeciesWeapons[0].SecondaryWeaponName[pPlayer->m_iSecondaryWeapon]); > } if(pPlayer->>m_iCloseCombatWeapon != 0 && pPlayer->m_iCloseCombatWeapon != 99) > { pPlayer->>GiveNamedItem(SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); > } > it works 100% fine. Now i don't see how compacting into 1 string with using sprintf >and prefixing > "weapon_" should hurt it or make it work any different Because pre-pending "weapon_" makes it a completely different string? The name you pass to GiveNamedItem should match exactly what you pass into your LINK_ENTITY_TO_CLASS macro for the respective weapon. If you've declared your weapon names to be just "mp5", or "knife", then that's what you'll have to pass to GiveNamedItem. > UPDATE > I tryed some other things after talking to randomnine on it with him suggesting i >should > print the contents of the string character by character after doing so i get >something like this > sprintf(fullWeapName, "weapon_%s", >SpeciesWeapons[0].CloseCombatWeaponName[pPlayer->m_iCloseCombatWeapon]); > for(i= 0; i < 30; i++) > { > ALERT(at_console, "%c", fullWeapName[i]); > if(i == 29) > ALERT(at_console, "\n"); > } > to the console it prints > weapon_mp5Bj! and the close combat weapon contains > weapon_knifej! > i dunno what the j! is :/ or the Bj! and how it got there either. What's wrong with ALERT(at_console, "%s", fullWeapName[i]); ? If you print it out character by character like this then you'll go straight past the end of the string into the undefined regions, which naturally will have all sorts of random crap in them... [ Cruise / www.casual-tempest.net ] -BEGIN PGP SIGNATURE- Version: 2.6 iQCVAwUAPKBNy/di0Z5STRufAQHkIgQAvbLmmYAF7Us62gqk4kQZ3PLyjqJl/97Z boZMIkOvfPtNNgKKsfFqq+blhc5HCJgfRpvkmsx8N2jviQ1mE5Zbd+1Pe7Nh9cck BGmOWcjsPz3zAtdz9lyzqW8HBWI73B1bjRrnEz4qy2cN4eyQ0edYpXlCx4rpIWMt YIhpbcrg0Lo= =0heP -END PGP SIGNATURE- ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders