############################################################################# # LFS Lapper Who by Krayy ############################################################################# # This is a more informative command to display current players, PBs and # a pit summary. ############################################################################# # Ver 1.0.1 11-08-09 Initial release ############################################################################# Sub DoWho ( ) ### Set initial values for left/right and top/bottom coordinates ### $topleft_x = 45; $topleft_y = 30; $NumConns = GetLapperVar("numconns"); # Set the dialog background IF ( $NumConns < 15 ) THEN $bgheight = 100; ELSE $bgheight = ($NumConns * 5) + 12; ENDIF openPrivButton( "dowho_bg",$topleft_x,$topleft_y,110,$bgheight,1,-1,32,""); # Set the header row and display different info for Admins vs Players # IF ( UserIsAdmin( GetCurrentPlayerVar("UserName") ) == 1 ) # THEN openPrivButton ("dowho_nick",$topleft_x+1,$topleft_y+1,27,5,1,-1,96,"Nickname"); openPrivButton ("dowho_user",$topleft_x+28,$topleft_y+1,25,5,1,-1,96,"Username"); # ELSE # openPrivButton ("dowho_nick",$topleft_x+1,$topleft_y+1,52,5,1,-1,96,"Nickname"); # ENDIF openPrivButton ("dowho_car",$topleft_x+53,$topleft_y+1,5,5,1,-1,32,"Car"); openPrivButton ("dowho_pb",$topleft_x+58,$topleft_y+1,12,5,1,-1,32,"PB Time"); openPrivButton ("dowho_pitnum",$topleft_x+70,$topleft_y+1,4,5,1,-1,32,"Pit"); openPrivButton ("dowho_pittime",$topleft_x+74,$topleft_y+1,12,5,1,-1,32,"Pit Time"); openPrivButton ("dowho_reset",$topleft_x+86,$topleft_y+1,8,5,1,-1,32,"Resets"); openPrivButton ("dowho_penalty",$topleft_x+94,$topleft_y+1,5,5,1,-1,32,"Pen"); openPrivButton ("dowho_pm",$topleft_x+99,$topleft_y+1,10,5,1,-1,32,"^7PMsg"); FOR ($i=1;$i<=32;$i=$i+1) IF ($RacerArray[$i,$raUserName] != "") THEN $uName = $RacerArray[$i,$raUserName]; # Increase $topleft_y by 5 before drawing next row $topleft_y=$topleft_y+5; # IF ( UserIsAdmin( GetCurrentPlayerVar("UserName") ) == 1 ) # THEN openPrivButton ("dowho_".$i."_nickname",$topleft_x+1,$topleft_y+1,27,5,5,-1,81,$RacerArray[$i,$raNickName]); openPrivButton ("dowho_".$i."_username",$topleft_x+28,$topleft_y+1,25,5,5,-1,81,$uName); # ELSE # openPrivButton ("dowho_".$i."_nickname",$topleft_x+1,$topleft_y+1,52,5,5,-1,81,$RacerArray[$i,$raNickName]); # ENDIF openPrivButton ("dowho_".$i."_car",$topleft_x+53,$topleft_y+1,5,5,1,-1,17,GetPlayerVar($uName, "Car" )); openPrivButton ("dowho_".$i."_pb",$topleft_x+58,$topleft_y+1,12,5,1,-1,17,NumToMSH( GetPlayerVar($uName,"pblaptime"))); openPrivButton ("dowho_".$i."_pitnum",$topleft_x+70,$topleft_y+1,4,5,1,-1,17,GetPlayerVar($uName,"pitStops")); openPrivButton ("dowho_".$i."_pittime",$topleft_x+74,$topleft_y+1,12,5,1,-1,17,NumToMSH( GetPlayerVar($uName,"TotalPitTime"))); openPrivButton ("dowho_".$i."_reset",$topleft_x+86,$topleft_y+1,8,5,1,-1,17,GetPlayerVar($uName, "NumCarResets" )); openPrivButton ("dowho_".$i."_penalty",$topleft_x+94,$topleft_y+1,5,5,1,-1,17,$penalty_shortnames[GetPlayerVar($uName, "penaltynew")]); openPrivButton ("dowho_".$i."_pm",$topleft_x+99,$topleft_y+1,10,5,1,-1,17,"^7Send",DoPmCompose); ELSE closePrivButton ("dowho_".$i."_car&dowho_".$i."_nickname&dowho_".$i."_pb&dowho_".$i."_penalty&dowho_".$i."_pitnum&dowho_".$i."_pittime&dowho_".$i."_reset&dowho_".$i."_username"); ENDIF ENDFOR openPrivButton( "click_refresh",75,$bgheight+$topleft_y+1,20,10,10,10,32,"^3Refresh (%cpt%)",DoWho_refresh ); openPrivButton( "click_close",105,$bgheight+$topleft_y+1,20,10,10,-1,32,"^3Close",DoWho_close ); EndSub Sub DoWho_refresh ( $KeyFlags, $id ) DoWho(); EndSub Sub DoWho_close ( $KeyFlags, $id ) closePrivButton ("dowho_bg&click_refresh&click_close&dowho_car&dowho_nick&dowho_pb&dowho_penalty&dowho_pitnum&dowho_pittime&dowho_reset&dowho_user&dowho_pm"); FOR ($i=1;$i<=32;$i=$i+1) closePrivButton ("dowho_".$i."_car&dowho_".$i."_nickname&dowho_".$i."_pb&dowho_".$i."_penalty&dowho_".$i."_pitnum&dowho_".$i."_pittime&dowho_".$i."_reset&dowho_".$i."_username&dowho_".$i."_pm"); ENDFOR EndSub Sub DoPmCompose ( $KeyFlags,$id ) DoWho_close(0,0); IF ($id != "0") THEN $uName = $RacerArray[ToNum(split( $id,"_",1 )),$raUserName]; $nName = $RacerArray[ToNum(split( $id,"_",1 )),$raNickName]; SetStoredUserVar( "pm_send_uname", $uName); openPrivButton( "dopm_bg",60,45,80,30,1,-1,32,""); openPrivButton ("dopm_username",61,46,78,10,5,-1,81,"^7Message to: " . $nName); openPrivTextButton( "dopm_message",61,56,78,8,5,80,"^3Type message (up to 50 chars)","^3Click here to edit message",50,pm_text_input ); openPrivButton( "dopm_cancel",75,65,20,9,10,-1,32,"^3Cancel",DoPm_Close ); openPrivButton( "dopm_send",105,65,20,9,10,-1,32,"^3Send",DoPm_Send ); ENDIF EndSub Sub pm_text_input ( $pm_text_input ) $uName = GetStoredUserStr( "pm_send_uname"); SetStoredUserVar( "pm_send_message", $pm_text_input); TextPrivButton( "dopm_message","^2" . $pm_text_input ); EndSub Sub DoPm_Send ( $KeyFlags,$id ) DoPm_Close(0,0); $uName = GetStoredUserStr( "pm_send_uname"); $msg = GetStoredUserStr( "pm_send_message"); userMsg (GetCurrentPlayerVar( "Nickname" ), $uName, $msg); EndSub Sub DoPm_Close ( $KeyFlags, $id ) closePrivButton ("dopm_bg&dopm_username&dopm_message&dopm_cancel&dopm_send"); EndSub