12.07.2010, 02:15
ye, so i got this :
yes, its from the include folder that comes with the samp packge, added a line or to there. But you see that it says:VehiclePID. Well thats used for when ever i save a vehicle, it creates a unique id for each vehicle. it increases by 1 as you see.
Ok so, when a player enters the vehicle, i want a msg sent to him saying "vehicle ID: "HERE GOES THE VEHICLEPID" ",VehiclePID);
well ye format it first, so OnPlayerEnterVehicle,How could i get that data be sent to the player with the correct VehiclePID??
On the function i could use IsPlayerInAnyVehicle(playerid) then format it and send the VehiclePID. But i don't know if that works, or how to set it up
pawn Код:
stock LoadStaticVehiclesFromFile(const filename[])
{
new File:file_ptr,
line[256],
var_from_line[64],
vehicletype,
Float:SpawnX,
Float:SpawnY,
Float:SpawnZ,
Float:SpawnRot,
Color1,
Color2,
index,
vehicles_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr) return 0;
vehicles_loaded = 0;
VehiclePID = 0;
while(fread(file_ptr,line,256) > 0)
{
index = 0;
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
vehicletype = strval(var_from_line);
if(vehicletype < 400 || vehicletype > 611) continue;
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnX = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnY = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnZ = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnRot = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Color1 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
Color2 = strval(var_from_line);
AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ+1,SpawnRot,Color1,Color2,(30*60));
vehicles_loaded++;
VehiclePID++;
}
fclose(file_ptr);
printf("Loaded \"%d\" Vehicles From: \"%s\"",vehicles_loaded,filename);
new fstring[128];
format(fstring,sizeof(fstring),"Loaded \"%d\" From \"%s\"",vehicles_loaded,filename);
SendClientMessageToAll(LIGHTBLUE2,fstring);
return vehicles_loaded;
}
Ok so, when a player enters the vehicle, i want a msg sent to him saying "vehicle ID: "HERE GOES THE VEHICLEPID" ",VehiclePID);
well ye format it first, so OnPlayerEnterVehicle,How could i get that data be sent to the player with the correct VehiclePID??
On the function i could use IsPlayerInAnyVehicle(playerid) then format it and send the VehiclePID. But i don't know if that works, or how to set it up