Problem with dini -
XStormiest - 13.07.2012
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
Re: Problem with dini -
RedJohn - 13.07.2012
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!
Re: Problem with dini -
Andi_Evandy - 13.07.2012
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);
}
Re: Problem with dini -
XStormiest - 13.07.2012
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
Re: Problem with dini -
XStormiest - 13.07.2012
Removed
Re: Problem with dini -
Steven82 - 13.07.2012
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.
Re: Problem with dini -
XStormiest - 13.07.2012
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!