Player death problem
#1

I Have made this
Код:
public OnPlayerDeath(playerid, killerid, reason) {
	SendClientMessage(killerid, COLOR_ORANGE, "Good job gangsta! You smoked the nigga! [+$2500 +1 Score]");
	GivePlayerMoney(killerid, 2500);
	SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
	
	GivePlayerMoney(playerid, -1000);
	
	SendDeathMessage(killerid, playerid, reason);
	
	return 1;
}
It give us score and money when we kill but the problem is when he hit the enemy with car and he is not killed, it give us score and money or sometimes automatically without killing enemy it give us score and money.. how to fix that??
Reply
#2

Something Like:
PHP код:
public OnPlayerDeath(playeridkilleridreason) {
    new 
id GetPlayerVehicleID(playerid);
    if(
IsPlayerInVehicle(killerid,id))
    
SendClientMessage(killeridCOLOR_ORANGE"Good job gangsta! You smoked the nigga! [+$2500 +1 Score]");
    
GivePlayerMoney(killerid2500);
    
SetPlayerScore(killeridGetPlayerScore(killerid) + 1);

    
GivePlayerMoney(playerid, -1000);

    
SendDeathMessage(killeridplayeridreason);

    return 
1;

Reply
#3

ahh can you tell me what you did -whiteGhost
Reply
#4

Quote:
Originally Posted by HassanShah
Посмотреть сообщение
ahh can you tell me what you did -whiteGhost
Код:
    new id = GetPlayerVehicleID(playerid);
    if(IsPlayerInVehicle(killerid,id))
Get the vehicleid,& check if the killer is in a vehicle when he kills the other player.
Reply
#5

Quote:
Originally Posted by WhiteGhost
Посмотреть сообщение
Код:
    new id = GetPlayerVehicleID(playerid);
    if(IsPlayerInVehicle(killerid,id))
Get the vehicleid,& check if the killer is in a vehicle when he kills the other player.
You checking if killerid is in playerid's vehicle
Reply
#6

No you didn't understand me... I don't want that... you see problem is I just ram the enemy and he is not killed and it gives me score and money. Sometimes I am just doing things not killing and automatically it gives me this msg and I got 1 score and money for killing but in fact I didn't kill anybody...
Reply
#7

try this
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    if(
killerid != INVALID_PLAYER_ID)
    {
        
SendClientMessage(killeridCOLOR_ORANGE"Good job gangsta! You smoked the nigga! [+$2500 +1 Score]");
        
GivePlayerMoney(killerid2500);
        
SetPlayerScore(killeridGetPlayerScore(killerid) + 1);
        
GivePlayerMoney(playerid, -1000);
        
SendDeathMessage(killeridplayeridreason);
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)