SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/07/2012, 04:19 PM   #1
XStormiest
Huge Clucker
 
Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 305
Reputation: 38
Default Problem with dini

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
XStormiest is offline   Reply With Quote
Old 13/07/2012, 04:34 PM   #2
RedJohn
Huge Clucker
 
RedJohn's Avatar
 
Join Date: Jul 2012
Location: Mostar, Bosnia and Herzegovina
Posts: 457
Reputation: 52
Default Re: Problem with dini

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!
__________________
Release name
Link
Dialog creator
Link
String characters counter
Link
Pawno Color Generator
Link
Simple Hospital Helicopter Roof
Link
RedJohn is offline   Reply With Quote
Old 13/07/2012, 04:36 PM   #3
Andi_Evandy
Big Clucker
 
Join Date: Nov 2011
Location: Indonesia
Posts: 126
Reputation: 23
Default Re: Problem with dini

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);
}
Andi_Evandy is offline   Reply With Quote
Old 13/07/2012, 04:37 PM   #4
XStormiest
Huge Clucker
 
Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 305
Reputation: 38
Default Re: Problem with dini

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 (c) 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
XStormiest is offline   Reply With Quote
Old 13/07/2012, 05:08 PM   #5
XStormiest
Huge Clucker
 
Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 305
Reputation: 38
Default Re: Problem with dini

Removed

Last edited by XStormiest; 13/07/2012 at 07:05 PM.
XStormiest is offline   Reply With Quote
Old 13/07/2012, 05:21 PM   #6
Steven82
High-roller
 
Join Date: Nov 2009
Location: California, USA
Posts: 2,614
Reputation: 162
Default Re: Problem with dini

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

pawn Code:
//Credits to sa-mp.com
#include <a_samp>
//Credits to Y_Less 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.
__________________
As of 3/09/13, I have decided to walk away from SA-MP. It's been a long run and a lot of fun being here and playing here. But as time goes on, so does life. I am getting too busy and just don't have time to script or play anymore. So I wish everyone the best. And hope that the SA-MP Dev Team continues to develop a great mod.
- Farewell, Steven
Steven82 is offline   Reply With Quote
Old 13/07/2012, 07:07 PM   #7
XStormiest
Huge Clucker
 
Join Date: Jun 2012
Location: Continent: Europe, Country: Romania, City: Buzau
Posts: 305
Reputation: 38
Default Re: Problem with dini

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!
XStormiest is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dini problem Tanush123 Scripting Help 1 07/02/2012 03:00 AM
dini problem knackworst Scripting Help 8 07/10/2011 06:24 PM
dini problem Tanush123 Help Archive 1 24/08/2011 08:42 AM
Dini Problem Blokkmonsta Help Archive 1 27/11/2010 06:20 PM
problem with DINI nuriel8833 Help Archive 0 11/08/2009 10:33 AM


All times are GMT. The time now is 12:51 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.