Get Strings in file and connect it to other file -
Lirbo - 07.08.2014
Sorry for bad English
I want to do this:
Get String from pFile (btw this line is error line... i think i need to add strcmp or something)
pawn Код:
DOF2_GetString(pFile(playerid),"Clan");
then its will Get the String "Clan = X" from pFile and I want to make cFile as "Clan"'s String (Clan = X)
so X will be the cFile
pawn Код:
DOF2_GetString(cFile(playerid),"Color");
now i got "Color = 0xFF0000FF" at cFile file
so I want to do:
OnPlayerSpawn
SetPlayerColor(playerid,DOF2_GetString(cFile(playe rid),"Color");
my stocks:
pawn Код:
stock pFile(playerid)
{
new pName[MAX_PLAYER_NAME +1];
new File[50];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(File,sizeof(File),"Accounts/%s.ini",pName);
return File;
}
pawn Код:
stock cFile(playerid)
{
new File[50];
format(File,sizeof(File),"Clans/%s.ini",cString);
SetPlayerScore(playerid,0);
return File;
}
Please help
Re: Get Strings in file and connect it to other file -
ViniBorn - 07.08.2014
Try to use DOF2_GetHex and DOF2_SetHex to color...
Re: Get Strings in file and connect it to other file -
Lirbo - 07.08.2014
Quote:
Originally Posted by ViniBorn
Try to use DOF2_GetHex and DOF2_SetHex to color...
|
Sounds nice, can you explain me about Set/Get Hex?
IDK how to work with it, never used it before
Re: Get Strings in file and connect it to other file -
ViniBorn - 07.08.2014
Is like DOF2_SetInt, DOF2_GetString,etc. But it save/load and hexadecimal number...
Re: Get Strings in file and connect it to other file -
Lirbo - 07.08.2014
pawn Код:
CMD:clancreate(playerid,params[]){
if(AdminLevel <5)return MSG(playerid,C_RED,"[ERROR] {FF6969}You not allowed to use this command!");
if(sscanf(params,"s",cString)) return MSG(playerid,C_RED,"[ERROR] {ff6969}USAGE: /CLANCREATE <CLAN NAME>");
format(cString,sizeof(cString),cString);
DOF2_CreateFile(cFile(playerid));
DOF2_SetHex(cFile(playerid),"Color",0xFF0000FF);
DOF2_SetInt(cFile(playerid),"Level",0);
DOF2_SetInt(cFile(playerid),"Kills",0);
DOF2_SetInt(cFile(playerid),"Deaths",0);
DOF2_SetInt(cFile(playerid),"Heroin",0);
DOF2_SetInt(cFile(playerid),"Money",0);
DOF2_SetInt(cFile(playerid),"WarehouseLvl",0);
DOF2_SetInt(cFile(playerid),"WarehouseX",0);
DOF2_SetInt(cFile(playerid),"WarehouseY",0);
DOF2_SetInt(cFile(playerid),"WarehouseZ",0);
MSG(playerid,C_GREEN,"Done");
return 1;}
pawn Код:
SetPlayerColor(playerid,DOF2_GetHex(cFile(playerid),"Color"));
like this? my color is still black... and the hex in the clan file is 0xFF0000FF
Re: Get Strings in file and connect it to other file -
iFarbod - 07.08.2014
Get rid of this old library, and use some new thing like Y_INI, MySQL, SQLite, ...
Re: Get Strings in file and connect it to other file -
Lirbo - 07.08.2014
Quote:
Originally Posted by ViniBorn
Try to use DOF2_GetHex and DOF2_SetHex to color...
|
Quote:
Originally Posted by ViniBorn
Is like DOF2_SetInt, DOF2_GetString,etc. But it save/load and hexadecimal number...
|
Quote:
Originally Posted by iFarbod
Get rid of this old library, and use some new thing like Y_INI, MySQL, SQLite, ...
|
idk to use them
Re: Get Strings in file and connect it to other file -
ViniBorn - 07.08.2014
How are you using DOF2_GetHex ?
Re: Get Strings in file and connect it to other file -
Lirbo - 07.08.2014
Quote:
Originally Posted by ViniBorn
How are you using DOF2_GetHex ?
|
take a look on my privous reply
i typed for you...
Re: Get Strings in file and connect it to other file -
ViniBorn - 07.08.2014
If the file is saving correctly, try this
pawn Код:
SetPlayerColor(playerid,DOF2_GetHex(cFile(playerid),"Color") >>> 8);