Why onplayerdeath don't work?
#1

pawn Код:
if(RobDoing[playerid] == 1)
    {  
    if(IsACop(killerid)) //omrat de gabor
    {
        GameTextForPlayer(playerid, "~R~Jefuirea a esuat..", 5000, 3)
        new baniafacere = MoneyVault[playerid];                        
        new b = IdAfacere[playerid];
        SBizzInfo[b][sbTill] += baniafacere;
        RobDoing[playerid] = 0;
        MoneyVault[playerid] = 0;
        IdAfacere[playerid] = 0;
        SBizzInfo[b][sbJefuita] = 1;       
        DisablePlayerCheckpoint(playerid);
        new recompensa = SBizzInfo[b][sbTill] / 2
        format(string, sizeof(string), "{FFFFFF}(({6699FF} Ai primt de la propietarul afaceri deoarece ai prins hotul {009933}%d$ {6699FF} la salariul factiuni {FFFFFF} ))", recompensa);
        SendClientMessage(killerid, COLOR_GRAD5, string);      
        GivePlayerMoney(killerid, recompensa);
        //PlayerInfo[killerid][pSalariuAfacere] += recompensa;     
    }
    else if(killerid == INVALID_PLAYER_ID) //sinucidere
    {
        GameTextForPlayer(playerid, "~R~Jefuirea a esuat..", 5000, 3)
        new baniafacere = MoneyVault[playerid];
        new b = IdAfacere[playerid];
        SBizzInfo[b][sbTill] += baniafacere;
        RobDoing[playerid] = 0;
        MoneyVault[playerid] = 0;
        IdAfacere[playerid] = 0;
        SBizzInfo[b][sbJefuita] = 1;       
        DisablePlayerCheckpoint(playerid);
    }  
    }
HE DOn't WORK
Reply
#2

What are the errors being shown in the compiler?
Reply
#3

no , none problem (( simple don't work when dead
Reply
#4

look at this:
https://sampwiki.blast.hk/wiki/OnPlayerDeath

When using killerid u have to check
pawn Код:
if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
other wise strange things happen
have had this too


->
pawn Код:
if(RobDoing[playerid] == 1)
    {
   if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
    if(IsACop(killerid)) //omrat de gabor
    {
        GameTextForPlayer(playerid, "~R~Jefuirea a esuat..", 5000, 3);  
        new baniafacere = MoneyVault[playerid];                        
        new b = IdAfacere[playerid];
        SBizzInfo[b][sbTill] += baniafacere;
        RobDoing[playerid] = 0;
        MoneyVault[playerid] = 0;
        IdAfacere[playerid] = 0;
        SBizzInfo[b][sbJefuita] = 1;        
        DisablePlayerCheckpoint(playerid);
        new recompensa = SBizzInfo[b][sbTill] / 2
        format(string, sizeof(string), "{FFFFFF}(({6699FF} Ai primt de la propietarul afaceri deoarece ai prins hotul {009933}%d$ {6699FF} la salariul factiuni {FFFFFF} ))", recompensa);
        SendClientMessage(killerid, COLOR_GRAD5, string);      
        GivePlayerMoney(killerid, recompensa);
        //PlayerInfo[killerid][pSalariuAfacere] += recompensa;      
    }
    else if(killerid == INVALID_PLAYER_ID) //sinucidere
    {
        GameTextForPlayer(playerid, "~R~Jefuirea a esuat..", 5000, 3);  
        new baniafacere = MoneyVault[playerid];
        new b = IdAfacere[playerid];
        SBizzInfo[b][sbTill] += baniafacere;
        RobDoing[playerid] = 0;
        MoneyVault[playerid] = 0;
        IdAfacere[playerid] = 0;
        SBizzInfo[b][sbJefuita] = 1;        
        DisablePlayerCheckpoint(playerid);
    }  
}
    }
Sorry for identation
Reply
#5

WTF! RIGHT NOW i test some systems NONE WORK who use onplayerdeath!! PLEASE HELP (
http://pastebin.com/sEbAu7JF <--
Reply
#6

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new
		msg[128],
		killerName[MAX_PLAYER_NAME],
		reasonMsg[32],
		playerName[MAX_PLAYER_NAME];
	GetPlayerName(killerid, killerName, sizeof(killerName));
	GetPlayerName(playerid, playerName, sizeof(playerName));
	if (killerid != INVALID_PLAYER_ID)
	{
		switch (reason)
		{
			case 0:
			{
				reasonMsg = "Unarmed";
			}
			case 1:
			{
				reasonMsg = "Brass Knuckles";
			}
			case 2:
			{
				reasonMsg = "Golf Club";
			}
			case 3:
			{
				reasonMsg = "Night Stick";
			}
			case 4:
			{
				reasonMsg = "Knife";
			}
			case 5:
			{
				reasonMsg = "Baseball Bat";
			}
			case 6:
			{
				reasonMsg = "Shovel";
			}
			case 7:
			{
				reasonMsg = "Pool Cue";
			}
			case 8:
			{
				reasonMsg = "Katana";
			}
			case 9:
			{
				reasonMsg = "Chainsaw";
			}
			case 10:
			{
				reasonMsg = "Dildo";
			}
			case 11:
			{
				reasonMsg = "Dildo";
			}
			case 12:
			{
				reasonMsg = "Vibrator";
			}
			case 13:
			{
				reasonMsg = "Vibrator";
			}
			case 14:
			{
				reasonMsg = "Flowers";
			}
			case 15:
			{
				reasonMsg = "Cane";
			}
			case 22:
			{
				reasonMsg = "Pistol";
			}
			case 23:
			{
				reasonMsg = "Silenced Pistol";
			}
			case 24:
			{
				reasonMsg = "Desert Eagle";
			}
			case 25:
			{
				reasonMsg = "Shotgun";
			}
			case 26:
			{
				reasonMsg = "Sawn-off Shotgun";
			}
			case 27:
			{
				reasonMsg = "Combat Shotgun";
			}
			case 28:
			{
				reasonMsg = "MAC-10";
			}
			case 29:
			{
				reasonMsg = "MP5";
			}
			case 30:
			{
				reasonMsg = "AK-47";
			}
			case 31:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 447:
						{
							reasonMsg = "Sea Sparrow Machine Gun";
						}
						default:
						{
							reasonMsg = "M4";
						}
					}
				}
				else
				{
					reasonMsg = "M4";
				}
			}
			case 32:
			{
				reasonMsg = "TEC-9";
			}
			case 33:
			{
				reasonMsg = "Rifle";
			}
			case 34:
			{
				reasonMsg = "Sniper Rifle";
			}
			case 37:
			{
				reasonMsg = "Fire";
			}
			case 38:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 425:
						{
							reasonMsg = "Hunter Machine Gun";
						}
						default:
						{
							reasonMsg = "Minigun";
						}
					}
				}
				else
				{
					reasonMsg = "Minigun";
				}
			}
			case 41:
			{
				reasonMsg = "Spraycan";
			}
			case 42:
			{
				reasonMsg = "Fire Extinguisher";
			}
			case 49:
			{
				reasonMsg = "Vehicle Collision";
			}
			case 50:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563:
						{
							reasonMsg = "Helicopter Blades";
						}
						default:
						{
							reasonMsg = "Vehicle Collision";
						}
					}
				}
				else
				{
					reasonMsg = "Vehicle Collision";
				}
			}
			case 51:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 425:
						{
							reasonMsg = "Hunter Rockets";
						}
						case 432:
						{
							reasonMsg = "Rhino Turret";
						}
						case 520:
						{
							reasonMsg = "Hydra Rockets";
						}
						default:
						{
							reasonMsg = "Explosion";
						}
					}
				}
				else
				{
					reasonMsg = "Explosion";
				}
			}
			default:
			{
				reasonMsg = "Unknown";
			}
		}
		format(msg, sizeof(msg), "04*** %s killed %s. (%s)", killerName, playerName, reasonMsg);
	}
	else
	{
		switch (reason)
		{
			case 53:
			{
				format(msg, sizeof(msg), "04*** %s died. (Drowned)", playerName);
			}
			case 54:
			{
				format(msg, sizeof(msg), "04*** %s died. (Collision)", playerName);
			}
			default:
			{
				format(msg, sizeof(msg), "04*** %s died.", playerName);
			}
		}
	}
	SendClientMessageToAll(0xDEEE20FF, msg);
return 1;
}
Reply
#7

upp!!!
Reply
#8

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)