createfaction command (SOLVED By Etch and Stigg) -
bartje01 - 03.06.2011
Hey everyone. Ive got a new problem. Im working on a faction system and I try to make a /createfaction command.
It gives one error. I dont know if this is right what Im doing.
My command:
pawn Код:
COMMAND:createfaction(playerid,params[])
{
new string[80],file[40],name;
if(PlayerInfo[playerid][pAdminLevel] <2) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to do this");
if(sscanf(params,"s",name)) return SendClientMessage(playerid,COLOR_GREY,"USAGE:/createfaction [faction name]");
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Name",FactionInfo[fname] = name);
format(string,sizeof(string),"Succesfully created faction: %s",name);
SendClientMessage(playerid,COLOR_YELLOW,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "This faction already exists");
}
return 1;
}
And maybe you need this as well:
pawn Код:
enum fInfo
{
fowner,
fname,
ftype,
}
new FactionInfo[MAX_PLAYERS][pInfo];
my error code:
Код:
C:\Users\Bart\Desktop\SampScripting\gamemodes\Sunlight.pwn(454) : error 033: array must be indexed (variable "FactionInfo")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
On this line:
pawn Код:
dini_IntSet(file, "Name",FactionInfo[fname] = name);
Please help.
Re: createfaction command -
Stigg - 03.06.2011
Try:
pawn Код:
dini_IntSet(file, "Name",FactionInfo[playerid][fname] = name);
Re: createfaction command -
bartje01 - 03.06.2011
Quote:
Originally Posted by Stigg
Try:
pawn Код:
dini_IntSet(file, "Name",FactionInfo[playerid][fname] = name);
|
Same line says this now:
C:\Users\Bart\Desktop\SampScripting\gamemodes\Sunl ight.pwn(454) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
Re: createfaction command -
Stigg - 03.06.2011
Change:
pawn Код:
new FactionInfo[MAX_PLAYERS][pInfo];
To:
pawn Код:
new FactionInfo[MAX_PLAYERS][fInfo];
Re: createfaction command -
Vince - 03.06.2011
Name = Text = String = Array. Not an integer.
Re: createfaction command -
bartje01 - 03.06.2011
Ok no errors. I tested it and it doesnt really work. When I open the ini file of the faction i create the name says:
Name=65
xD
Re: createfaction command -
bartje01 - 03.06.2011
Quote:
Originally Posted by Vince
Name = Text = String = Array. Not an integer.
|
Oh then what will it be instead of: Dini_IntSet?
Re: createfaction command -
bartje01 - 03.06.2011
Guys please?
Re: createfaction command -
futuretrucker - 03.06.2011
It is giving you a number because your using dini_IntSet. dini_IntSet is used for Integers. Hint the INT part of intSet
Re: createfaction command -
jameskmonger - 03.06.2011
pawn Код:
enum fInfo
{
fowner[128],
fname[128],
ftype,
}
new FactionInfo[MAX_PLAYERS][pInfo];
and
pawn Код:
dini_Set(file, "Name",name);