Not sure how to use dini_Create
#1

What am I doing?
I am working on a police database system that officers can use to see if a player has any active warrans...

When a player (officer) clicks on a search textdraw, he gets a dialog where he can type the name of a player he wants to search.
Also officers can create warrants by clicking on a create warrant textdraw and then they will get a dialog where they have to type in the players name...

How is that suppose to work?
Well when a officer wants to make a warrant he will type in a players name and in scriptfiles/warrants, folder with that player name will be created. ((dini_Create))
When a officer wants to check if a player has a active warrant,the script will check if the folder exists with ((dini_Exists))

But the problem is...
When a player types in a name of a player he wants to add to the "wanted list" dini doesnt create a file with that players name...
What am I doing wrong?

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_NEWWARANT)
	    {
	        if(response == 1)
        	{
        	    new name = strval(inputtext);
        	    new namef[100];
        	    format(String,sizeof(String),"%s.ini",name);
                dini_Create("/Warrants/%s.ini");
	            SendClientMessage(playerid,COLOR_RED,"Warrant created!");
	            return 1;
	        }
	        return 1;
	    }
    if(dialogid == DIALOG_SEARCH)
    {
    	if(response == 1)
        {
        	new ime = strval(inputtext);
    	    new namef[100];
    	    format(namef,sizeof(namef),"%s.ini",name);
            if(dini_Exists("/Warrants/%s.ini"))
			{
            	SendClientMessage(playerid,COLOR_RED,"Warrant found!");
				//napravi_textdrawe_za_nadenu_tjeralicu_start

				//napravi_textdrawe_za_nadenu_tjeralicu_end
   			}
   			else{
   			    	SendClientMessage(playerid,COLOR_GREEN,"No active warrant");
   			    }
		}
        return 1;
    }
	return 0;
}
ps
Sorry for my bad english
Reply
#2

You're maybe missing Warrants.ini in scriptfiles?
Reply
#3

check if you have "Warrant.ini and Warrants.ini" in scriptfiles
Reply
#4

Warrants.ini shouldn't even be there.
Warrants is a folder where the playername.ini should be created.
So when a player types (Obama_Trump) in the dialog, diniCreate is suppose to make Obama_Trump.ini IN THE Scriptfiles/Warrants folder...


The problem is...
Have no clue how to actually make dini to create that player name as a .ini file with that name that the player typed in the dialog box...
Reply
#5

Use this.
format(String,sizeof(String),"/Warrants/%s.ini",name);
dini_Create(String);
Reply
#6

error 017: undefined symbol "name"
Reply
#7

Nah it doesnt works, it still creats String.ini instead of text that player typed.ini
Reply
#8

Actually now unnamed file gets created, not sure what the problem is...
(.ini file with no name is created)
Reply
#9

Oh, for the love of all that is holy, please stop using dini for new scripts. If you must use a file based system then there are better alternatives. And please don't tell me "it's easy". That may well be. Riding a bicycle is also easier than driving a car but you wouldn't ride a bicycle 50 km and back to work everyday (unless perhaps you're Dutch).
Reply
#10

I solved it,but still,thank you... +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)