player enter in Vehicle create textdraw

Started by kennedyarz, Jan 13, 2017, 01:44 AM

Previous topic - Next topic

kennedyarz

hello
How to make when a player enters a vehicle Create a Textdraw in 04rell004? And how to do that when he gets off of it. Remove the Textdraw

KAKAN

Use streams for a vehicle enter/exit event, create the textdraw then.
oh no

Anik

Server side:

function onPlayerEnterVehicle( player, vehicle, door )
{
local data = Stream();
data.StartWrite( );
data.WriteInt(1);
data.SendStream( player );
}
function onPlayerExitVehicle( player, vehicle, door )
{
local data = Stream();
data.StartWrite( );
data.WriteInt(2);
data.SendStream( player );
}

Client Side:

function Server::ServerData( stream )
{
local strint = stream.ReadInt( );

switch( strint.tointeger( ) )
{
case 1:
label <- GUILabel(VectorScreen(0,0),Colour(255,255,255),"Your text here.");
break;
case 2: label = null; break;
default: break;
}
}

jWeb

I'd suggest using an enumeration for packet IDs:
enum PacketID {
    Unknown = 0,
    // Begin IDs
    EnterVehicle,
    ExitVehicle,
    // More IDs...

    // End IDs
    Max
};

Preferably one that's shared by both the server and client. Using something such as a hard link.

vito

Quote from: jWeb on Jan 13, 2017, 09:17 AMPreferably one that's shared by both the server and client. Using something such as a hard link.
You're right, but actually it's a bit harder to control such stuff when project growing up.

kennedyarz


kennedyarz

label <- GUILabel(VectorScreen(10,290),Colour(255,255,255),"Mode: "+ GetVehicleNameFromModel( player.Vehicle.Model ) +"");

Because that does not work?

kennedyarz

#7
solved. thx @Doom_KILL3R

!

#8
@kennedyarz there is a lock button in every topic for topic starter i am just trying to tell you that lock the topics which are solved by you this will minimize the spam on forum in future.
As this topic is solved by you so click on mark topic as solved.
Note:you don't need to lock topics in off topic and some other boards.
And 1 more thing i am not insulting or spaming or something else just a request if you don't want to obey just neglect my post happily. :D
:edit:
I have posted this because most or all of your solved topics are unlocked.

Discord: zeus#5155

kennedyarz

The truth is that INI is bad. Now I do not know how to do this, can you help me?
function onPlayerEnterVehicle( player, vehicle, door )
{
local data = Stream();
data.StartWrite( );
data.WriteInt(1);
data.SendStream( player );
CheckFuel( player, vehicle, door );
local q = QuerySQL(Servidor, "SELECT * FROM Vehiculos WHERE ID='"+vehicle.ID+"'");
MessagePlayer("Model:  "+GetVehicleNameFromModel(vehicle.Model)+". ",player)
MessagePlayer(" ID: "+vehicle.ID+"",player);
MessagePlayer("Price: "  "+VehiclePrice(vehicle.Model)+".",player);
MessagePlayer("Owner :  "+GetSQLColumnData(q,10)+".",player);
}

Sqlite Database
QuerySQL( Servidor, "CREATE TABLE IF NOT EXISTS Vehiculos ( ID NUMERIC, Modelo NUMERIC, PX FLOAT, PY FLOAT, PZ FLOAT, Angulo FLOAT, Cor1 NUMERIC, Cor2 NUMERIC, Owner TEXT, Locked NUMERIC, OwnerName TEXT )" );
PRICES FOR VEHICLES:
function VehiclePrice(vehicle)
{
if(vehicle == 130) return 998000;
if(vehicle == 131) return 900000;
if(vehicle == 132) return 100000;
if(vehicle == 133) return 1300000;
if(vehicle == 134) return 1350000;
if(vehicle == 135) return 956000;
if(vehicle == 136) return 2000000;
if(vehicle == 137) return 3000000;
if(vehicle == 138) return 400000;
if(vehicle == 139) return 2200000;
if(vehicle == 140) return 500000;
if(vehicle == 141) return 2500000;
if(vehicle == 142) return 800000;
if(vehicle == 143) return 700000;
if(vehicle == 144) return 700000;
if(vehicle == 145) return 1700000;
if(vehicle == 146) return 600000;
if(vehicle == 147) return 862000;
if(vehicle == 148) return 620000;
if(vehicle == 149) return 506000;
if(vehicle == 150) return 782000;
if(vehicle == 151) return 800000;
if(vehicle == 152) return 790000;
if(vehicle == 153) return 500000;
if(vehicle == 154) return 900000;
if(vehicle == 155) return 9000000;
if(vehicle == 156) return 870000;
if(vehicle == 157) return 900000;
if(vehicle == 158) return 1000000;
if(vehicle == 159) return 980000;
if(vehicle == 160) return 999000;
if(vehicle == 161) return 510000;
if(vehicle == 162) return 9000000;
if(vehicle == 163) return 700000;
if(vehicle == 164) return 530000;
if(vehicle == 165) return 800000;
if(vehicle == 166) return 450000;
if(vehicle == 167) return 400000;
if(vehicle == 168) return 630000;
if(vehicle == 169) return 698000;
if(vehicle == 170) return 500000;
if(vehicle == 171) return 0;
if(vehicle == 172) return 710000;
if(vehicle == 173) return 770000;
if(vehicle == 174) return 890000;
if(vehicle == 175) return 600000;
if(vehicle == 176) return 1000000;
if(vehicle == 177) return 9000000;
if(vehicle == 178) return 200000;
if(vehicle == 179) return 580000;
if(vehicle == 183) return 300000;
if(vehicle == 184) return 400000;
if(vehicle == 185) return 500000;
if(vehicle == 186) return 500000;
if(vehicle == 187) return 50000;
if(vehicle == 188) return 460000;
if(vehicle == 189) return 500000;
if(vehicle == 190) return 890000;
if(vehicle == 191) return 909000;
if(vehicle == 192) return 300000;
if(vehicle == 193) return 400000;
if(vehicle == 194) return 0;
if(vehicle == 195) return 0;
if(vehicle == 196) return 400000;
if(vehicle == 197) return 420000;
if(vehicle == 198) return 500000;
if(vehicle == 199) return 1000000;
if(vehicle == 200) return 800000;
if(vehicle == 201) return 1500000;
if(vehicle == 202) return 400000;
if(vehicle == 203) return 120000;
if(vehicle == 204) return 350000;
if(vehicle == 205) return 500000;
if(vehicle == 206) return 1000000;
if(vehicle == 207) return 700000;
if(vehicle == 208) return 250000;
if(vehicle == 209) return 300000;
if(vehicle == 210) return 260000;
if(vehicle == 211) return 1000000;
if(vehicle == 212) return 730000;
if(vehicle == 213) return 670000;
if(vehicle == 214) return 500000;
if(vehicle == 215) return 100000;
if(vehicle == 216) return 300000;
if(vehicle == 217) return 900000;
if(vehicle == 218) return 800000;
if(vehicle == 219) return 500000;
if(vehicle == 220) return 700000;
if(vehicle == 221) return 500000;
if(vehicle == 222) return 480000;
if(vehicle == 223) return 800000;
if(vehicle == 224) return 9000000;
if(vehicle == 225) return 1200000;
if(vehicle == 226) return 400000;
if(vehicle == 227) return 800000;
if(vehicle == 228) return 500000;
if(vehicle == 229) return 450000;
if(vehicle == 230) return 300000;
if(vehicle == 231) return 0;
if(vehicle == 232) return 9000000;
if(vehicle == 233) return 9000000;
if(vehicle == 234) return 900000;
if(vehicle == 235) return 900000;
if(vehicle == 236) return 1000000;
}

function onPlayerExitVehicle( player, vehicle )
{
 local data = Stream();
 data.StartWrite( );
 data.WriteInt(2);
 data.SendStream( player );
 Announce( "", player, 5 );
}

// Client-side
function Server::ServerData( stream )
{
 local strint = stream.ReadInt( );
 
 switch( strint.tointeger( ) )
 {
  case 1:
  label <- GUILabel(VectorScreen(850,390),Colour(255,255,255),"Model:");
  label2 <- GUILabel(VectorScreen(850,405),Colour(255,255,255),"Owner:");
  label3 <- GUILabel(VectorScreen(850,420),Colour(255,255,255),"Price:");
  label4 <- GUILabel(VectorScreen(850,435),Colour(255,255,255),"Id:");
  break;
  case 2:
    label <- GUILabel(VectorScreen(10,300),Colour(255,255,100),"");
    label2 <- GUILabel(VectorScreen(10,300),Colour(255,255,100),"");
    label3 <- GUILabel(VectorScreen(10,300),Colour(255,255,100),"");
    label4 <- GUILabel(VectorScreen(10,300),Colour(255,255,100),"");
  break;
  default: break;
 }
}

kennedyarz