Slapped Together some Script and Im getting 3 Identical Errorrs,
#1

Hey Guys its me Again. Im trying to Create a Code that will save using Dini so when My server restarts, the Info is Restored.
Now, This is my Enum Code.
Код:
enum PLAYER_MAIN {
    FACTION_RANK,
    CASH,
}

new PlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
And Im trying to make it Save Automaticly, and after having a look at a few Dini Tutorials I Slapped together a Crap code in the Hope it will work.
It didnt.

This is the Code I Mashed onto Pawno:
Код:
public OnPlayerConnect(playerid)
{

 	new file[100],Name[MAX_PLAYER_NAME],Ip[16];
        GetPlayerName(playerid,Name,sizeof(Name));
        format(file,sizeof(file),PlayerFile,Name);

	if(!dini_Exists(file))
        {
	     dini_Create(file);
	     dini_Set(file,"FACTION_RANK",FACTION_RANK);
	     dini_Set(file,"CASH",CASH);
	return 1;
}
}
Any Assistance, or New Code would be GREAT. Thanks for Reading
Reply
#2

pawn Код:
enum PLAYER_MAIN {
    FACTION_RANK,
    CASH
}

new PlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
pawn Код:
public OnPlayerConnect(playerid)
{

    new file[100],Name[MAX_PLAYER_NAME],Ip[16];
        GetPlayerName(playerid,Name,sizeof(Name));
        format(file,sizeof(file),PlayerFile,Name);

    if(!dini_Exists(file))
        {
         dini_Create(file);
         dini_Set(file,"FACTION_RANK",FACTION_RANK);
         dini_Set(file,"CASH",CASH);
         }
   return 1;
}
im pretty sure this will work...
Reply
#3

Nope, Got these Errors.
error 017: undefined symbol "PlayerFile"
warning 217: loose indentation
error 035: argument type mismatch (argument 3)
error 035: argument type mismatch (argument 3)
Reply
#4

UPDATE, I Have Done some More Work on it. Activating Dini, Except theres 5 Errors Evolved around 1 Line.
Код:
C:\Program Files\SAMP\SAMP\SAMP\gamemodes\RP10.pwn(169) : error 001: expected token: "-string end-", but found "-identifier-"
This is the Line.
Код:
PlayerInfo[playerid][FACTION_RANK] == 1;
ALL HELP IS APPRECIATED!
Reply
#5

PlayerInfo[playerid][FACTION_RANK] = 1;
Reply
#6

Didnt Work
Thanks for Trying
Reply
#7

pawn Код:
#define PlayerFile         "something/Users/%s.ini"
Reply
#8

Everything is messed up there, why are you creating a file OnPlayerConnet?
You need to make /register /login and save them by a function... get some RP mode and figure out how to do it.
To do that, you need UPDATEPLAYER, LOGINPLAYER, REGISTERPLAY, big script
Reply
#9

Yes I see what You mean, Im trying to Store Data without Login or Register. So What do I Do? Use OnPlayerUpdate? It saves the Data. that Might have helped lol

--scratch that, I want to save the Data on command lol

The General Idea is that when You do a Certain command, That Your Set to a Team using an Enum inside an Array, and On that Command it saves it so when you connect to the server after it has been restarted, youre In that team? You understand what I Mean.

So Far I Have
Код:
#define PlayerInfo         "SERVERFILES/Settings/User.ini"
As the Data Storage. And I Have Dini
Код:
enum PLAYER_MAIN {
    FACTION_RANK,
}

new PlayerInfo[MAX_PLAYERS][PLAYER_MAIN];
As The Enum.

Код:
public OnPlayerConnect(playerid)
{

    new file[100],Name[MAX_PLAYER_NAME],Ip[16];
        GetPlayerName(playerid,Name,sizeof(Name));
        format(file,sizeof(file),file,Name);

    if(!dini_Exists(file))
        {
         dini_Create(file);
         dini_Set(file,"FACTION_RANK");
         }
   return 1;
}
So When It reconnects the Data is Restored.

The Command to make the Team.
Код:
			if (strcmp("/rank1", cmdtext, true) == 0)
	{
	SendClientMessage(playerid, 0xFFFF00AA,"Set To Rank 1");
	PlayerInfo[playerid][FACTION_RANK] == 1;
		return 1;
	}
Any Advice?
Reply
#10

what didn't work, you asked what was wrong with the line and i fixed it.
pawn Код:
if (strcmp("/rank1", cmdtext, true) == 0)
    {
    SendClientMessage(playerid, 0xFFFF00AA,"Set To Rank 1");
    PlayerInfo[playerid][FACTION_RANK] == 1;
        return 1;
    }
you didnt bother fixing it
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)