String / strreplace Problem [URGENT] -
Kyle - 28.04.2010
I have this file called house1.dudb
In this file the following contains.
pawn Код:
CurrentOwner=Vacant_House
HouseName=Null_Property
ForSale=1
HouseSize=Small
CurrentPrice=2000000
PropertyTaxesPerWeek=1250
TimesPurchased=11
CarSaving=Yes
Car=545,1968.5608,-1156.5552,20.7764,273.4174,47,1,60
I want the car co ordinates to make a vehicle spawn. Here is the command.
pawn Код:
if(strcmp(cmd, "/testcar", true) == 0) {
new modelid,
Float:floatx,
Float:floaty,
Float:floatz,
Float:angle,
color1,
color2,
respawn_delay;
new housefile[100];
format(housefile,sizeof(housefile),"House9Information");
new Information = dUserINT(housefile).("Car");
format(string,sizeof(string),"%d",Information);
new sstring[sizeof(string)];
format(sstring, sizeof(sstring), "%s", string);
strreplace(",", " ", sstring);
sscanf(sstring, "dffffddd", modelid, floatx, floaty, floatz, angle, color1, color2, respawn_delay);
CreateVehicle(modelid, floatx, floaty, floatz, angle, color1, color2, respawn_delay);
printf("%d %f %f %f %f %d %d %d",modelid, floatx, floaty, floatz, angle, color1, color2, respawn_delay);
return 1;
}
It dont spawn the car, But i printed it to see what comes out and it gave me this.
[15:30:40] 545,0.000000,0.000000,0.000000,0.000000,0,0,0
Re: String / strreplace Problem [URGENT] -
Nero_3D - 28.04.2010
you could try it with only
pawn Код:
//sscanf 1
sscanf(sstring, "p,dffffddd", modelid, floatx, floaty, floatz, angle, color1, color2, respawn_delay);
//sscanf 2
sscanf(sstring, "p<,>dffffddd", modelid, floatx, floaty, floatz, angle, color1, color2, respawn_delay);
instead of
pawn Код:
strreplace(",", " ", sstring);
sscanf(sstring, "dffffddd", modelid, floatx, floaty, floatz, angle, color1, color2, respawn_delay);
Re: String / strreplace Problem [URGENT] -
Kyle - 28.04.2010
Nope the same.
Re: String / strreplace Problem [URGENT] -
dice7 - 28.04.2010
pawn Код:
new Information = dUserINT(housefile).("Car");
format(string,sizeof(string),"%d",Information);
"545,1968.5608,-1156.5552,20.7764,273.4174,47,1,60" is a string, not integer
Re: String / strreplace Problem [URGENT] -
Kyle - 28.04.2010
If i change the format to a string, Its like
[17:16:38] 0,0.000000,0.000000,0.000000,0.000000,0,0,0
Re: String / strreplace Problem [URGENT] -
dice7 - 28.04.2010
dUserINT will fetch an integer, not string
Re: String / strreplace Problem [URGENT] -
Kyle - 28.04.2010
new Information = dUserSet(housefile).("Car",Information);
error 035: argument type mismatch (argument 3)
Re: String / strreplace Problem [URGENT] -
MadeMan - 28.04.2010
pawn Код:
format(string,sizeof(string),"%s",dUser(housefile).("Car"));