Getting a vehicle color is not working D:
#1

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.
Reply
#2

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
Reply
#3

Erm..what do you mean?
I want to save the vehicle's positions not to create one
Reply
#4

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);
Reply
#5

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)