Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Client
- */
- function Script::ScriptLoad()
- {
- ::GUI_VEHICLE <-
- {
- ID = GUILabel( VectorScreen( 500, 500 ), Colour( 255, 255, 255 ) ),
- HP = GUILabel( VectorScreen( 600, 500 ), Colour( 255, 255, 255 ) )
- }
- ::GUI_VEHICLE[ "ID" ].FontName = "Verdana";
- ::GUI_VEHICLE[ "ID" ].RemoveFlags( GUI_FLAG_VISIBLE );
- ::GUI_VEHICLE[ "HP" ].FontName = "Verdana";
- ::GUI_VEHICLE[ "HP" ].RemoveFlags( GUI_FLAG_VISIBLE );
- }
- function Server::ServerData( stream )
- {
- local intStream = stream.ReadInt();
- if ( intStream == 1 )
- {
- ::GUI_VEHICLE[ "ID" ].AddFlags( GUI_FLAG_VISIBLE );
- ::GUI_VEHICLE[ "HP" ].AddFlags( GUI_FLAG_VISIBLE );
- local txt_split = split( stream.ReadString(), "\n" );
- ::GUI_VEHICLE[ "ID" ].Text = txt_split[0];
- ::GUI_VEHICLE[ "HP" ].Text = txt_split[1];
- }
- else if ( intStream == 2 )
- {
- ::GUI_VEHICLE[ "ID" ].RemoveFlags( GUI_FLAG_VISIBLE );
- ::GUI_VEHICLE[ "HP" ].RemoveFlags( GUI_FLAG_VISIBLE );
- }
- }
- /*
- Server
- */
- function onPlayerEnterVehicle( player, vehicle, door )
- {
- pVehicle <- NewTimer( "getVehicleInfo", 1000, 0, player.ID );
- }
- function onPlayerExitVehicle( player, vehicle )
- {
- pVehicle.Delete();
- local Stream = Stream();
- Stream.StartWrite();
- Stream.WriteInt( 2 );
- Stream.SendStream( player );
- }
- function getVehicleInfo( id )
- {
- local player = FindPlayer( id );
- if ( player )
- {
- local Stream = Stream();
- Stream.StartWrite();
- Stream.WriteInt( 1 );
- Stream.WriteString( player.Vehicle.ID + "\n" + player.Vehicle.Health );
- Stream.SendStream( player );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment