18.04.2011, 18:15
pawn Код:
tmp = gPlayerInfo[playerid][pPassword];
if(inputtext != tmp)
pawn Код:
RPScratch.pwn(319) : error 033: array must be indexed (variable "inputtext")
pawn Код:
if(inputtext != tmp)
tmp = gPlayerInfo[playerid][pPassword];
if(inputtext != tmp)
RPScratch.pwn(319) : error 033: array must be indexed (variable "inputtext")
if(inputtext != tmp)
if(inputtext != tmp)
if(strlen(inputtext) != tmp)
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1) //Register
{
if(response)
{
new name[MAX_PLAYER_NAME], files[256];
GetPlayerName(playerid, name, sizeof(name));
format(files, sizeof(files), "%s.ini", name);
{
new INI:file = INI_Open(files);
INI_WriteInt(file, "Password", strlen(inputtext));
INI_WriteInt(file, "Level", 1);
gPlayerInfo[playerid][pLevel] = 1;
SetPlayerScore(playerid,1);
INI_WriteInt(file, "Money", 5000);
gPlayerInfo[playerid][pMoney] = 5000;
GivePlayerMoney(playerid,5000);
INI_WriteInt(file, "Health", 100);
gPlayerInfo[playerid][pHealth] = 100;
SetPlayerHealth(playerid,100);
INI_WriteInt(file, "Armour", 0);
gPlayerInfo[playerid][pArmour] = 0;
SetPlayerArmour(playerid,0);
INI_WriteInt(file, "Skin", 26);
gPlayerInfo[playerid][pSkin] = 26;
SetPlayerSkin(playerid,26);
INI_Close(file);
return 1;
}
}
}
if(dialogid == 2) //Login
{
if(response)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
INI_ParseFile(file, "LoadUser_%s", .bExtra = true, .extra = playerid);
format(file, sizeof(file), "%s.ini", name);
new tmp;
tmp = gPlayerInfo[playerid][pPassword];
if(strlen(inputtext) != tmp)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[SYSTEM]: Error Incorrect Password!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Player Login", "Please Type In Your Password Below:", "Login", "Cancle");
}
else
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
SetPlayerScore(playerid, gPlayerInfo[playerid][pLevel]);
GivePlayerMoney(playerid, gPlayerInfo[playerid][pMoney]);
SetPlayerSkin(playerid, gPlayerInfo[playerid][pSkin]);
SetPlayerHealth(playerid, gPlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, gPlayerInfo[playerid][pArmour]);
}
}
}
return 1;
}
enum pInfo
{
pPassword,
pLevel,
pMoney,
pArmour,
pHealth,
pSkin
}
new gPlayerInfo[MAX_PLAYERS][pInfo];
public OnPlayerRequestClass(playerid, classid)
{
TogglePlayerSpectating(playerid, 1);
SpawnPlayer(playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.ini", name);
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Player Login", "Please Type In Your Password Below:", "Login", "Cancle");
}
else
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Player Registration", "Please Type In Your Desired Password Below:", "Register", "Cancle");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], playerfile[256];
GetPlayerName(playerid, name, sizeof(name));
format(playerfile, sizeof(playerfile), "%s.ini", name);
{
new INI:Accfile = INI_Open(playerfile);
INI_WriteInt(Accfile, "Level", gPlayerInfo[playerid][pLevel]);
INI_WriteInt(Accfile, "Money", GetPlayerMoney(playerid));
INI_WriteInt(Accfile, "Money",GetPlayerMoney(playerid));
INI_WriteFloat(Accfile, "Health", gPlayerInfo[playerid][pHealth]);
new Float:Armor; GetPlayerArmour(playerid, Armor);
INI_WriteFloat(Accfile, "Armour",Armor);
INI_WriteInt(Accfile, "Skin", gPlayerInfo[playerid][pSkin]);
INI_Close(Accfile);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
TogglePlayerSpectating(playerid, 0);
SetPlayerPos(playerid,-187.3777,1204.4523,19.6859);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1) //Register
{
if(response)
{
new name[MAX_PLAYER_NAME], files[256];
GetPlayerName(playerid, name, sizeof(name));
format(files, sizeof(files), "%s.ini", name);
{
new INI:file = INI_Open(files);
INI_WriteString(Acc,"Password", inputtext);
INI_WriteInt(file, "Level", 1);
gPlayerInfo[playerid][pLevel] = 1;
SetPlayerScore(playerid,1);
INI_WriteInt(file, "Money", 5000);
gPlayerInfo[playerid][pMoney] = 5000;
GivePlayerMoney(playerid,5000);
INI_WriteInt(file, "Health", 100);
gPlayerInfo[playerid][pHealth] = 100;
SetPlayerHealth(playerid,100);
INI_WriteInt(file, "Armour", 0);
gPlayerInfo[playerid][pArmour] = 0;
SetPlayerArmour(playerid,0);
INI_WriteInt(file, "Skin", 26);
gPlayerInfo[playerid][pSkin] = 26;
SetPlayerSkin(playerid,26);
INI_Close(file);
return 1;
}
}
}
if(dialogid == 2) //Login
{
if(response)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
INI_ParseFile(file, "LoadUser_%s", .bExtra = true, .extra = playerid);
format(file, sizeof(file), "%s.ini", name);
new tmp;
tmp = gPlayerInfo[playerid][pPassword];
if(strlen(inputtext) != tmp)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[SYSTEM]: Error Incorrect Password!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Player Login", "Please Type In Your Password Below:", "Login", "Cancle");
}
else
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
SetPlayerScore(playerid, gPlayerInfo[playerid][pLevel]);
GivePlayerMoney(playerid, gPlayerInfo[playerid][pMoney]);
SetPlayerSkin(playerid, gPlayerInfo[playerid][pSkin]);
SetPlayerHealth(playerid, gPlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, gPlayerInfo[playerid][pArmour]);
}
}
}
return 1;
}
public LoadUser(playerid, name[], value[])
{
INI_Int("Password", gPlayerInfo[playerid][pPassword]);
INI_Int("Level", gPlayerInfo[playerid][pLevel]);
INI_Int("Money", gPlayerInfo[playerid][pMoney]);
INI_Int("Skin", gPlayerInfo[playerid][pSkin]);
INI_Int("Health", gPlayerInfo[playerid][pHealth]);
INI_Int("Armour", gPlayerInfo[playerid][pArmour]);
return 1;
}
if(strcmp(inputtext, tmp, false)){
if(dialogid == 2) //Login
{
if(response)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
INI_ParseFile(file, "LoadUser_%s", .bExtra = true, .extra = playerid);
format(file, sizeof(file), "%s.ini", name);
new tmp;
tmp = gPlayerInfo[playerid][pPassword];
if(strcmp(inputtext, tmp, false))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "[SYSTEM]: Error Incorrect Password!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Player Login", "Please Type In Your Password Below:", "Login", "Cancle");
}
else
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
SetPlayerScore(playerid, gPlayerInfo[playerid][pLevel]);
GivePlayerMoney(playerid, gPlayerInfo[playerid][pMoney]);
SetPlayerSkin(playerid, gPlayerInfo[playerid][pSkin]);
SetPlayerHealth(playerid, gPlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, gPlayerInfo[playerid][pArmour]);
}
}
}
return 1;
}
RPScratch.pwn(321) : error 035: argument type mismatch (argument 2)
RPScratch.pwn(320) : warning 204: symbol is assigned a value that is never used: "tmp"
if(strcmp(inputtext, tmp, false))
tmp = gPlayerInfo[playerid][pPassword];