18.09.2012, 19:41
I made this now:
How can i save groupname as the file like if i do:
The file will be named test.ini
I tested this code but then the file appears in numbers like :116.ini
And when i do /creategroup test2 there dont will be made a new file.
How can i fix those problems?
Thanks Admigo
Код:
dcmd_creategroup(playerid, params[]) { new groupname ,g = GetFreeGroupID(); new pName4[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName4,sizeof(pName4)); //if(!IsPlayerAdmin(playerid)) return 0; if(sscanf(params,"s",groupname)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /creategroup [Groupname]"); if(strlen(params) > 49 || strlen(params) < 3) return SendClientMessage(playerid, COLOR_RED, "Usage: /groupcreate [Group name 3-50 characters])!"); if(fexist(GroupFile(g))) return SendClientMessage(playerid,COLOR_RED,"This groupname already exist."); else { fcreate(GroupFile(groupname)); format(GroupInfo[g][gName], 35, "%s", groupname); format(GroupInfo[g][gOwner], 25, "%s", pName4); new INI:file = INI_Open(GroupFile(groupname)); INI_WriteString(file, "GroupName", params); INI_WriteString(file, "GroupOwner", pName4); INI_WriteInt(file, "GroupMoney", 0); INI_WriteInt(file, "GroupScore", 0); INI_WriteInt(file, "GroupKills", 0); INI_WriteInt(file, "GroupDeaths", 0); INI_Close(file); } return 1; }
Код:
/creategroup test
I tested this code but then the file appears in numbers like :116.ini
And when i do /creategroup test2 there dont will be made a new file.
How can i fix those problems?
Thanks Admigo