ini file won't be created -
Eoussama - 27.12.2016
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(playerid, 0xFF000088, "[ERROR]: You are not connected to the server");
if(IsPlayerAdmin(playerid)){
if(!IsPlayerInAnyVehicle(playerid)){
if(sscanf(params, "i",ID)) return SendClientMessage(playerid, 0xFFFFFF, "[USAGE]: /makeevm (ID)");
if(fexist(EVMPath(ID))) return SendClientMessage(playerid, Red, "[ERROR]: That slot is used, clear it using /deleteevm or chose another vailable slot via /evmstats");
if(ID >= MAX_EVM || ID < 0) return SendClientMessage(playerid, 0xFFFFFF, "[ERROR]: Invalid ID");
evmid = ID;
GetPlayerPos(playerid, EVMData[ID][PosX], EVMData[ID][PosY], EVMData[ID][PosZ]);
gEVM[ID] = CreateDynamicObject(18885, EVMData[ID][PosX]+1, EVMData[ID][PosY], EVMData[ID][PosZ], 0.0, 0.0, 0.0, -1, -1, -1, 115, 100);
EditDynamicObject(playerid, gEVM[ID]);
format(str1, sizeof(str1), "[EO_EVM]: {FFFFFF}Explosives Vending Machine successfully created! ID:%i",ID);
SendClientMessage(playerid, 0xFFFF00, str1);
printf("Administrator %s Created a new EVM, ID: %i", GetName(playerid), ID);
EVMData[ID][EVMBlocked] = 0;
return 1;
}
else{
SendClientMessage(playerid, 0xFF0000, "[ERROR]: You can't use this while in a vehicle");
}
}
else{
SendClientMessage(playerid, 0xFF0000AA, "[ERROR]: You can't use this command");
}
return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
new str[85];
if(response == EDIT_RESPONSE_FINAL)
{
format(str, sizeof(str), "Explosive Vending Machine\nEVM ID: %i\n{FFFFFF}Press {FFFF00}N {FFFFFF}to interfere", evmid);
EVMData[evmid][EVM3DT] = CreateDynamic3DTextLabel(str, 0xFFFF0088, fX, fY, fZ, 80, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 95);
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(str, sizeof(str), EVM_PATH, id);
return str;
}
Re: [HELP]: ini file won't be created -
Lordzy - 27.12.2016
Show us the definition of EVMPath.
Re: [HELP]: ini file won't be created -
Spmn - 27.12.2016
And eventually print its return value in console, so you can check if it works properly or not.
Re: [HELP]: ini file won't be created -
Eoussama - 27.12.2016
Quote:
Originally Posted by Lordzy
Show us the definition of EVMPath.
|
#define EVM_PATH "/EO_EVM/%d.ini"
Re: [HELP]: ini file won't be created -
Lordzy - 28.12.2016
Quote:
Originally Posted by Eoussama
#define EVM_PATH "/EO_EVM/%d.ini"
|
No, not 'EVM_PATH'. Look for
#define EVMPath.
Re: [HELP]: ini file won't be created -
Eoussama - 28.12.2016
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;
}
Re: [HELP]: ini file won't be created -
SyS - 28.12.2016
Increase the string length of the string you returning.
Re: [HELP]: ini file won't be created -
Eoussama - 28.12.2016
Quote:
Originally Posted by Sreyas
Increase the string length of the string you returning.
|
thanks it worked