i need to create a database,use Lapper.lpr. it's possible or just only change code and compile?
This can go in the OnConnect or OnConnectClose event:
### Get UserName and search in storedvalue.dbs for saved values for this user ###
$userName = GetCurrentPlayerVar( "UserName" );
SetCurrentPlayerVar( "total",GetStoredValue( $userName . "total" ) );
### End ###
If the value would be empty (because someone is new on your server, you can check if it is and give it a default value:
### Set default values if no values are loaded ###
IF ( GetCurrentPlayerVar( "config_pb_display_gui" ) == "")
THEN
SetCurrentPlayerVar( "total",0 ); # Set default value to 0
ENDIF
### End ###
This should go in a seperate event to save the value or values back to the database:
$userName = GetCurrentPlayerVar( "UserName" );
SetStoredValue( $userName . "total", GetCurrentPlayerVar( "total" ) );
setCurrentPlayerVar( "recomended",GetStoredValue( GetCurrentPlayerVar( "UserName" ) . "recomended" ) );
CASE "!drf":
globalMsg(GetStoredValue( GetCurrentPlayerVar( "UserName" ) . "recomended" ));
$userName = GetCurrentPlayerVar( "UserName" );
SetStoredValue( $userName . "recomended", GetCurrentPlayerVar( "recomended" ) );
Sub YellowLight()
startlightcontrol(5,149,10,2); #Yellow Startlight, Lightindentifier = 10
HostDelayedCommand( 2, OpenGate); #Go to Open Gate sub after 2 seconds
EndSub
Event OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
CASE "!1":
IF ( UserIsAdmin( $userName ) == 1 )
THEN
startlightcontrol (5,149,1,1);
HostDelayedCommand( 3,cl);
ENDIF
BREAK;
ENDSWITCH
EndEvent
Sub cl()
openGlobalButton( "winner_title",78,137,63,19,4,3,3,"READY ");
startlightcontrol (5,149,1,2);
HostDelayedCommand( 3,cl2);
EndSub
Sub cl2()
openGlobalButton( "winner_title2",78,137,63,19,4,3,3,"GO ");
startlightcontrol(5,149,1,8);
EndSub
PrivDelayedCommand();
Sub cl($keyflags)
Endsub
Sub cl2($keyflags)
EndSub