Beanbag shot crashes server(+rep)
#1

When i shoot a player with a beanbag, server crashes and restarts, here is my code i have a custom damage script under onplayertakedamage and it is new, once i implemented it, the beanbag and taser stopped working. I have case 25(shotgun). The first part is my check if Beanbag is active, and if player is not beanbagged already then it does the code, server crashed on the shot with /rubberbullets activated, the player doesnt do an animation ethier, it crashes by then.i have no idea what is wrong with my code.


Код:
			case 25:
    		{
	    		if(BeanbagActive{issuerid})
				{
					if(!Beanbag{playerid})
					{
						OnAnim{playerid} = true;
						ApplyAnimation(playerid, "SWEET", "Sweet_injuredloop", 4.0,0,0,0,1,0);
						ActionMessage(playerid, 20.0, "was hit by a rubber bullet and falls on the ground");
						SCM(playerid, COLOR_WHITE, "You have just been hit by a rubber bullet shotgun. You will be able to get up in 15 seconds.");
						Beanbag{playerid} = true;
						SetTimerEx("BeanbagReset", 15000, false, "i", playerid);
						SCM(issuerid, COLOR_YELLOWG, "HINT: You hit %s with a rubber bullet!", GetName(playerid));
					}
					else
					{
						SCM(issuerid, COLOR_LIGHTRED, "This player has already been hit with a beanbag.");
					}
				}
				else
				{
  					GetPlayerPos(playerid, x, y, z);
            		distance = GetPlayerDistanceFromPoint(issuerid, x, y, z);
            		if (distance <= 10) damage = 64;
            		if (distance > 10 && distance < 20.0) damage = 54;
            		if (distance >= 20.0 && distance < 30.0) damage = 43;
            		if (distance >= 30.0) damage = 35;
				}
    		}
Reply
#2

Hello!

Take this plugin (https://sampforum.blast.hk/showthread.php?tid=262796) and then show us the code which is going to print in the server console when the server crash.
Reply
#3

I was just about to edit my post and put my crash log from crashdetect in console,

Код:
[02:49:02] [debug] Server crashed while executing Divergent.amx
[02:49:02] [debug] AMX backtrace:
[02:49:02] [debug] #0 native SendClientMessage () [080d94b0] from samp03svr
[02:49:02] [debug] #1 000f0e50 in public OnPlayerTakeDamage (playerid=4, issuerid=7, Float:amount=49.50000, weaponid=25, bodypart=5) at Divergent\gamemodes\Divergent.pwn:15813
Reply
#4

PHP код:
SCM(issueridCOLOR_YELLOWG"HINT: You hit %s with a rubber bullet!"GetName(playerid)); 
You have to format this message.

PHP код:
new string[145];
format(string,sizeof(string),"HINT: You hit %s with a rubber bullet!",GetName(playerid));
SCM(issuerid,COLOR_YELLOWG,string); 
Reply
#5

Ohh. What a simple mistake. Thank you alot. =repped you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)