Show Other Players Items

Want to talk about war3ft or make suggestions? Post them here

Moderator: Forum Moderator

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Show Other Players Items

Postby whosyourdaddy » Tue Nov 25, 2008 12:59 pm

ya its possible its an easy code to do too, if u would like i can write it up for ya
Image

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Show Other Players Items

Postby whosyourdaddy » Wed Dec 03, 2008 10:46 pm

well geesu somewhat has it setup to show items but its not adding the string correctly but here is what i have and it works and doesnt show the item if its a mole. find wc3_showspecinfo in war3ft.inl and replace the whole thing with this

Code: Select all

WC3_ShowSpecInfo( id, iTargetID )
{
   // Get the target's name
   new szTargetName[32];
   get_user_name( iTargetID, szTargetName, 31 );
   
   // Get the target's race name
   new szRaceName[64];
   lang_GetRaceName( p_data[iTargetID][P_RACE], id, szRaceName, 63, true );
   
   new szMsg[512], iMsgPos = 0;

   // User is level 0
   if ( p_data[iTargetID][P_LEVEL] == 0 )
   {
      iMsgPos += formatex( szMsg, 511, "%s  XP: %d/%d", szRaceName, p_data[iTargetID][P_XP], XP_GetByLevel( p_data[iTargetID][P_LEVEL]+1 ) );
   }

   // User is under level 10
   else if ( p_data[iTargetID][P_LEVEL] < 17 )
   {
      iMsgPos += formatex( szMsg, 511, "%s %L: %d   XP: %d/%d", szRaceName, id, "WORD_LEVEL", p_data[iTargetID][P_LEVEL], p_data[iTargetID][P_XP], XP_GetByLevel( p_data[iTargetID][P_LEVEL]+1 ) );
   }         
      
   // User is level 10
   else
   {
      iMsgPos += formatex( szMsg, 511, "%s %L: %d   XP: %d", szRaceName, id, "WORD_LEVEL", p_data[iTargetID][P_LEVEL], p_data[iTargetID][P_XP] );
   }
   

   new szItemName[32], szItemName2[32];

   // Get the item and race names
   LANG_GetItemName( g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE], id, szItemName, 31, true );
   LANG_GetItemName( g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO], id, szItemName2, 31, true );
   new bool:ItemSlotOne = false
   new bool:HasMoreThanOneRing = false

   if ( g_iTotalRings[iTargetID] > 1 )
      HasMoreThanOneRing = true;

   // User has one item
   if ( g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE] > ITEM_NONE && g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE] != ITEM_MOLE )
   {
      // Then they have rings, lets print how many there are
      if (HasMoreThanOneRing && g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE] == ITEM_RING)
         iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s x%d", szItemName, g_iTotalRings[iTargetID] );
      else
         iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s", szItemName );

      ItemSlotOne = true;
   }

   // User has another item
   if ( g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] > ITEM_NONE && g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] != ITEM_MOLE )
   {
      // Then the string isn't empty and we have information in it (so we have a first item)
      if ( ItemSlotOne )
      {
         // Then they have rings, lets print how many there are
         if (HasMoreThanOneRing && g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] == ITEM_RING)
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, " %L %s x%d", id, "WORD_AND", szItemName2, g_iTotalRings[iTargetID] );
         else
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, " %L %s", id, "WORD_AND", szItemName2 );
      }
      // We don't need the word "and"
      else
      {         
         // Then they have rings, lets print how many there are
         if (HasMoreThanOneRing && g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] == ITEM_RING)
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s x%d", szItemName2, g_iTotalRings[iTargetID] );
         else
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s", szItemName2 );
      }

   }


   // Add the Health + Armor to the message
   if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
   {
      iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^n%L: %d^n%L: %d", id, "CURRENT_HEALTH", get_user_health( iTargetID ), id, "WORD_ARMOR", get_user_armor( iTargetID ) );
   }
   
   // No armor in DOD
   else if ( g_MOD == GAME_DOD )
   {
      iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^n%L: %d", id, "CURRENT_HEALTH", get_user_health( iTargetID ) );
   }
   
   
   // Format the message
   new Float:fSpecTime = SPEC_HOLDTIME;

   if ( get_pcvar_num( CVAR_wc3_spec_position ) == 0 )
   {
      set_hudmessage( 255, 255, 255, 0.018, 0.9, 2, 1.5, fSpecTime, 0.02, 5.0, HUD_SPEC_INFO );
   }
   else
   {
      set_hudmessage( 255, 255, 255, 0.65, 0.9, 2, 1.5, fSpecTime, 0.02, 5.0, HUD_SPEC_INFO );
   }
   
   // Show the message
   show_hudmessage( id, szMsg );
}


*edited* fixed a small bug but here this should work 100%
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3158
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: Show Other Players Items

Postby Geesu » Fri Jan 02, 2009 1:12 am

whosyourdaddy wrote:well geesu somewhat has it setup to show items but its not adding the string correctly but here is what i have and it works and doesnt show the item if its a mole. find wc3_showspecinfo in war3ft.inl and replace the whole thing with this

Code: Select all

WC3_ShowSpecInfo( id, iTargetID )
{
   // Get the target's name
   new szTargetName[32];
   get_user_name( iTargetID, szTargetName, 31 );
   
   // Get the target's race name
   new szRaceName[64];
   lang_GetRaceName( p_data[iTargetID][P_RACE], id, szRaceName, 63, true );
   
   new szMsg[512], iMsgPos = 0;

   // User is level 0
   if ( p_data[iTargetID][P_LEVEL] == 0 )
   {
      iMsgPos += formatex( szMsg, 511, "%s  XP: %d/%d", szRaceName, p_data[iTargetID][P_XP], XP_GetByLevel( p_data[iTargetID][P_LEVEL]+1 ) );
   }

   // User is under level 10
   else if ( p_data[iTargetID][P_LEVEL] < 17 )
   {
      iMsgPos += formatex( szMsg, 511, "%s %L: %d   XP: %d/%d", szRaceName, id, "WORD_LEVEL", p_data[iTargetID][P_LEVEL], p_data[iTargetID][P_XP], XP_GetByLevel( p_data[iTargetID][P_LEVEL]+1 ) );
   }         
      
   // User is level 10
   else
   {
      iMsgPos += formatex( szMsg, 511, "%s %L: %d   XP: %d", szRaceName, id, "WORD_LEVEL", p_data[iTargetID][P_LEVEL], p_data[iTargetID][P_XP] );
   }
   

   new szItemName[32], szItemName2[32];

   // Get the item and race names
   LANG_GetItemName( g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE], id, szItemName, 31, true );
   LANG_GetItemName( g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO], id, szItemName2, 31, true );
   new bool:ItemSlotOne = false
   new bool:HasMoreThanOneRing = false

   if ( g_iTotalRings[iTargetID] > 1 )
      HasMoreThanOneRing = true;

   // User has one item
   if ( g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE] > ITEM_NONE && g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE] != ITEM_MOLE )
   {
      // Then they have rings, lets print how many there are
      if (HasMoreThanOneRing && g_iShopMenuItems[iTargetID][ITEM_SLOT_ONE] == ITEM_RING)
         iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s x%d", szItemName, g_iTotalRings[iTargetID] );
      else
         iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s", szItemName );

      ItemSlotOne = true;
   }

   // User has another item
   if ( g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] > ITEM_NONE && g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] != ITEM_MOLE )
   {
      // Then the string isn't empty and we have information in it (so we have a first item)
      if ( ItemSlotOne )
      {
         // Then they have rings, lets print how many there are
         if (HasMoreThanOneRing && g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] == ITEM_RING)
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, " %L %s x%d", id, "WORD_AND", szItemName2, g_iTotalRings[iTargetID] );
         else
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, " %L %s", id, "WORD_AND", szItemName2 );
      }
      // We don't need the word "and"
      else
      {         
         // Then they have rings, lets print how many there are
         if (HasMoreThanOneRing && g_iShopMenuItems[iTargetID][ITEM_SLOT_TWO] == ITEM_RING)
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s x%d", szItemName2, g_iTotalRings[iTargetID] );
         else
            iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^nItem: %s", szItemName2 );
      }

   }


   // Add the Health + Armor to the message
   if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
   {
      iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^n%L: %d^n%L: %d", id, "CURRENT_HEALTH", get_user_health( iTargetID ), id, "WORD_ARMOR", get_user_armor( iTargetID ) );
   }
   
   // No armor in DOD
   else if ( g_MOD == GAME_DOD )
   {
      iMsgPos += formatex( szMsg[iMsgPos], 512-iMsgPos, "^n%L: %d", id, "CURRENT_HEALTH", get_user_health( iTargetID ) );
   }
   
   
   // Format the message
   new Float:fSpecTime = SPEC_HOLDTIME;

   if ( get_pcvar_num( CVAR_wc3_spec_position ) == 0 )
   {
      set_hudmessage( 255, 255, 255, 0.018, 0.9, 2, 1.5, fSpecTime, 0.02, 5.0, HUD_SPEC_INFO );
   }
   else
   {
      set_hudmessage( 255, 255, 255, 0.65, 0.9, 2, 1.5, fSpecTime, 0.02, 5.0, HUD_SPEC_INFO );
   }
   
   // Show the message
   show_hudmessage( id, szMsg );
}


*edited* fixed a small bug but here this should work 100%


what is the issue on the existing source tree? I thought this should work by default
No Support via PM

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Show Other Players Items

Postby whosyourdaddy » Fri Jan 02, 2009 3:10 am

urs wont show players items when some1 dead is speccing them
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3158
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: Show Other Players Items

Postby Geesu » Mon Jan 05, 2009 3:33 am

whosyourdaddy wrote:urs wont show players items when some1 dead is speccing them


But it's supposed to :( lol
No Support via PM

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Show Other Players Items

Postby whosyourdaddy » Tue Jan 06, 2009 12:55 am

ya i know i pretty much took what u did and kinda rewrote it so it would work, i think ur add string ommand isnt working correctly
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3158
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: Show Other Players Items

Postby Geesu » Tue Jan 06, 2009 4:03 pm

whosyourdaddy wrote:ya i know i pretty much took what u did and kinda rewrote it so it would work, i think ur add string ommand isnt working correctly


This on bug tracker as a problem?
No Support via PM

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Show Other Players Items

Postby whosyourdaddy » Wed Jan 07, 2009 1:08 am

i dont beleive so
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3158
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: Show Other Players Items

Postby Geesu » Wed Jan 07, 2009 11:38 am

whosyourdaddy wrote:i dont beleive so


If you add it maybe it will get fixed :P

The one time a year I actually do some updates - I only go by what is on the bug tracker
No Support via PM

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: Show Other Players Items

Postby whosyourdaddy » Wed Jan 07, 2009 6:47 pm

lol added but i got a question, why dont u ever add lol?
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3158
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: Show Other Players Items

Postby Geesu » Fri Feb 20, 2009 2:16 pm

whosyourdaddy wrote:lol added but i got a question, why dont u ever add lol?


I fix them (once a year) - I don't add them
No Support via PM


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest