INI_String
#1

Hi, guys
I would like corrected this error in this code:
PHP код:
if(strcmp(INI_String(s,"Owner"),"none",true) == 0){ 
Errors:
PHP код:
error 029invalid expressionassumed zero
error 017
undefined symbol "name"
error 001expected token";"but found "return"
fatal error 107too many error messages on one line 
Reply
#2

Is "name" defined?

Try this:
PHP код:
if(strcmp(INI_String(s,"Owner"),"none",true) == 0);{ 
Reply
#3

What you try to do with that code? Ini File does not work there.

PHP код:
INI_String(name[], dest[], size
Reply
#4

Anyways it says that there are Errors on 4 diffrent lines and you just sent us one or am i wrong?
Reply
#5

PHP код:
new sx[100];
    if(
strcmp(INI_String(s,"Owner"),"none",true) == 0){
    
format(HouseInfo[HouseCount][Vlastnik],MAX_PLAYER_NAME,"Nikto");
    
HouseInfo[HouseCount][Zamek] = 0;
    
HouseInfo[HouseCount][Pickup] = CreatePickup(1273,1,pXpYpZ);
    
format(sx,100,"Dom č.%d\r\nMajiteľ: Nikto\r\nCena: %d",HouseCount,Cenik);
    
HouseInfo[HouseCount][Text] = Create3DTextLabel(sx,0xFF0000FF,pX,pY,pZ+1,50,0);
    }else{
    
HouseInfo[HouseCount][Pickup] = CreatePickup(1272,1,pXpYpZ);
    
format(HouseInfo[HouseCount][Vlastnik],MAX_PLAYER_NAME,"%s",dini_Get(s,"Owner"));
    
HouseInfo[HouseCount][Zamek] = dini_Int(s,"Locked");
    if(
dini_Int(s,"Auto") == 1){
    
HouseInfo[HouseCount][Color1]=dini_Int(s,"Color1");
    
HouseInfo[HouseCount][Color2]=dini_Int(s,"Color2");
    
HouseInfo[HouseCount][Paintjob]=dini_Int(s,"Paintjob");
    
HouseInfo[HouseCount][Vmod][0]=dini_Int(s,"Tuning1");
    
HouseInfo[HouseCount][Vmod][1]=dini_Int(s,"Tuning2");
    
HouseInfo[HouseCount][Vmod][2]=dini_Int(s,"Tuning3");
    
HouseInfo[HouseCount][Vmod][3]=dini_Int(s,"Tuning4");
    
HouseInfo[HouseCount][Vmod][4]=dini_Int(s,"Tuning5");
    
HouseInfo[HouseCount][Vmod][5]=dini_Int(s,"Tuning6");
    
HouseInfo[HouseCount][Vmod][6]=dini_Int(s,"Tuning7");
    
HouseInfo[HouseCount][Vmod][7]=dini_Int(s,"Tuning8");
    
HouseInfo[HouseCount][Vmod][8]=dini_Int(s,"Tuning9");
    
HouseInfo[HouseCount][Vmod][9]=dini_Int(s,"Tuning10");
    
HouseInfo[HouseCount][Vmod][10]=dini_Int(s,"Tuning11");
    
HouseInfo[HouseCount][Vmod][11]=dini_Int(s,"Tuning12");
    
HouseInfo[HouseCount][Vmod][12]=dini_Int(s,"Tuning13");
    
HouseInfo[HouseCount][Vmod][13]=dini_Int(s,"Tuning14");
    
HouseInfo[HouseCount][Vmod][14]=dini_Int(s,"Tuning15");
    
HouseInfo[HouseCount][Vmod][15]=dini_Int(s,"Tuning16");
    
HouseInfo[HouseCount][Vmod][16]=dini_Int(s,"Tuning17");
    
HouseInfo[HouseCount][Vehicle] = CreateVehicle(dini_Int(s,"Vehicle"),vX,vY,vZ,vA,HouseInfo[HouseCount][Color1],HouseInfo[HouseCount][Color2],-1);
    
TuneThisCar(HouseCount,HouseInfo[HouseCount][Vehicle]);
    
printf("=====================\r\n%d",HouseInfo[HouseCount][Vehicle]);
    }
    
format(sx,100,"Dom č.%d\r\nMajiteľ: %s",HouseCount,dini_Get(s,"Owner"));
    
HouseInfo[HouseCount][Text] = Create3DTextLabel(sx,0xFF0000FF,pX,pY,pZ+1,50,0);
    } 
Original code in dini.
I have to give you the whole script....?
Reply
#6

Help me please
Reply
#7

You'd normally have to read those sorts of thing somewhere else an assign them when using something like Y_INI, as the syntax, as said before, is:

Код:
INI_String(name[], dest[], size)
In most cases, you'd do a file parse with Y_INI, resulting in something like this for vehicles....

Код:
stock vLoad(vehID, file[])
{
	INI_ParseFile(file,"LoadVehicleData", .bExtra = true, .extra = vehID);
	CreateOwnedVeh(vData[vehID][vModel],vData[vehID][vPos][0],vData[vehID][vPos][1],vData[vehID][vPos][2],vData[vehID][vPos][3],vData[vehID][vCol1],vData[vehID][vCol2],vData[vehID][vOwner]);
}

forward LoadVehicleData(vehID, name[], value[]);
public LoadVehicleData(vehID, name[], value[])
{
	INI_Int("Model",vData[vehID][vModel]);
	for(new i = 0; i < 4; i++) {
		format(strLoc,sizeof(strLoc),"Pos%d",i);
		INI_Float(strLoc,vData[vehID][vPos][i]); }
	INI_Int("Color1",vData[vehID][vCol1]);
	INI_Int("Color2",vData[vehID][vCol2]);
	INI_String("Owner",vData[vehID][vOwner],24);
 	INI_Int("Lockstate", vData[vehID][vLocked]);
	return 1;
}
That assigns the ini file's contents to variables, then you can use strcmp to compare those variables safely.

This is, however, assuming that you are using Y_INI.

I couldn't even remotely help you with dini, except from offering the advice of attempting to move to YINI, but it should be somewhat similar, lol.
Reply
#8

But I want to fix the from dini to y_ini as I wrote
That what you wrote I do not understand well
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)