SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/02/2020, 01:30 PM   #1
murilo2929
Huge Clucker
 
Join Date: Oct 2018
Posts: 216
Reputation: 2
Question Error when die

So, i'm having that error when player die


public

Code:
public OnPlayerSpawn (playerid) {
	SetPlayerTeam (playerid, 1);
	KillTimer (TimerIngresoTiempo [playerid]);
    NoSeLogeo [playerid] = 1;
	if (! IsPlayerConnectedEx (playerid) &&! IsPlayerNPC (playerid)) return (_Mensaje (playerid, 0, "3", "Foi expulso, não saiu corretamente."), Kick (playerid));
	_OnPlayerSpawn (playerid);
	retornar 1;
}
murilo2929 is offline   Reply With Quote
Old 15/02/2020, 01:53 PM   #2
ShadowMortar
Big Clucker
 
ShadowMortar's Avatar
 
Join Date: Jul 2016
Location: Croatia
Posts: 166
Reputation: 31
Default Re: Error when die

Compile the script with "-d3" and run server.exe, after error occures, you will get an exact line in server.log.
Example:

AMX backtrace:
BLA BLA BLA from RP.amx:3333
__________________
Quote:
Originally Posted by CheezIt View Post
Follow your heart and own style.
Feel free to PM me if you need help.
ShadowMortar is offline   Reply With Quote
Old 15/02/2020, 02:19 PM   #3
murilo2929
Huge Clucker
 
Join Date: Oct 2018
Posts: 216
Reputation: 2
Default Re: Error when die

Quote:
Originally Posted by ShadowMortar View Post
Compile the script with "-d3" and run server.exe, after error occures, you will get an exact line in server.log.
Example:

AMX backtrace:
BLA BLA BLA from RP.amx:3333
where i put the -d3?
murilo2929 is offline   Reply With Quote
Old 15/02/2020, 02:39 PM   #4
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,075
Reputation: 174
Default Re: Error when die

Read your previous thread: https://forum.sa-mp.com/showthread.php?t=672138
__________________
Calisthenics is offline   Reply With Quote
Old 15/02/2020, 03:01 PM   #5
ShadowMortar
Big Clucker
 
ShadowMortar's Avatar
 
Join Date: Jul 2016
Location: Croatia
Posts: 166
Reputation: 31
Default Re: Error when die

Quote:
Originally Posted by murilo2929 View Post
where i put the -d3?
Go to pawno/OPEN OR CREATE pawn.cfg
Inside of pawn.cfg write "-d3" and save the file.
Open pawno.exe as an administrator, or don't, and compile the script.
__________________
Quote:
Originally Posted by CheezIt View Post
Follow your heart and own style.
Feel free to PM me if you need help.
ShadowMortar is offline   Reply With Quote
Old 15/02/2020, 03:23 PM   #6
murilo2929
Huge Clucker
 
Join Date: Oct 2018
Posts: 216
Reputation: 2
Default Re: Error when die

Quote:
Originally Posted by ShadowMortar View Post
Go to pawno/OPEN OR CREATE pawn.cfg
Inside of pawn.cfg write "-d3" and save the file.
Open pawno.exe as an administrator, or don't, and compile the script.
Thats appear


That is what have in 21742 line
Code:
				set_pos(playerid, point_muerte[id][x_spawn], point_muerte[id][y_spawn], point_muerte[id][z_spawn], point_muerte[id][angle_spawn], 0, 0);
and in 21446
Code:
return 1;
murilo2929 is offline   Reply With Quote
Old 15/02/2020, 03:30 PM   #7
murilo2929
Huge Clucker
 
Join Date: Oct 2018
Posts: 216
Reputation: 2
Default Re: Error when die

Quote:
Originally Posted by Calisthenics View Post
hey cali ty for your reply, bro i don't found the user [playerid] [Vehicle] value like you say
murilo2929 is offline   Reply With Quote
Old 15/02/2020, 05:53 PM   #8
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,075
Reputation: 174
Default Re: Error when die

Quote:
Originally Posted by murilo2929 View Post
hey cali ty for your reply, bro i don't found the user [playerid] [Vehicle] value like you say
The error is in the last line because `is_player_spawn` returned -1.
pawn Code:
new id = is_player_spawn(playerid);
set_pos(playerid, point_muerte[id][x_spawn], point_muerte[id][y_spawn], point_muerte[id][z_spawn], point_muerte[id][angle_spawn], 0, 0);

If you reset to -1, this could happen but as the name describes the function should return a true/false only. Post `is_player_spawn` function.
__________________
Calisthenics is offline   Reply With Quote
Old 15/02/2020, 08:00 PM   #9
murilo2929
Huge Clucker
 
Join Date: Oct 2018
Posts: 216
Reputation: 2
Default Re: Error when die

Quote:
Originally Posted by Calisthenics View Post
The error is in the last line because `is_player_spawn` returned -1.
pawn Code:
new id = is_player_spawn(playerid);
set_pos(playerid, point_muerte[id][x_spawn], point_muerte[id][y_spawn], point_muerte[id][z_spawn], point_muerte[id][angle_spawn], 0, 0);

If you reset to -1, this could happen but as the name describes the function should return a true/false only. Post `is_player_spawn` function.
Code:
is_player_spawn(playerid)
{
	new Float:distance = 99999.0,
		Float:tmp_distance,
		closest = -1;

	for(new i = 1; i < 3; i++)
	{
		tmp_distance = GetPlayerDistanceFromPoint(playerid, point_muerte[i][x_spawn], point_muerte[i][y_spawn], point_muerte[i][z_spawn]);
		if (tmp_distance < distance)
		{
			distance = tmp_distance;
			closest = i;
		}
	}
	return closest;
}
murilo2929 is offline   Reply With Quote
Old 16/02/2020, 09:42 AM   #10
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,075
Reputation: 174
Default Re: Error when die

Are the data in `point_muerte` array correct? I am not sure how any distance returned by `GetPlayerDistanceFromPoint` function will be greater than 99999.0 to fail the if statement but I can tell you how to prevent the run time error.

pawn Code:
new id = is_player_spawn(playerid);
if (id != -1)
{
    set_pos(playerid, point_muerte[id][x_spawn], point_muerte[id][y_spawn], point_muerte[id][z_spawn], point_muerte[id][angle_spawn], 0, 0);
}
else
{
    // set a default spawn point in case it returns -1 again.
}
__________________
Calisthenics is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 017: undefined symbol,fatal error 107: too many error messages on one line Slicebook Scripting Help 11 04/05/2014 08:30 PM
An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds.... rati555 Scripting Help 1 14/09/2012 07:45 PM
Registered plate stock error 'error 076: syntax error in the expression, or invalid function call' Deal-or-die Scripting Help 2 25/06/2012 03:12 PM
Error message: : error 030: compound statement not closed at the end of file (started at line 170) the_zohan Scripting Help 5 04/06/2012 08:38 AM
I get tagmismatch error, But i cant find any error error Swiftz Help Archive 1 16/04/2011 04:31 AM


All times are GMT. The time now is 12:02 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.