29.07.2011, 13:56
I want to save kills and deaths but its not working so i changed whole code but it has errors please tell me fixes and whats wrong with it?
Errors;
Whole Gm:
Errors;
pawn Код:
D:\Games\EFRP\gamemodes\simple.pwn(102) : error 028: invalid subscript (not an array or too many subscripts): "pKills"
D:\Games\EFRP\gamemodes\simple.pwn(102) : warning 215: expression has no effect
D:\Games\EFRP\gamemodes\simple.pwn(102) : error 001: expected token: ";", but found "]"
D:\Games\EFRP\gamemodes\simple.pwn(102) : error 029: invalid expression, assumed zero
D:\Games\EFRP\gamemodes\simple.pwn(102) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
pawn Код:
#include <a_samp>
#include <SII> // Include SII.inc
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
enum pInfo
{
pName,
pPass,
pLevel,
pMoney,
pKills,
pDeaths,
pAdmin,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new Player_Name[MAX_PLAYERS][MAX_PLAYER_NAME];
new bool: player_loggedin[MAX_PLAYERS];
//kills and deaths
// dialouge defines
#define DIALOG_REGISTER 2000
#define DIALOG_LOGIN 2001
// colors define for login
#define WHITE "{FFFFFF}"
#define RED "{F81414}"
#define GREEN "{00FF22}"
#define LIGHTBLUE "{00CED1}"
stock getINI(playerid)
{
new account[64];
format(account,30,"Users/%s.ini",Player_Name[playerid]);
return account;
}
main()
{
}
public OnGameModeInit()
{
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, Player_Name[playerid], MAX_PLAYER_NAME);
if (fexist(getINI(playerid)))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""WHITE"Registering...",""WHITE"Type your password below to register a new account.","Register","Quit");
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(INI_Open(getINI(playerid))) {
player_loggedin[playerid] = false;
INI_WriteInt("Name",PlayerInfo[playerid][pName]);
INI_WriteInt("Password",PlayerInfo[playerid][pPass]);
INI_WriteInt("Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt("Money",PlayerInfo[playerid][pMoney]);
INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
INI_Save();
INI_Close();
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if (response)
{
if(!strlen(inputtext)) {
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Registering...",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
}
if(INI_Open(getINI(playerid))) {
INI_WriteString("Name", Player_Name[playerid]);
INI_WriteString("Password",inputtext);
INI_WriteInt("Level",1);
INI_WriteInt("Money",5000);
INI_WriteInt("Kills", pKills[playerid]);
INI_WriteInt("Deaths", pDeaths[playerid]);
INI_WriteInt("Admin",0);
INI_Save();
INI_Close();
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
}
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(!strlen(inputtext)) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an invalid password.\n"WHITE"Type your password below to login.","Login","Quit");
}
if(INI_Open(getINI(playerid))) {
INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an incorrect password.\n"WHITE"Type your password below to login.","Login","Quit");
}
player_loggedin[playerid] = true;
SetPlayerScore( playerid, INI_ReadInt("Level" ) );
ResetPlayerMoney( playerid );
GivePlayerMoney( playerid, INI_ReadInt( "Money" ) );
PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
INI_Close();
}
}
}
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
pKills[killerid] ++; // The killer value will be increased
pDeaths[playerid] ++; // The death value will be increased
return 1;
}