OnPlayerDeath
#1

I cant get this to work, i have test some other code with no success.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehiclekillerid))
    {
   	 SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
    }
    else
    {
		new cadena[256];
		new name[MAX_PLAYER_NAME];
 		new name2[MAX_PLAYER_NAME];
		new Float:px,Float:py,Float:pz;
		GetPlayerPos(playerid, px, py, pz);
		gPlayerSpawned[playerid] = 0;
		GetPlayerName(playerid, name, sizeof(name));
		GetPlayerName(killerid, name2, sizeof(name2));
		SendDeathMessage(killerid, playerid, reason);
		if(PlayerInfo[playerid][pGang] != PlayerInfo[killerid][pGang])
		PlayerInfo[killerid][pKills] += 1;
		PlayerInfo[playerid][pDeaths] += 1;
		format(cadena,255,"%s killed %s",name2,name);
		SendClientMessageToAll(COLOR_NICERED, cadena);
     }
    	return 1;
}
What im trying to do is that if YOU are in a vehicle, and your enemy also is IN a vehicle YOU get +1 in score for killng him. and same if YOUR not in a vehicle and your enemy IS in a vehicle you also get +1 in score for killing him, you understand what i mean? right now you only get +1 score if you kill a enemy who is NOT in a vehicle with YOUR vehicle, or if none is in a vehicle :S
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehicle(playerid)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
    }
    new cadena[256];
    new name[MAX_PLAYER_NAME];
    new name2[MAX_PLAYER_NAME];
    new Float:px,Float:py,Float:pz;
    GetPlayerPos(playerid, px, py, pz);
    gPlayerSpawned[playerid] = 0;
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(killerid, name2, sizeof(name2));
    SendDeathMessage(killerid, playerid, reason);
    if(PlayerInfo[playerid][pGang] != PlayerInfo[killerid][pGang])
    {
        PlayerInfo[killerid][pKills] += 1;
        PlayerInfo[playerid][pDeaths] += 1;
        format(cadena,255,"%s killed %s",name2,name);
        SendClientMessageToAll(COLOR_NICERED, cadena);
    }
    return 1;
}
EDIT #2
Reply
#3

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehicle(playerid)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
    }
    new cadena[256];
    new name[MAX_PLAYER_NAME];
    new name2[MAX_PLAYER_NAME];
    new Float:px,Float:py,Float:pz;
    GetPlayerPos(playerid, px, py, pz);
    gPlayerSpawned[playerid] = 0;
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(killerid, name2, sizeof(name2));
    SendDeathMessage(killerid, playerid, reason);
    if(PlayerInfo[playerid][pGang] != PlayerInfo[killerid][pGang])
    {
        PlayerInfo[killerid][pKills] += 1;
        PlayerInfo[playerid][pDeaths] += 1;
        format(cadena,255,"%s killed %s",name2,name);
        SendClientMessageToAll(COLOR_NICERED, cadena);
    }
    return 1;
}
EDIT #2
Thanks! but i got only one error on line 304 "{" under "if" error 001: expected token: ")", but found "{"
Reply
#4

Add another ) to
pawn Код:
if(IsPlayerInAnyVehicle(playerid)
Like this;

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
Reply
#5

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
Add another ) to
pawn Код:
if(IsPlayerInAnyVehicle(playerid)
Like this;

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
You still not get a score when you kill someone who is in a vehicle, or if both is in a vehicle :O
You only get a score when you kill someone who not use a vehicle.
Im going crazy soon
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)