View Single Post
BenSib
Senior Member
Join Date: Aug 2008
Old 09-29-2008 , 18:08   Re: SteamID and Username of Allies alive
Reply With Quote #12

That should do it:

PHP Code:
public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
 
// create local string that we will add all survivors info to!
 
new String:survivornames[512]
 
 
// format the string so the hintmessage has the desired headline
 
Format(survivornamessizeof(survivornames), "Winners of the Medal of Honour:\n")
 
 
// now we go through all players
 
for(new 1GetMaxClients(); i++)
 {
  
// we're only looking for connected and alive players
  
if(IsClientInGame(i) && IsPlayerAlive(i))
  {
   
// we're only looking for U.S. Army
   
if(GetClientTeam(i) == ALLIES)
   {
    
//we found an allied player that's alive on roundend!
    
    // create strings for name and steamid
    
decl String:pl_steamid[32], String:pl_username[MAX_NAME_LENGTH]
    
    
// get player's name
    
GetClientName(ipl_usernamesizeof(pl_username))
    
    
// get player's steamid
    
GetClientAuthString(ipl_steamidsizeof(pl_steamid))
    
    
// create local string for survivor info
    
decl String:SurvivorInfo[64]
    
    
// merge playername and steamid into one string
    
Format(SurvivorInfosizeof(SurvivorInfo), "\n%s (%s)"pl_usernamepl_steamid)
    
    
// add info of this player to the string:
    
StrCat(survivornamessizeof(survivornames), SurvivorInfo)
   }
  }
 }
 
// display the hintmessage with all info we collected
  
SendPanelToAll(survivornames)
 return 
Plugin_Continue

 
// adds a line to a txt file called roundend.txt in addons/sourcemod/medals folder
        
new Handle:file OpenFile("roundend.txt""/addons/sourcemod/medals")
        if(
file != INVALID_HANDLE
            {
            
WriteFileLine(file,survivornames)
            
CloseHandle(file
            }



but nothing is written ...
BenSib is offline