ini file won't be created
#1

As title says, ini files aren't created when they are supposed to,
here's the code
PHP код:
CMD:makeevm(playerid,params[]){
    new 
str1[75],ID;
    if(!
IsPlayerConnected(playerid)) return SendClientMessage(playerid0xFF000088"[ERROR]: You are not connected to the server");
    if(
IsPlayerAdmin(playerid)){
        if(!
IsPlayerInAnyVehicle(playerid)){
            if(
sscanf(params"i",ID)) return SendClientMessage(playerid0xFFFFFF"[USAGE]: /makeevm (ID)");
            if(
fexist(EVMPath(ID))) return SendClientMessage(playeridRed"[ERROR]: That slot is used, clear it using /deleteevm or chose another vailable slot via /evmstats");
            if(
ID >= MAX_EVM || ID 0) return SendClientMessage(playerid0xFFFFFF"[ERROR]: Invalid ID");
            
evmid ID;
            
GetPlayerPos(playeridEVMData[ID][PosX], EVMData[ID][PosY], EVMData[ID][PosZ]);
            
gEVM[ID] = CreateDynamicObject(18885EVMData[ID][PosX]+1EVMData[ID][PosY], EVMData[ID][PosZ], 0.00.00.0, -1, -1, -1115100);
            
EditDynamicObject(playeridgEVM[ID]);
            
format(str1sizeof(str1), "[EO_EVM]: {FFFFFF}Explosives Vending Machine successfully created! ID:%i",ID);
            
SendClientMessage(playerid0xFFFF00str1);
            
printf("Administrator %s Created a new EVM, ID: %i"GetName(playerid), ID);
            
EVMData[ID][EVMBlocked] = 0;
            return 
1;
        }
        else{
            
SendClientMessage(playerid0xFF0000"[ERROR]: You can't use this while in a vehicle");
        }
    }
    else{
        
SendClientMessage(playerid0xFF0000AA"[ERROR]: You can't use this command");
    }
    return 
1;
}
public 
OnPlayerEditObject(playeridplayerobjectobjectidresponseFloat:fXFloat:fYFloat:fZFloat:fRotXFloat:fRotYFloat:fRotZ)
{
    new 
str[85];
    if(
response == EDIT_RESPONSE_FINAL)
    {
        
format(strsizeof(str), "Explosive Vending Machine\nEVM ID: %i\n{FFFFFF}Press {FFFF00}N {FFFFFF}to interfere"evmid);
        
EVMData[evmid][EVM3DT] = CreateDynamic3DTextLabel(str0xFFFF0088fXfYfZ80INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1, -195);
        
EVMData[evmid][PosX] = fX;
        
EVMData[evmid][PosY] = fY;
        
EVMData[evmid][PosZ] = fZ;
        
EVMData[evmid][RotX] = fRotX;
        
EVMData[evmid][RotY] = fRotY;
        
EVMData[evmid][RotZ] = fRotZ;
        
        new 
INI:File INI_Open(EVMPath(evmid));
        
INI_SetTag(File"Data");
        
INI_WriteFloat(File"Pos X"EVMData[evmid][PosX]);
        
INI_WriteFloat(File"Pos Y"EVMData[evmid][PosY]);
        
INI_WriteFloat(File"Pos Z"EVMData[evmid][PosZ]);
        
INI_WriteFloat(File"Rot X"EVMData[evmid][RotX]);
        
INI_WriteFloat(File"Rot Y"EVMData[evmid][RotY]);
        
INI_WriteFloat(File"Rot Z"EVMData[evmid][RotZ]);
        
INI_WriteInt(File"EVM Blocked"0);
        
INI_Close(File);
    }
    return 
1;

This is the file that get created after that

It's not even an ini file,
so you guys have any ideas?

SOLUTION:
increased the string length here
PHP код:
EVMPath(id){
new
str[10];
format(strsizeof(str), EVM_PATHid);
return 
str;

Reply
#2

Show us the definition of EVMPath.
Reply
#3

And eventually print its return value in console, so you can check if it works properly or not.
Reply
#4

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
Show us the definition of EVMPath.
#define EVM_PATH "/EO_EVM/%d.ini"
Reply
#5

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
#define EVM_PATH "/EO_EVM/%d.ini"
No, not 'EVM_PATH'. Look for #define EVMPath.
Reply
#6

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
No, not 'EVM_PATH'. Look for #define EVMPath.
EVMPath(id){
new
str[10];
format(str, sizeof(str), EVM_PATH, id);
return str;
}
Reply
#7

Increase the string length of the string you returning.
Reply
#8

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Increase the string length of the string you returning.
thanks it worked
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)