Getting a vehicle color is not working D: - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Getting a vehicle color is not working D: (
/showthread.php?tid=152287)
Getting a vehicle color is not working D: -
[XST]O_x - 03.06.2010
Hey guys,I have a problem,I'm currently using the include by Martin_M(GetVehicleColor1 and GetVehicleColor2)well here is the code:
pawn Код:
if(strcmp(cmdtext, "/savethepos", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new File:saved = fopen("saved.txt", io_append);
new str[72],n[34];
new v,m,Float:x,Float:y,Float:z,Float:a,c1,c2;
v = GetPlayerVehicleID(playerid);
m = GetVehicleModel(v);
c1 = GetVehicleColor1(v);
c2 = GetVehicleColor2(v);
GetPlayerName(playerid,n,sizeof(n));
GetVehiclePos(v,x,y,z);
GetPlayerFacingAngle(playerid,a);
format(str,340,"%s saved : AddStaticVehicle(%d,%f,%f,%f,%f,%d,%d);\r\n",n,m,x,y,z,a,c1,c2);
fwrite(saved,str);
fclose(saved);
SendClientMessage(playerid,COLOR_ORANGE,"You have saved your vehicle positions.");
}
It saves everything correctly but the colors. It only shows 0,0 at the file.
Any help please?
Thanks in advance.
Re: Getting a vehicle color is not working D: -
NewTorran - 03.06.2010
Quote:
Originally Posted by O_x
Hey guys,I have a problem,I'm currently using the include by Martin_M(GetVehicleColor1 and GetVehicleColor2)well here is the code:
pawn Код:
if(strcmp(cmdtext, "/savethepos", true) == 0) { if(IsPlayerInAnyVehicle(playerid)) { new File:saved = fopen("saved.txt", io_append); new str[72],n[34]; new v,m,Float:x,Float:y,Float:z,Float:a,c1,c2; v = GetPlayerVehicleID(playerid); m = GetVehicleModel(v); c1 = GetVehicleColor1(v); c2 = GetVehicleColor2(v); GetPlayerName(playerid,n,sizeof(n)); GetVehiclePos(v,x,y,z); GetPlayerFacingAngle(playerid,a); format(str,340,"%s saved : AddStaticVehicle(%d,%f,%f,%f,%f,%d,%d);\r\n",n,m,x,y,z,a,c1,c2); fwrite(saved,str); fclose(saved); SendClientMessage(playerid,COLOR_ORANGE,"You have saved your vehicle positions."); }
It saves everything correctly but the colors. It only shows 0,0 at the file.
Any help please?
Thanks in advance.
|
You need to use the function that creates the vehicle. I forgot its exact name,
If you open up the .inc you will find it
Re: Getting a vehicle color is not working D: -
[XST]O_x - 03.06.2010
Erm..what do you mean?
I want to save the vehicle's positions not to create one
Re: Getting a vehicle color is not working D: -
NewTorran - 03.06.2010
Quote:
Originally Posted by O_x
Erm..what do you mean?
I want to save the vehicle's positions not to create one
|
In order to use GetVehicleColor1 and 2 from that include you need to use the function he included to create the vehicle.
So you will need to create all your vehicles using
pawn Код:
CreateStaticVehicle(modelID,Float:X,Float:Y,Float:Z,Float:FacingAngle,colorID1,colorID2);
Re: Getting a vehicle color is not working D: -
[XST]O_x - 03.06.2010
Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by O_x
Erm..what do you mean?
I want to save the vehicle's positions not to create one
|
In order to use GetVehicleColor1 and 2 from that include you need to use the function he included to create the vehicle.
So you will need to create all your vehicles using
pawn Код:
CreateStaticVehicle(modelID,Float:X,Float:Y,Float:Z,Float:FacingAngle,colorID1,colorID2);
|
Ow,now i get you.
Thanks!
EDIT: Oh my god,i did,no errors while compiling but now when I type /savethepos It's just crashing my samp-server.exe. WTF?