Jump to content
  • 0

Cerere ajutor PayDay


xt3z0ne

Question

Nick:Johnny

Problema:Am o problema cu pInfo dar nu inteleg dece :|

Erori / warnings:[pawn]

D:\Games\DDSIDM~1\FILTER~1\LevelUp.pwn(53) : error 017: undefined symbol "PlayerInfo"

D:\Games\DDSIDM~1\FILTER~1\LevelUp.pwn(53) : warning 215: expression has no effect

D:\Games\DDSIDM~1\FILTER~1\LevelUp.pwn(53) : error 001: expected token: ";", but found "]"

D:\Games\DDSIDM~1\FILTER~1\LevelUp.pwn(53) : error 029: invalid expression, assumed zero

D:\Games\DDSIDM~1\FILTER~1\LevelUp.pwn(53) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

4 Errors.

[/pawn]

Lini/script:[pawn]

PlayerInfo[playerid][Level] = 1;

[/pawn]

Ai incercat sa rezolvi singur ?:Da dar nu am reusit nimic.

Sunt un retardat

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Nu exista matricea PlayerInfo

Man eu am asa.

#include <a_samp> // Credits goes to SA-MP team.
#include <YSI\y_ini>
#include <sscanf2>
#include <zcmd>

#if defined FILTERSCRIPT
#define LIME  0x88AA62FF
#define PATH "/Users/%s.ini" // the path where EXP and LEVEL data will be stored.

forward ScoreUpdate();
forward PayDay(playerid);
forward PlayerPlayMusic(playerid);
forward StopMusic();

enum PlayerInfo
{
  Level,
  Exp
};
new PlayerInfo[MAX_PLAYERS][pInfo];
new ScoreOld;
new levelexp = 1;


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	SetTimer("PayDay",360000,1);// 360000 = 1 hr.. you can change it.
    SetTimer("ScoreUpdate", 1000, 1); // Do not change it.
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnPlayerConnect(playerid)
{
    PlayerInfo[playerid][Level] = 1; // As soon as player connects,  It will set his/her level to 1.
    PlayerInfo[playerid][Exp] = 0; // Exp to 0.
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Level",PlayerInfo[playerid][Level]);
    INI_WriteInt(File,"Exp",PlayerInfo[playerid][Exp]);
    INI_Close(File);
	return 1;
}
COMMAND:levelup(playerid,params[])
{
        new string[30];
        if(IsPlayerConnected(playerid) == 1) 
        {
            new points[248];
            new nxtlevel = PlayerInfo[playerid][Level]+1;
            new expamount = nxtlevel*levelexp;
            if(PlayerInfo[playerid][Exp] < expamount)
            {
                format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,PlayerInfo[playerid][Exp]);
                SendClientMessage(playerid,LIME,points);
                return 1;
            }
            else
            {
                PlayerInfo[playerid][Exp] = 0;
                PlayerInfo[playerid][Level]++;
                format(string,sizeof(string),"~g~Your now level:[%d]",PlayerInfo[playerid][Level]);
                GameTextForPlayer(playerid,string,6000,1);
                return 1;
            }
        }
        return 1;
}
COMMAND:stats(playerid,params[])
{
new string2[200];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string2,sizeof(string2),"Name: %s \nLevel: %d\nExp: %d",name,PlayerInfo[playerid][Level],PlayerInfo[playerid][Exp]);
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",string2,"Close","");
return 1;
}
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Level",PlayerInfo[playerid][Level]);
    INI_Int("Exp",PlayerInfo[playerid][Exp]);
    return 1;
}

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

public ScoreUpdate()
{
    new Score;
    new name[MAX_PLAYER_NAME];
    //new string[256];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            GetPlayerName(i, name, sizeof(name));
            Score = PlayerInfo[i][Level];
            SetPlayerScore(i, Score);
            if (Score > ScoreOld)
            {
                ScoreOld = Score;
            }
        }
    }
}
public PayDay(playerid)
{
    for (new i; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            new nxtlevel = PlayerInfo[playerid][Level];
            new payday = nxtlevel*0;
            GivePlayerMoney(i,payday);
            PlayerInfo[playerid][Exp]++;
            GameTextForPlayer(i,"  ~p~ PayDay",6,5000);
            PlayerPlayMusic(playerid);
        }
    }
}
public PlayerPlayMusic(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetTimer("StopMusic", 5000, 0);
            PlayerPlaySound(i, 1068, 0.0, 0.0, 0.0);
        }
    }
}
public StopMusic()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            PlayerPlaySound(i, 1069, 0.0, 0.0, 0.0);
        }
    }
}
Si am PlayerInfo :|
enum PlayerInfo
{
  Level,
  Exp
};

Ai vreo rezolvare?

Sunt un retardat

Link to comment
Share on other sites

Da am.

Nu trebuie sa numeste acel enum PlayerInfo. Trebuie sa il numesti altfel.

[pawn]enum playerInfo

{

  Level,

  Exp

};

new PlayerInfo[MAX_PLAYERS][playerInfo]; // Aici o initializezi cu valorile de la playerInfo.[/pawn]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.