PDA

View Full Version : bug


asri
06/08/2017, 07:59 AM
when enter deathmatch the Interior is blank and then the player money
Ascending slightly when enter the room.

public OnPlayerSpawn(PID)
if(InDM[PID] == true)
{
switch (DM[PID])
{
case 0: shamal
{
GivePlayerWeapon(PID, 24, 1000);
SetPlayerHealth(PID, 99);
SetPlayerArmour(PID, 99);
new spawn = random(sizeof(DMZeroSpawns));
SetPlayerPos(PID, DMZeroSpawns[spawn][0], DMZeroSpawns[spawn][1], DMZeroSpawns[spawn][2]);
SetPlayerFacingAngle(PID, DMZeroSpawns[spawn][3]); //>> SetPlayerInterior
SetPlayerVirtualWorld(PID, 1);
SetPlayerInterior(playerid, 17);
SetPlayerHealth(PID, 99);
}
}
}

public OnPlayerDeath(PID, killerid, reason)
if(InDM[PID] == true)
{
if(anakko[PID] == 1)
{
anakko[PID] = 0;
if(makko[PID] != INVALID_PLAYER_ID)
TogglePlayerSpectating(PID, 1);
PlayerSpectatePlayer(PID, killerid);
SendClientMessage(PID, SKYBLUE , "You have been killed, you are now spectating your killer.");
SetTimerEx("EndDeathCam", 10000, false, "i", playerid);
}
else
{
TogglePlayerSpectating(PID, 0);
killstreak(PID, killerid);
DestroyDynamic3DTextLabel(wanted[killerid]);
return 1;
}
}

the dialog
Dialog:RandomDM(PID, response, listitem, inputtext[])
{
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(PID, playerName, sizeof(playerName));
if (response)
{
switch(listitem) // Check which option was chosen when they responded. We only have one for now. The next would be case 1, then case 2 and so on.
{
case 0:
{
InDM[PID] = true;
DM[PID] = 0;
SpawnPlayer(PID);
PlayerTextDrawHide(PID,Textdraw0);
PlayerTextDrawHide(PID,Textdraw1);
PlayerTextDrawHide(PID,Textdraw2);
PlayerTextDrawHide(PID,Textdraw3);
SetPlayerInterior(playerid, 17);
SetPlayerVirtualWorld(PID, 1);
}
}
format(string, sizeof(string), "{77B3D9}[DM Zones] {ffffff}%s(%i) has just entered {77B3D9}DM zone %i {ffffff}(/dm)", playerName, PID, DM[PID]);
scms(-1, string);
return 1; // ?? One you missed
}
return 0;
}

the command
CMD:dmlist(PID, params[])
{
Dialog_Show(PID, RandomDM, DIALOG_STYLE_LIST, "DM Zones", "DM 0 - Shamal", "Enter", "Cancel");
return 1;
}

another question,how make limit of room example if the maximum of room is 5 and other player cant go in

asri
06/08/2017, 10:38 AM
update

the console show this

[18:18:17] BUD::MultiGet returned:
money: 7450
kills: 0
deaths: 0
res: 0
[18:19:52] [debug] Run time error 4: "Array index out of bounds"
[18:19:52] [debug] Attempted to read/write array element at index 65535 in array of size 100
[18:19:52] [debug] AMX backtrace:
[18:19:52] [debug] #0 0003fcb0 in ?? (0, 65535) from a.amx
[18:19:52] [debug] #1 0003f52c in public WC_OnPlayerDeath (0, 65535, 55) from a.amx
[18:19:52] [debug] #2 00015f18 in ?? (0, 0, 65535, 55, 0, 0) from a.amx
[18:19:52] [debug] #3 0000196c in ?? (0, 0, -1082130432) from a.amx
[18:19:52] [debug] #4 00044eb0 in public cmd_kills (0, 6149920) from a.amx
[18:19:52] [debug] #5 native CallLocalFunction () from samp-server.exe
[18:19:52] [debug] #6 00000710 in public OnPlayerCommandText (0, 6149892) from a.amx

Misiur
06/08/2017, 10:42 AM
Wrap this:
killstreak(PID, killerid);
DestroyDynamic3DTextLabel(wanted[killerid]);
in check if killerid != invalid player id

asri
06/08/2017, 10:51 AM
you do you mean

update:

the compiler show this

Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

Header size: 9848 bytes
Code size: 356672 bytes
Data size: 6149596 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 6532500 bytes

asri
07/08/2017, 03:03 AM
help

asri
07/08/2017, 01:57 PM
help

asri
08/08/2017, 12:18 AM
Help.when i type kill command it show the crash console

Dayrion
08/08/2017, 12:37 AM
you do you mean

update:

the compiler show this

This is not related to the crash, I guess.
Show your logs please and have you updated your code since the Misiur's answer ?

asri
08/08/2017, 01:38 AM
you mean onplayerdeath.yes i update the code

Dayrion
08/08/2017, 12:55 PM
Let's show us your logs

asri
09/08/2017, 03:04 AM
the log show this after update the code.but when go dm,the room is blank when die in dm mode the print not show.

[10:29:39] OnPlayerDeath: playerid: 0, killerid; 65535, reason: 7
[10:32:45] OnPlayerDeath: playerid: 0, killerid; 65535, reason: 7
[10:33:12] OnPlayerDeath: playerid: 0, killerid; 65535, reason: 3
[10:33:47] OnPlayerDeath: playerid: 0, killerid; 65535, reason: %
[10:35:57] OnPlayerDeath: playerid: 0, killerid; 65535, reason: %

the code
public OnPlayerDeath(PID, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{

if(killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 4000);
scm(killerid, -1, "Congratulation!You have gained 4000$ and +2 score.");
SetPlayerScore(PID, GetPlayerScore(PID) -1);
GivePlayerMoney(PID, -2000);
scm(PID, -1, "You lost 2000$ because you noob.");
}

if(god_mode[PID] == 1)
{
god_mode[PID] = 0;
return 1;
}

if(killerid != INVALID_PLAYER_ID)
{
if(InDM[PID] == true)
{
if(anakko[PID] == 1)
{
anakko[PID] = 0;
if(makko[PID] != INVALID_PLAYER_ID)
TogglePlayerSpectating(PID, 1);
PlayerSpectatePlayer(PID, killerid);
SendClientMessage(PID, SKYBLUE , "You have been killed, you are now spectating your killer.");
SetTimerEx("EndDeathCam", 10000, false, "i", playerid);
}
else
{
TogglePlayerSpectating(PID, 0);
killstreak(PID, killerid);
DestroyDynamic3DTextLabel(wanted[killerid]);
return 1;
}
}
}

PlayerTextDrawHide(PID,Textdraw0);
PlayerTextDrawHide(PID,Textdraw1);
PlayerTextDrawHide(PID,Textdraw2);
PlayerTextDrawHide(PID,Textdraw3);

GameTextForPlayer(playerid,"~r~wasted",2000, 4);
gPlayerHasCitySelected[PID] = 0;
anakko[PID] = 1;
ClearAnimations(PID);
rBit2_Set(UnderWater, PID, false);
printf("OnPlayerDeath: playerid: %d, killerid; %d, reason: %s", playerid, killerid, reason);
return 1;
}
return 1;
}

in dm
http://i.imgur.com/YgYAphs.png

when leave dm.the player spawn but he fall first and then he spawn

http://i.imgur.com/R8jsa2E.png


http://i.imgur.com/IHTqd3v.png

asri
11/08/2017, 01:54 AM
help

asri
11/08/2017, 04:40 AM
help

asri
11/08/2017, 10:04 AM
anyone

Kane
11/08/2017, 10:52 AM
What's the current problem? Your post is a mess.

asri
11/08/2017, 11:19 AM
before i add the bud include the script is ok. Then, the player is death the gametext not show and log show this

[18:18:17] BUD::MultiGet returned:
money: 7450
kills: 0
deaths: 0
res: 0
[18:19:52] [debug] Run time error 4: "Array index out of bounds"
[18:19:52] [debug] Attempted to read/write array element at index 65535 in array of size 100
[18:19:52] [debug] AMX backtrace:
[18:19:52] [debug] #0 0003fcb0 in ?? (0, 65535) from a.amx
[18:19:52] [debug] #1 0003f52c in public WC_OnPlayerDeath (0, 65535, 55) from a.amx
[18:19:52] [debug] #2 00015f18 in ?? (0, 0, 65535, 55, 0, 0) from a.amx
[18:19:52] [debug] #3 0000196c in ?? (0, 0, -1082130432) from a.amx
[18:19:52] [debug] #4 00044eb0 in public cmd_kills (0, 6149920) from a.amx
[18:19:52] [debug] #5 native CallLocalFunction () from samp-server.exe
[18:19:52] [debug] #6 00000710 in public OnPlayerCommandText (0, 6149892) from a.amx

Dayrion; say update the code with this if(killerid != INVALID_PLAYER_ID)

like this

public OnPlayerDeath(PID, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{

if(killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 4000);
scm(killerid, -1, "Congratulation!You have gained 4000$ and +2 score.");
SetPlayerScore(PID, GetPlayerScore(PID) -1);
GivePlayerMoney(PID, -2000);
scm(PID, -1, "You lost 2000$ because you noob.");
}

if(god_mode[PID] == 1)
{
god_mode[PID] = 0;
return 1;
}

if(killerid != INVALID_PLAYER_ID)
{
if(InDM[PID] == true)
{
if(anakko[PID] == 1)
{
anakko[PID] = 0;
if(makko[PID] != INVALID_PLAYER_ID)
TogglePlayerSpectating(PID, 1);
PlayerSpectatePlayer(PID, killerid);
SendClientMessage(PID, SKYBLUE , "You have been killed, you are now spectating your killer.");
SetTimerEx("EndDeathCam", 10000, false, "i", playerid);
}
else
{
TogglePlayerSpectating(PID, 0);
killstreak(PID, killerid);
DestroyDynamic3DTextLabel(wanted[killerid]);
return 1;
}
}
}

PlayerTextDrawHide(PID,Textdraw0);
PlayerTextDrawHide(PID,Textdraw1);
PlayerTextDrawHide(PID,Textdraw2);
PlayerTextDrawHide(PID,Textdraw3);

GameTextForPlayer(playerid,"~r~wasted",2000, 4);
gPlayerHasCitySelected[PID] = 0;
anakko[PID] = 1;
ClearAnimations(PID);
rBit2_Set(UnderWater, PID, false);
printf("OnPlayerDeath: playerid: %d, killerid; %d, reason: %s", playerid, killerid, reason);
return 1;
}
return 1;
}

public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
if(god_mode[playerid])
return 0;

if(issuerid != INVALID_PLAYER_ID && bodypart == 9 && !IsPlayerAdmin(playerid))// I recommend defining bodyparts.
{
if(IsPlayerConnected(issuerid))
{
new string[100], pname[24];
GetPlayerName(PID, headshot, sizeof(headshot));
GetPlayerName(issuerid, pname, sizeof(pname));
format(string, sizeof(string), "%s(%i) was shot in the head by %s(%i)", headshot,PID, pname, issuerid);
scms(0x800000AA,string);
GameTextForPlayer(issuerid,"~r~HeadShot",2000,1);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);// There is already a ding sound that you can play when someone gets shot.
GameTextForPlayer(PID,"~r~HeadShot",2000,1);
ClearAnimations(PID);
ApplyAnimation(PID, "PED", "ko2", 4.1, 1, 1, 1, 1, 1, 1);// Redundant? People already play a custom animation when getting shot in the head and falling down in weapon-config.
PlayerPlaySound(PID, 17802, 0.0, 0.0, 0.0);// There is already a ding sound that you can play when someone gets shot.
GivePlayerMoney(issuerid, 1000);
amount = 0.0;// If you set the amount of damage to 0.0, it means that it kills the player. As is documented here: https://github.com/oscar-broman/samp-weapon-config#new-callbacks//Returning 1 to make sure that the damage gets applied right away.
return 1;
}
}
else printf("OnPlayerDamage: playerid: %d, issuerid; %d, weapon: %i ", playerid, issuerid, bodypart, weapon);
return 1;
}

i use Weapon config to make a headshot system.the log show this after update the code.but when go dm,the room is blank when die in dm mode the print not show and input lag.

[10:29:39] OnPlayerDeath: playerid: 0, killerid; 65535, reason: 7
[10:32:45] OnPlayerDeath: playerid: 0, killerid; 65535, reason: 7
[10:33:12] OnPlayerDeath: playerid: 0, killerid; 65535, reason: 3
[10:33:47] OnPlayerDeath: playerid: 0, killerid; 65535, reason: %
[10:35:57] OnPlayerDeath: playerid: 0, killerid; 65535, reason: %

in dm
http://i.imgur.com/YgYAphs.png

when leave dm.the player spawn but he fall first and then he spawn

http://i.imgur.com/R8jsa2E.png


http://i.imgur.com/IHTqd3v.png

Kane
11/08/2017, 12:06 PM
Your codes a literal mess.

Also, your first code. You're checking if it's an INVALID_PLAYER_ID three times.


public OnPlayerDeath(PID, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{

if(killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 4000);
scm(killerid, -1, "Congratulation!You have gained 4000$ and +2 score.");
SetPlayerScore(PID, GetPlayerScore(PID) -1);
GivePlayerMoney(PID, -2000);
scm(PID, -1, "You lost 2000$ because you noob.");
}

if(god_mode[PID] == 1)
{
god_mode[PID] = 0;
* return 1;
}

if(killerid != INVALID_PLAYER_ID)
{


What's even happening? What're you trying to do?

* You're returning true so if that was the instance then everything below wouldn't be called.

asri
11/08/2017, 12:54 PM
you mean like this
public OnPlayerDeath(PID, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{

if(gPlayerCitySelection[PID] == 1)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 4000);
scm(killerid, -1, "Congratulation!You have gained 4000$ and +2 score.");
SetPlayerScore(PID, GetPlayerScore(PID) -1);
GivePlayerMoney(PID, -2000);
scm(PID, -1, "You lost 2000$ because you noob.");
}

if(god_mode[PID] == 1)
{
god_mode[PID] = 0;
}

if(InDM[PID] == true)
{
if(anakko[PID] == 1)
{
anakko[PID] = 0;
if(makko[PID] != INVALID_PLAYER_ID)
TogglePlayerSpectating(PID, 1);
PlayerSpectatePlayer(PID, killerid);
SendClientMessage(PID, SKYBLUE , "You have been killed, you are now spectating your killer.");
SetTimerEx("EndDeathCam", 10000, false, "i", playerid);
}
else
{
TogglePlayerSpectating(PID, 0);
killstreak(PID, killerid);
DestroyDynamic3DTextLabel(wanted[killerid]);
return 1;
}
}
PlayerTextDrawHide(PID,Textdraw0);
PlayerTextDrawHide(PID,Textdraw1);
PlayerTextDrawHide(PID,Textdraw2);
PlayerTextDrawHide(PID,Textdraw3);

GameTextForPlayer(playerid,"~r~wasted",2000, 4);
gPlayerHasCitySelected[PID] = 0;
anakko[PID] = 1;
ClearAnimations(PID);
rBit2_Set(UnderWater, PID, false);
return 1;
}
else printf("OnPlayerDeath: playerid: %d, killerid; %d, reason: %s", playerid, killerid, reason);
return 1;
}

asri
11/08/2017, 04:24 PM
anyone

Kane
11/08/2017, 10:35 PM
if(InDM[PID] == true)
{
if(anakko[PID] == 1)
{
anakko[PID] = 0;
if(makko[PID] != INVALID_PLAYER_ID)
TogglePlayerSpectating(PID, 1);
PlayerSpectatePlayer(PID, killerid);
SendClientMessage(PID, SKYBLUE , "You have been killed, you are now spectating your killer.");
SetTimerEx("EndDeathCam", 10000, false, "i", playerid);
}


Remove this.

asri
12/08/2017, 04:46 AM
like this

public OnPlayerDeath(PID, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{

if(gPlayerCitySelection[PID] == 1)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 4000);
scm(killerid, -1, "Congratulation!You have gained 4000$ and +2 score.");
SetPlayerScore(PID, GetPlayerScore(PID) -1);
GivePlayerMoney(PID, -2000);
scm(PID, -1, "You lost 2000$ because you noob.");
}

if(god_mode[PID] == 1)
{
god_mode[PID] = 0;
}

if(InDM[PID] == true)
{
if(anakko[PID] == 1)
{
anakko[PID] = 0;
TogglePlayerSpectating(PID, 1);
PlayerSpectatePlayer(PID, killerid);
SendClientMessage(PID, SKYBLUE , "You have been killed, you are now spectating your killer.");
SetTimerEx("EndDeathCam", 10000, false, "i", playerid);
}
else
{
TogglePlayerSpectating(PID, 0);
killstreak(PID, killerid);
DestroyDynamic3DTextLabel(wanted[killerid]);
return 1;
}
}
PlayerTextDrawHide(PID,Textdraw0);
PlayerTextDrawHide(PID,Textdraw1);
PlayerTextDrawHide(PID,Textdraw2);
PlayerTextDrawHide(PID,Textdraw3);

GameTextForPlayer(playerid,"~r~wasted",2000, 4);
gPlayerHasCitySelected[PID] = 0;
anakko[PID] = 1;
ClearAnimations(PID);
rBit2_Set(UnderWater, PID, false);
return 1;
}
else printf("OnPlayerDeath: playerid: %d, killerid; %d, reason: %s", playerid, killerid, reason);
return 1;
}

Kane
12/08/2017, 06:40 AM
Remove the return 1; under DestroyDynamic3DTextLabel.

You're posting code all over again but you're not explaining if an errors occurring.

What's the problem now?

asri
12/08/2017, 10:35 AM
the code like this

public OnPlayerDeath(PID, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{

if(gPlayerCitySelection[PID] == 1)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 4000);
scm(killerid, -1, "Congratulation!You have gained 4000$ and +2 score.");
SetPlayerScore(PID, GetPlayerScore(PID) -1);
GivePlayerMoney(PID, -2000);
scm(PID, -1, "You lost 2000$ because you noob.");
}
if(god_mode[PID] == 1)
{
god_mode[PID] = 0;
}

if(InDM[playerid] == true)
{
killstreak(playerid, killerid);
DestroyDynamic3DTextLabel(wanted[playerid]);
return 1;
}
PlayerTextDrawHide(PID,Textdraw0);
PlayerTextDrawHide(PID,Textdraw1);
PlayerTextDrawHide(PID,Textdraw2);
PlayerTextDrawHide(PID,Textdraw3);

GameTextForPlayer(playerid,"~r~wasted",2000, 4);
gPlayerHasCitySelected[PID] = 0;
ClearAnimations(PID);
rBit2_Set(UnderWater, PID, false);
return 1;
}
else printf("OnPlayerDeath: playerid: %d, killerid; %d, reason: %s", playerid, killerid, reason);
return 1;
}

but the gametext not show.when i go to dm mode.the spawn place not in shamal
http://weedarr.wdfiles.com/local--files/interior/Shamal.jpg

it like conflict with other spawn place

asri
12/08/2017, 09:46 PM
Anyone

asri
13/08/2017, 08:32 AM
help.i dont no to fix conflict spawn freeroam or deathmatach mode