10.04.2012, 13:30
Well,my vehicle system is almost done,but I am ecountering a problem,and the problem is the following:this is how the database looks:
Nice,no?xD.Well,I also have a park command,and when I use the park command instead of replacing the lines,it creates them again,but of course with the new variables coordinates,but,my house system is the same,and works fine(the lines are replaced),yet in vehicle system,the park command seems to be creating the lines again.I am using ZCMD,and here's the park command:
Код:
[VehiclesDB-Owner:[LSCS]Eddie] CarName = Turismo Type = 451 PosX = -1974.011596 PosY = 300.193389 PosZ = 34.972499 ZAngle = 45.000000 Color1 = 0 Color2 = 0 Health = 1000.000000
pawn Код:
COMMAND:park(playerid,params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"This command must be used on a car owned by you!");
else
{
new vehicle=GetPlayerVehicleID(playerid);
if(VehInfo[vehicle][Owner][0]!=0)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
if(!strcmp(pName,VehInfo[vehicle][Owner][0]))
{
new Float:x,Float:y,Float:z,Float:zangle,Float:health;
new color1,color2;
GetVehiclePos(vehicle,x,y,z);
GetVehicleZAngle(vehicle,zangle);
GetVehicleColor(vehicle,color1,color2);
GetVehicleHealth(vehicle,health);
VehInfo[vehicle][ParkPos][0]=x;
VehInfo[vehicle][ParkPos][1]=y;
VehInfo[vehicle][ParkPos][2]=z;
VehInfo[vehicle][vAngle]=zangle;
VehInfo[vehicle][vColor1]=color1;
VehInfo[vehicle][vColor2]=color2;
VehInfo[vehicle][vHealth]=health;
VehInfo[vehicle][vType]=GetVehicleModel(vehicle);
format(VehInfo[vehicle][Owner],24,"%s",pName);
new string[128];
format(string,sizeof(string),"VehiclesDB-Owner:%s",VehInfo[vehicle][Owner]);
new INI:vFile = INI_Open(VehiclesDB(playerid));
INI_SetTag(vFile,string);
INI_WriteString(vFile,"CarName",VehInfo[vehicle][VehicleName]);
INI_WriteFloat(vFile,"Type",VehInfo[vehicle][vType]);
INI_WriteFloat(vFile,"PosX",VehInfo[vehicle][ParkPos][0]);
INI_WriteFloat(vFile,"PosY",VehInfo[vehicle][ParkPos][1]);
INI_WriteFloat(vFile,"PosZ",VehInfo[vehicle][ParkPos][2]);
INI_WriteFloat(vFile,"ZAngle",VehInfo[vehicle][vAngle]);
INI_WriteInt(vFile,"Color1",VehInfo[vehicle][vColor1]);
INI_WriteInt(vFile,"Color2",VehInfo[vehicle][vColor2]);
INI_WriteFloat(vFile,"Health",VehInfo[vehicle][vHealth]);
INI_Close(vFile);
SendClientMessage(playerid,COLOR_GREEN,"You have parked your car!");
SetVehicleParamsEx(vehicle,0,0,0,0,0,0,0);
}
else{SendClientMessage(playerid,COLOR_RED,"This car is not owned by you!");RemovePlayerFromVehicle(playerid);}
}
else SendClientMessage(playerid,COLOR_RED,"This is a civilian car!");
}
return 1;
}