Skripta koju koristim: iStunt
Detaljan opis problema: krenu vracati iz PVarova u enumator spremanje statsa i sad kako je u starom modu bio dini a sa je y_ini, kad sve napravim dode mi oko 8 warninga, nesto sam krivo napravio ali neznam sto :/
Dio skripte:
warnovi
D:\Private\iStunt\pawno\include\reglog.inc(37) : warning 215: expression has no effect
D:\Private\iStunt\pawno\include\reglog.inc(38) : warning 215: expression has no effect
D:\Private\iStunt\pawno\include\reglog.inc(39) : warning 215: expression has no effect
D:\Private\iStunt\pawno\include\reglog.inc(40) : warning 215: expression has no effect
D:\Private\iStunt\pawno\include\reglog.inc(41) : warning 215: expression has no effect
D:\Private\iStunt\pawno\include\reglog.inc(42) : warning 215: expression has no effect
D:\Private\iStunt\pawno\include\reglog.inc(43) : warning 215: expression has no effect
D:\Private\iStunt\gamemodes\iStunt.pwn(2711) : warning 204: symbol is assigned a value that is never used: "Server" //ovaj zanemarite
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Warnings.
linije, sve su iste samo se razlikuju po funkciji
idu po redu:
if(!strcmp(name, "Admin")) PlayerInfo[playerid][pAdmin];
if(!strcmp(name, "VIP")) PlayerInfo[playerid][pVIP];
if(!strcmp(name, "Money")) PlayerInfo[playerid][pMoney];
if(!strcmp(name, "Score")) PlayerInfo[playerid][pScore];
if(!strcmp(name, "Kills")) PlayerInfo[playerid][pKills];
if(!strcmp(name, "Deaths")) PlayerInfo[playerid][pDeaths];
if(!strcmp(name, "Skin")) PlayerInfo[playerid][pSkin];
Neke slike/video za lakse dobivanje pomoci(neobavezno):
Obrisi to... To nicemu nesluzi...
pa kako ce se onda spremati statsi -..-
Ovo ti nema veze sa statsima -.-
Samo si napravio ako se ispunjava uvjet "if(!strcmp(name, "Admin"))" da ce se dogoditi "PlayerInfo[playerid][pAdmin];" što nema nikakve logike... Stavi pod /* i */
brate ja nista nisam to radio, sve paradox, i sad kad sam krenuo iz PVarova u enumator dobijem te warnove, na tom mjestu su bili PVarovi
evo kako je bilo s PVarovima
native WP_Hash(buffer[], len, const str[]);
forward LoadUserData(playerid, name[], value[]);
#define INI_Exists(%0) fexist(%0)
#define SetPVarIntEx(%0,%1,%2,%3) SetPVarInt(%0, %1, GetPVarInt(%0, %1) %2 %3)
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define USER_FILE "Korisnici/%s.ini"
#define VERSION "1.0.0"
public LoadUserData(playerid, name[], value[])
{
if(!strcmp(name, "Lozinka"))
{
new
hashPassword[129];
WP_Hash(hashPassword, 129, value);
SetPVarString(playerid, "Lozinka", hashPassword);
}
if(!strcmp(name, "Admin")) SetPVarInt(playerid, "Admin", strval(value));
if(!strcmp(name, "VIP")) SetPVarInt(playerid, "VIP", strval(value));
if(!strcmp(name, "Money")) SetPVarInt(playerid, "Money", strval(value));
if(!strcmp(name, "Score")) SetPVarInt(playerid, "Score", strval(value));
if(!strcmp(name, "Kills")) SetPVarInt(playerid, "Kills", strval(value));
if(!strcmp(name, "Deaths")) SetPVarInt(playerid, "Deaths", strval(value));
if(!strcmp(name, "Skin")) SetPVarInt(playerid, "Skin", strval(value));
}
OnPlayerRegister(playerid, password[])
{
new
hashPassword[129],
uFile[35];
format(uFile, 35, USER_FILE, GetName(playerid));
new
INI:playerFile = INI_Open(uFile);
WP_Hash(hashPassword, 129, password);
INI_WriteString(playerFile, "Lozinka", hashPassword);
INI_WriteInt(playerFile, "Admin", 0);
INI_WriteInt(playerFile, "VIP", 0);
INI_WriteInt(playerFile, "Money", 200);
INI_WriteInt(playerFile, "Score", 0);
INI_WriteInt(playerFile, "Kills", 0);
INI_WriteInt(playerFile, "Deaths", 0);
INI_WriteInt(playerFile, "Skin", 0);
INI_Close(playerFile);
SetPVarInt(playerid, "Registered", 1);
SetPVarInt(playerid, "Logged", 1);
return 1;
}
OnPlayerLogin(playerid, password[])
{
new
hashPassword[129],
Password[129],
uFile[35];
format(uFile, 35, USER_FILE, GetName(playerid));
INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
GetPVarString(playerid, "Lozinka", Password, 129);
WP_Hash(hashPassword, 129, password);
if(!strcmp(Password, hashPassword, false, 35))
{
if(GetPVarInt(playerid, "LoginTries") == 3) Kick(playerid);
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "iStunt - Logiranje", "{FF00EA}Upisali ste pogrešnu lozinku!\n\n\n{F81414}Molimo pokušajte ponovo!", "Login", "Leave");
SetPVarIntEx(playerid, "LoginTries", +, 1);
}
}
return 1;
}
OnPlayerLogout(playerid)
{
new
uFile[35];
format(uFile, 35, USER_FILE, GetName(playerid));
new
INI:playerFile = INI_Open(uFile);
INI_WriteInt(playerFile, "Admin", GetPVarInt(playerid, "Admin"));
INI_WriteInt(playerFile, "VIP", GetPVarInt(playerid, "VIP"));
INI_WriteInt(playerFile, "Money", GetPlayerMoney(playerid));
INI_WriteInt(playerFile, "Score", GetPlayerScore(playerid));
INI_WriteInt(playerFile, "Kills", GetPVarInt(playerid, "Kills"));
INI_WriteInt(playerFile, "Deaths", GetPVarInt(playerid, "Deaths"));
INI_WriteInt(playerFile, "Skin", GetPVarInt(playerid, "Skin"));
INI_Close(playerFile);
return 1;
}
if(!strcmp(name, "Admin")) PlayerInfo[playerid][pAdmin] = strval(value);
Evo ti jedan primjer kako bi to trebalo izgledat.
napravio sam po tut i sve radi ali aj sam pomozite oko /admins komande, stavio sam foreach(Player, i) i onda izbacuje error da je i ne definiran
CMD:admins(playerid,params[])
{
new aMsg[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_KRED, "<~~ Administratori Online ~~>");
foreach(Player, i)
if(PlayerInfo([i][pAdmin] == 1)
{
format(aMsg, 127, "Gamemaster: %s", GetName(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, aMsg);
}
else if(PlayerInfo([i][pAdmin] == 2)
{
format(aMsg, 128, "Administrator: %s", GetName(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, aMsg);
}
else if(PlayerInfo([i][pAdmin] == 3)
{
format(aMsg, 129, "Owner: %s", GetName(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, aMsg);
}
else SendClientMessage(playerid, COLOR_LIGHTBLUE, "Trenutno nema administratora online!");
return 1;
}
D:\Private\iStunt\gamemodes\iStunt.pwn(1554) : error 012: invalid function call, not a valid address
D:\Private\iStunt\gamemodes\iStunt.pwn(1554) : error 029: invalid expression, assumed zero
D:\Private\iStunt\gamemodes\iStunt.pwn(1554) : error 017: undefined symbol "i"
D:\Private\iStunt\gamemodes\iStunt.pwn(1554) : 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.
CMD:admins(playerid,params[])
{
new aMsg[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_KRED, "<~~ Administratori Online ~~>");
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] == 1)
{
format(aMsg, 127, "Gamemaster: %s", GetName(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, aMsg);
}
else if(PlayerInfo[i][pAdmin] == 2)
{
format(aMsg, 128, "Administrator: %s", GetName(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, aMsg);
}
else if(PlayerInfo[i][pAdmin] == 3)
{
format(aMsg, 129, "Owner: %s", GetName(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, aMsg);
}
}
return 1;
}
Pazi na zagrade, pogledaj svoj post.
I ovo if(PlayerInfo([pAdmin] == 1)
ide ovako if(PlayerInfo[i][pAdmin] == 1)
EDIT: I zasto kod formatiranja poruke povecavas duzinu? + sto je nepotrebna tolika duzina.
vid stvarno nisam skuzio, hvala more lock