Skripta koju koristim: Underpoint
Detaljan opis problema: Kada igrac umre ili ga ubijem komandom izbaci neku gresku, a kada vise igraca umre kresa server.
Dio skripte: https://pastebin.com/wzXkX9V3 https://pastebin.com/s5HcWmkW
Neke slike/video za lakse dobivanje pomoci(neobavezno): http://prntscr.com/hru9gs http://prntscr.com/hru9n5 http://prntscr.com/hru9r2
UP PROBLEM OnPlayerDeath
870
pregleda
12
postova
24. Dec. 2017.
Potrebno je samo citati
Zatim dobijas OnPlayerDeath za id 0 sto je INVALID_PLAYER_ID
Zato dobijas index 65535 ako je invalid player id. Isto ti je i sa vozilima. (ako probijes limit isti problem imas)
Resenje
na vrh funkcije OnPlayerDeath
[21:40:11] Run time error 4: "Array index out of bounds"
[21:40:11] Attempted to read/write array element at index 65535 in array of size 1
Zatim dobijas OnPlayerDeath za id 0 sto je INVALID_PLAYER_ID
[21:40:11] #0 001335ec in ?? (0, 65535, 255) from up-rp.amx
[21:40:11] #1 0000ad78 in public OnPlayerDeath (0, 65535, 255) from up-rp.amx
Zato dobijas index 65535 ako je invalid player id. Isto ti je i sa vozilima. (ako probijes limit isti problem imas)
Resenje
if(playerid != INVALID_PLAYER_ID)
na vrh funkcije OnPlayerDeath
24. Dec. 2017.
A sta mislis oce sada?
public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid != INVALID_PLAYER_ID) {
PlayerInfo++; PlayerInfo++;
ResetPlayerWeapons(playerid); ResetujVar(playerid);
////////////////////////////////////////////////////////////
if(IgracPolicajac(killerid))
{
PlayerInfo = 0;
SetPlayerWantedLevel(killerid,0);
}
////////////////////////////////////////////////////////////
if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
{
PostaviWanted(killerid, "Ubistvo", "Nepoznat");
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(killerid) > 6)
{
SetPlayerWantedLevel(killerid, 6);
PlayerInfo = 6;
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(playerid) > 0)
{
new string;
g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*400);
SCMF(playerid, -1, ""ZUTA" "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*400, GetPlayerWantedLevel(playerid));
SetPlayerWantedLevel(playerid, 0); PlayerInfo = 0;
format(string,sizeof(string),""CRVENA"[UP:RP] "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
AdminGameMaster(-1,string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && PlayerInfo >= 1)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(gPlayerUsingLoopingAnim)
{
gPlayerUsingLoopingAnim = 0;
}
}
return 1;
}
24. Dec. 2017.
Tosic ツ wrote on December 24, 2017, 10:00 pm:
A sta mislis oce sada?
public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid != INVALID_PLAYER_ID) {
PlayerInfo++; PlayerInfo++;
ResetPlayerWeapons(playerid); ResetujVar(playerid);
////////////////////////////////////////////////////////////
if(IgracPolicajac(killerid))
{
PlayerInfo = 0;
SetPlayerWantedLevel(killerid,0);
}
////////////////////////////////////////////////////////////
if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
{
PostaviWanted(killerid, "Ubistvo", "Nepoznat");
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(killerid) > 6)
{
SetPlayerWantedLevel(killerid, 6);
PlayerInfo = 6;
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(playerid) > 0)
{
new string;
g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*400);
SCMF(playerid, -1, ""ZUTA" "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*400, GetPlayerWantedLevel(playerid));
SetPlayerWantedLevel(playerid, 0); PlayerInfo = 0;
format(string,sizeof(string),""CRVENA"[UP:RP] "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
AdminGameMaster(-1,string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && PlayerInfo >= 1)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(gPlayerUsingLoopingAnim)
{
gPlayerUsingLoopingAnim = 0;
}
}
return 1;
}
Msm da treba killerid al nisam siguran
25. Dec. 2017.
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo++; PlayerInfo++;
ResetujVar(playerid); ResetPlayerWeapons(playerid);
if(IgracPolicajac(killerid))
{
PlayerInfo = 0;
SetPlayerWantedLevel(killerid,0);
}
}
//----------------------------------------------------------------------------------------//
if(killerid != INVALID_PLAYER_ID)
{
if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
{
if(PlayerInfo == 0)
{
PostaviWanted(killerid, "Ubistvo", "Nepoznat");
}
}
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(killerid) > 6)
{
SetPlayerWantedLevel(killerid, 6);
PlayerInfo = 6;
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(playerid) > 0)
{
new string;
g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*400);
SCMF(playerid, -1, ""ZUTA" "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*400, GetPlayerWantedLevel(playerid));
SetPlayerWantedLevel(playerid, 0); PlayerInfo = 0;
format(string,sizeof(string),""CRVENA"[UP:RP] "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
AdminGameMaster(-1,string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && PlayerInfo >= 1)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(gPlayerUsingLoopingAnim)
{
gPlayerUsingLoopingAnim = 0;
}
return 1;
}
{
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo++; PlayerInfo++;
ResetujVar(playerid); ResetPlayerWeapons(playerid);
if(IgracPolicajac(killerid))
{
PlayerInfo = 0;
SetPlayerWantedLevel(killerid,0);
}
}
//----------------------------------------------------------------------------------------//
if(killerid != INVALID_PLAYER_ID)
{
if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
{
if(PlayerInfo == 0)
{
PostaviWanted(killerid, "Ubistvo", "Nepoznat");
}
}
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(killerid) > 6)
{
SetPlayerWantedLevel(killerid, 6);
PlayerInfo = 6;
}
////////////////////////////////////////////////////////////
if(GetPlayerWantedLevel(playerid) > 0)
{
new string;
g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*400);
SCMF(playerid, -1, ""ZUTA" "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*400, GetPlayerWantedLevel(playerid));
SetPlayerWantedLevel(playerid, 0); PlayerInfo = 0;
format(string,sizeof(string),""CRVENA"[UP:RP] "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
AdminGameMaster(-1,string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(IsPlayerConnected(killerid) && PlayerInfo >= 1)
{
new string;
format(string,sizeof(string), ""CRVENA"[UP:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
AdminGameMaster(-1, string);
}
////////////////////////////////////////////////////////////
if(gPlayerUsingLoopingAnim)
{
gPlayerUsingLoopingAnim = 0;
}
return 1;
}
Morate biti prijavljeni da biste odgovorili na ovu temu.
Prijava
