OnPlayerDeath - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerDeath (
/showthread.php?tid=168352)
OnPlayerDeath -
cruising - 15.08.2010
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
Re: OnPlayerDeath -
Mike Garber - 15.08.2010
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
Re: OnPlayerDeath -
cruising - 15.08.2010
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 "{"
Re: OnPlayerDeath -
Mike Garber - 15.08.2010
Add another ) to
pawn Код:
if(IsPlayerInAnyVehicle(playerid)
Like this;
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
Re: OnPlayerDeath -
cruising - 16.08.2010
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