CatchEvent OnLapperStart()
# Some functions ... #
RegisterScheduleAction( "* * * * * * *", Second_Timer ); # Execute every second.
EndCatchEvent
Sub Second_Timer() # Timer #
writeline( "RSB_Time timer " . GetLapperVar( "longtime" ) );
$mList = GetListOfPlayers();
$mListCount = arrayCount( $mList ); # Reports as 0 entries.
writeline( "RSB_Time $mList: " . $mListCount . " entries: " . $mList[0] . ", " . $mList[1] . "." );
FOREACH ( $maVar IN $mList )
writeline( "RSB_Time FOREACH" );
IF ( GetPlayerVar( $maVar["value"] , "UserName" ) != "" ) # Not Host #
THEN
# DO SOMETHING #
writeline( "RSB_Time Username exists" );
IF ( GetPlayerVar( $maVar["value"] , "Delivery" ) != "" )
THEN
$distance = ToNum( trackuserdistance( GetPlayerVar( $maVar["value"] , "Delivery" ) , $maVar["value"] ));
IF ( $distance < 5 )
THEN
SetPlayerVar( $maVar["value"] , "DeliveryTick" , ToNum( GetPlayerVar( $maVar["value"] , "DeliveryTick" ) + 1 ) );
$TickCount = ToNum(GetPlayerVar( $maVar["value"] , "DeliveryTick" ));
IF ( $TickCount >= 3 )
THEN
SetPlayerVar( $maVar["value"] , "DeliveryStatus" , "1" );
$DeliverToUserID = GetPlayerVar( GetPlayerVar( $maVar["value"] , "Delivery" ) , "UserID" ); #Get Receiving Player UCID.
FOREACH ( $CompanyArray IN $Companies )
$OrderVar = ToString( "UserName_Order_" . $CompanyArray["value"] . "_" . $DeliverToUserID );
$OrderCompany = ToString( $CompanyArray["value"] );
IF ( GetStoredValue( $OrderVar ) != "" )
THEN
$DeliverToNickName = GetPlayerVar( GetStoredValue( "UserName_Number_" . $DeliverToUserID ) , "NickName" );
PrivMsg( $maVar["value"] , "^7You have ^2successfully delivered ^7to " . $DeliverToNickName );
Delivery_Order_Delivered( $OrderCompany , $DeliverToUserID );
ENDIF
ENDFOREACH
ENDIF
ENDIF
ENDIF
ENDIF
ENDFOREACH
EndSub
[b]CatchEvent OnConnect ( $userName )[/b]
....does some stuff....
IF ( GetStoredValue( "REGISTER_COUNTER" ) == "" )
... # see my previous post for whole section of relevant code # ....
ENDFOR
... some other stuff ...
EndCatchEvent
IF ( GetStoredValue( "UserName_Number_" . $i ) != "" )
THEN
IF ( GetPlayerVar( GetStoredValue( "UserName_Number_" . $i ), "NickName" ) == "" ) # Offline
THEN
# distribute dividend by set/getuserstoredvalue. #
ELSE
IF ( GetPlayerVar( GetStoredValue( "UserName_Number_" . $i ), "NickName" ) != "" ) # Online
THEN # distribute dividend normally by set/getplayervar. #
ENDIF
ENDIF
ENDIF
Sub < this sub >
$mList = [b]< Get List of All Players' "UserNames" from storedvalue.dbs >[/b] ;
FOREACH ( $maVar IN $mList )
IF ( <they are online, their nickname != "" > )
THEN
# Distribute moneys #
SetPlayerVar( $maVar["value"] , "<var>" , <change> );
ELSE
# Rest aren't online, so distribute moneys to remaining (offline) players too #
SetUserStoredValue( $maVar["value"] , "<var>" , <change> );
ENDIF
ENDFOREACH
EndSub
<?php
Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex) # Player event
$dateracestarted = GetLapperVar("dateracestarted"); #Get date and time when the race has been started.
privmsg("Race Start: ".$dateracestarted);
privmsg("Driver: ".getplayervar($userName,"NickName"));
privmsg($Object." sector split: ".$Time);
$racetime = GetLapperVar("racetime"); # Elapsed racetime (in Milliseconds) after the race has been started
privmsg("Racetime: ".(NumToMSH($racetime)));
$elapsedms = GetLapperVar("elapsedms"); # Elapsed racetime (in Milliseconds) after the race has been started
privmsg("Elapsed Milliseconds: ".(NumToMSH($elapsedms)));
$elapsedsecs = GetLapperVar("elapsedsecs"); # Elapsed racetime (in Seconds) after the race has been started
privmsg("Elapsed Seconds: ".(NumToMSH($elapsedsecs)));
$elapsedmins = GetLapperVar("elapsedmins"); #Elapsed racetime (in Minutes) after the race has been started
privmsg("Elapsed Minutes: ".(NumToMSH($elapsedmins)));
EndEvent
?>
<?php
Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex) # Player event
privmsg(getplayervar($userName,"NickName"));
privmsg("Action: ".$Flags);
privmsg("Time: ".$Time);
privmsg("Object: ".$Object);
privmsg("CircleIndex: ".$CircleIndex);
privmsg("Speed: ".$UserSpeed." ".getplayervar($userName,"UnitSpeed"));
EndEvent
?>