Raised This Month: $51 Target: $400
 12% 

[Metamod] ScoreInfo msg (loop through players instead of using MSG_ALL)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 10-09-2015 , 14:45   [Metamod] ScoreInfo msg (loop through players instead of using MSG_ALL)
Reply With Quote #1

I'm kinda lost why this won't work.
Code:
for ( int i = 0; i < gpGlobals->maxClients; i++ ) {     pPlayer = INDEXENT(i + 1);     if (!FNullEnt (pPlayer) && (pPlayer->v.flags & FL_CLIENT))     {         pPlayer->v.frags += m_Score;         MESSAGE_BEGIN(MSG_ONE, GET_USER_MSG_ID(PLID, "ScoreInfo", NULL), NULL, pPlayer); // neither MSG_ONE_UNRELIABLE             WRITE_BYTE(ENTINDEX(pPlayer)); // user index             WRITE_SHORT((int)pPlayer->v.frags); // frags             WRITE_SHORT(*((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS)); // deaths             WRITE_SHORT(0); // ?             WRITE_SHORT(*((int *)pPlayer->pvPrivateData + OFFSETS_TEAM)); // team         MESSAGE_END();     } }
Which throws this error message:
Code:
FATAL ERROR (shutting down): MSG_ONE or MSG_ONE_UNRELIABLE with no target entity
I know I can use this method which works just fine.
Code:
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreInfo", NULL));     WRITE_BYTE(ENTINDEX(pevAttacker)); // user index     WRITE_SHORT((int)pevAttacker->v.frags); // frags     WRITE_SHORT(*((int *)pevAttacker->pvPrivateData + OFFSET_CSDEATHS)); // deaths     WRITE_SHORT(0); // ?     WRITE_SHORT(*((int *)pevAttacker->pvPrivateData + OFFSETS_TEAM)); // team MESSAGE_END();
But I have to use the 1st one which aren't working.

Last edited by Rirre; 10-09-2015 at 15:19.
Rirre is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-09-2015 , 15:25   Re: [Metamod] ScoreInfo msg (loop through players instead of using MSG_ALL)
Reply With Quote #2

Error happens because engine doesn't like you pass null entity with MSG_ONE, though I'm not sure how it's possible from your code above, are you sure it crashes for this message?
__________________

Last edited by Arkshine; 10-09-2015 at 15:27.
Arkshine is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 10-09-2015 , 15:31   Re: [Metamod] ScoreInfo msg (loop through players instead of using MSG_ALL)
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
Error happens because engine doesn't like you pass null entity with MSG_ONE, though I'm not sure how it's possible from your code above, are you sure it crashes for this message?
Feel free to try it yourself.
EDIT: Nevermind, somehow Windows did not replace/update the new output file. Had to the delete the .dll manually and copy & paste so it's fresh. All of this just because of a Windows bug...

Last edited by Rirre; 10-09-2015 at 16:02.
Rirre is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode