Problem with dini
#1

I defined this
Code:
#define PickUpCreator "Pickup.ini"
+ this
Code:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
	  if(strcmp(cmdtext,"/createpickup",true) == 0)
	  {
		  if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,COLOR_RED,"You must be admin!! (RCON)");
			  else ShowPlayerDialog(playerid,100,DIALOG_STYLE_INPUT,"Create Pickup","Write the id of your pickup.!","Create","Cancel");
			  return 1;
	  }
	  return 1;
}
but i don't know how to do here...
Code:
   if(dialogid == 100)
   {
		  if(!response) return 1;
		  if(response)
		  {
			   new Float:X,Float:Y,Float:Z;
			   new VirtualWorld;
			   VirtualWorld = GetPlayerVirtualWorld(playerid);
			   GetPlayerPos(playerid,X,Y,Z);
			   CreatePickup(inputtext[0],1,X,Y,Z,VirtualWorld);
			   if(!fexist(PickUpCreator) )
			   {
				   dini_Create(PickUpCreator);
					dini_IntSet(PickUpCreator,"Pickup", CreatePickup(inputtext[0],-1,X,Y,Z,VirtualWorld));
			   }
			   
		  }
   }
to save CreatePickup.......like a function in PickUpCreator.ini

and this is what i get in Pickup.ini
Code:
Pickup=5
Reply
#2

I sucks with dini but i think its not
pawn Code:
if(!fexist(PickUpCreator) )
its
pawn Code:
if(!dini_Exists(PickUpCreator))
. Please correct me if im wrong!
Reply
#3

Store it to string using "format"
pawn Code:
new Float:X,Float:Y,Float:Z;
new VirtualWorld;
new str[128];
VirtualWorld = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid,X,Y,Z);
CreatePickup(inputtext[0],1,X,Y,Z,VirtualWorld);
format(str, sizeof(str), "CreatePickup(%d, -1, %f, %f, %f, %d)", inputtext[0], X, Y, Z, VirtualWorld);
if(!dini_Exists(PickUpCreator))
{
    dini_Create(PickUpCreator);
    dini_IntSet(PickUpCreator,"Pickup", str);
}
Reply
#4

no because if(dini_Exists(PickUpCreator) ) verify if file exist not if not....
i think my wrong is here
Code:
dini_IntSet(PickUpCreator,"Pickup", CreatePickup(inputtext[0],-1,X,Y,Z,VirtualWorld));
for Redjohn ...

ERROR: :
from your line
Code:
D:\Servere de samp\Server\filterscripts\PickupCreator.pwn(57) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Code:
  dini_IntSet(PickUpCreator,"Pickup", str);
Fixed: thanks for helped me but you have a mistake you replaced with a string but forget to set dini_IntSet to dini_Set

EDIT: Now it don't write ...nothing when i look in Pickup.ini like if a created it with cmd
Reply
#5

Removed
Reply
#6

I have tested the code and everything came out fine for me.

pawn Code:
//Credits to sa-mp.com
#include <a_samp>
//Credits to ****** for sscanf
#include <sscanf2>
//Credits to Zeex for zmcd
#include <zcmd>
//Credits to Dracoblue for dini
#include <dini>

//deleting the Loose indentitation warning
#pragma tabsize 0

#define PickUpCreator "Pickup.ini"

public OnFilterScriptInit()
{
   print("Pickup creator Loaded");
  return 1;
}

public OnFilterScriptExit()
{
  print("Pickup creator unLoaded");
  return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
      if(strcmp(cmdtext,"/createpickup",true) == 0)
      {
          if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,-1,"You must be admin!! (RCON)");
              else ShowPlayerDialog(playerid,100,DIALOG_STYLE_INPUT,"Create Pickup","Write the id of your pickup.!","Create","Cancel");
              return 1;
      }
      return 1;
}

public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
   if(dialogid == 100)
   {
        if(!response) return 1;
        if(response)
        {
            new Float:X,Float:Y,Float:Z, VirtualWorld, str[128];
            VirtualWorld = GetPlayerVirtualWorld(playerid);
            GetPlayerPos(playerid,X,Y,Z);
            CreatePickup(inputtext[0],1,X,Y,Z,VirtualWorld);
            format(str, sizeof(str), "CreatePickup(%d,-1, %f, %f, %f, %d)", inputtext[0], X, Y, Z, VirtualWorld);
            if(!dini_Exists(PickUpCreator))
            {
                dini_Create(PickUpCreator);
                dini_Set(PickUpCreator,"Pickup", str);
            }

        }
    }
    return 1;
}
Here's the .ini file output.

Code:
Pickup=CreatePickup(49,-1, 1959.363037, 1343.861206, 15.374607, 0)
And may I suggest you learn how to indent your coding, holy crap.
Reply
#7

I think is a problem from my server test..i will create another one fine Steven and Andi_Evandy will be on credits because helped me , i wanted to put this on net!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)