String / strreplace Problem [URGENT]
#1

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

Reply
#2

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

Nope the same.
Reply
#4

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

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

dUserINT will fetch an integer, not string
Reply
#7

new Information = dUserSet(housefile).("Car",Information);
error 035: argument type mismatch (argument 3)
Reply
#8

pawn Код:
format(string,sizeof(string),"%s",dUser(housefile).("Car"));
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)