createfaction command
#1

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.
Reply
#2

Try:
pawn Код:
dini_IntSet(file, "Name",FactionInfo[playerid][fname] = name);
Reply
#3

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.
Reply
#4

Change:
pawn Код:
new FactionInfo[MAX_PLAYERS][pInfo];
To:
pawn Код:
new FactionInfo[MAX_PLAYERS][fInfo];
Reply
#5

Name = Text = String = Array. Not an integer.
Reply
#6

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
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
Name = Text = String = Array. Not an integer.
Oh then what will it be instead of: Dini_IntSet?
Reply
#8

Guys please?
Reply
#9

It is giving you a number because your using dini_IntSet. dini_IntSet is used for Integers. Hint the INT part of intSet
Reply
#10

pawn Код:
enum fInfo
{
   fowner[128],
   fname[128],
   ftype,
}
new FactionInfo[MAX_PLAYERS][pInfo];
and
pawn Код:
dini_Set(file, "Name",name);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)