OnplayerDeath -
STONEGOLD - 05.07.2015
PHP код:
if(gTeam{playerid} == CIVILIANS && gTeam{playerid} == MEDICS)
{
if(GetPlayerWantedLevel(playerid) >= 4)
{
if(gTeam{killerid} == COPS)
{
new pay = random(1500) + 3000;
new string[356], string1[100], string2[256];
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
format(string, sizeof(string), "%s (%d) has been taken down by Officer %s (%d)!",GetName(playerid),playerid,GetName(killerid),killerid);
SendClientMessageToAll(COLOR_CYAN,string);
format(string1, sizeof(string1), "You have been taken down by %s (%d). You lose: $%d",GetName(killerid),killerid, pay);
SendClientMessage(playerid,COLOR_CYAN,string1);
format(string2, sizeof(string2), "You have taken down %s (%d). You received: $%d ",GetName(playerid),playerid, pay);
SendClientMessage(killerid,COLOR_CYAN,string2);
GoToJail{playerid} = true;
GivePlayerCashEx(killerid, pay);
GivePlayerCashEx(playerid, -pay);
return 1;
}
}
}
What's wrong with it/? It doesn't send player to jail nor i get any msg.
Re: OnplayerDeath -
MasonSFW - 05.07.2015
Show code your callback function ?
Re: OnplayerDeath -
Threshold - 05.07.2015
pawn Код:
if(gTeam{playerid} == CIVILIANS && gTeam{playerid} == MEDICS)
How can gTeam be CIVILIANS 'and' MEDICS? I think you mean:
pawn Код:
if(gTeam{playerid} == CIVILIANS || gTeam{playerid} == MEDICS)
&& = and
|| = or
Re: OnplayerDeath -
liquor - 05.07.2015
pawn Код:
if(gTeam{playerid} == CIVILIANS && gTeam{playerid} == MEDICS)
{
if(GetPlayerWantedLevel(playerid) >= 4)
{
if(gTeam{killerid} == COPS)
So, you will only go to jail if;
- You're a CIVILIAN and a MEDIC
- Your wanted level is 4 or above
- If the killer is a cop
Re: OnplayerDeath -
STONEGOLD - 05.07.2015
PHP код:
if(gTeam{killerid} == COPS || gTeam{killerid} == FBI || gTeam{killerid} == CIA || gTeam{killerid} == ARMY)
{
if(GetPlayerWantedLevel(playerid) >= 4)
{
new pay = random(1500) + 3000;
new string[356], string1[100], string2[256];
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
format(string, sizeof(string), "%s (%d) has been taken down by Officer %s (%d)!",GetName(playerid),playerid,GetName(killerid),killerid);
SendClientMessageToAll(COLOR_CYAN,string);
format(string1, sizeof(string1), "You have been taken down by %s (%d). You lose: $%d",GetName(killerid),killerid, pay);
SendClientMessage(playerid,COLOR_CYAN,string1);
format(string2, sizeof(string2), "You have taken down %s (%d). You received: $%d ",GetName(playerid),playerid, pay);
SendClientMessage(killerid,COLOR_CYAN,string2);
GoToJail{playerid} = true;
return 1;
}
}
I changed to this but still not working.
TESTED LIKE THIS TOO but not working
PHP код:
if(gTeam{playerid} == CIVILIANS && gTeam{killerid} == COPS || gTeam{killerid} == FBI || gTeam{killerid} == CIA || gTeam{killerid} == ARMY)
{
if(GetPlayerWantedLevel(playerid) >= 4)
{
new pay = random(1500) + 3000;
new string[356], string1[100], string2[256];
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
format(string, sizeof(string), "%s (%d) has been taken down by Officer %s (%d)!",GetName(playerid),playerid,GetName(killerid),killerid);
SendClientMessageToAll(COLOR_CYAN,string);
format(string1, sizeof(string1), "You have been taken down by %s (%d). You lose: $%d",GetName(killerid),killerid, pay);
SendClientMessage(playerid,COLOR_CYAN,string1);
format(string2, sizeof(string2), "You have taken down %s (%d). You received: $%d ",GetName(playerid),playerid, pay);
SendClientMessage(killerid,COLOR_CYAN,string2);
GoToJail{playerid} = true;
return 1;
}
}
Re: OnplayerDeath -
Roberto80 - 05.07.2015
Uhm, if(gTeam{playerid} == ....
Why {playerid}? Lol
Use [playerid]
Also this isn't correct,you can't be in 2 different teams,maybe its a rank or class
Re : OnplayerDeath -
Terrorizt - 05.07.2015
Код:
if(gTeam[killerid] == COPS || gTeam[killerid] == FBI || gTeam[killerid] == CIA || gTeam[killerid] == ARMY)
{
if(GetPlayerWantedLevel(playerid) >= 4)
{
new pay = random(1500) + 3000;
new string[356], string1[100], string2[256];
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
format(string, sizeof(string), "%s (%d) has been taken down by Officer %s (%d)!",GetName(playerid),playerid,GetName(killerid),killerid);
SendClientMessageToAll(COLOR_CYAN,string);
format(string1, sizeof(string1), "You have been taken down by %s (%d). You lose: $%d",GetName(killerid),killerid, pay);
SendClientMessage(playerid,COLOR_CYAN,string1);
format(string2, sizeof(string2), "You have taken down %s (%d). You received: $%d ",GetName(playerid),playerid, pay);
SendClientMessage(killerid,COLOR_CYAN,string2);
GoToJail{playerid} = true;
return 1;
}
}
If this didn't work then it's a problem of teams.
Re: OnplayerDeath -
Threshold - 05.07.2015
pawn Код:
if(killerid != INVALID_PLAYER_ID)
{
if(gTeam{killerid} == COPS || gTeam{killerid} == FBI || gTeam{killerid} == CIA || gTeam{killerid} == ARMY)
{
if(gTeam{playerid} == CIVILIAN || gTeam{playerid} == MEDIC)
{
if(GetPlayerWantedLevel(playerid) >= 4)
{
new pay = random(1500) + 3000, string[95];
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
format(string, sizeof(string), "%s (%d) has been taken down by Officer %s (%d)!", GetName(playerid), playerid, GetName(killerid), killerid);
SendClientMessageToAll(COLOR_CYAN, string);
format(string, sizeof(string), "You have been taken down by %s (%d). You lose: $%d", GetName(killerid), killerid, pay);
SendClientMessage(playerid, COLOR_CYAN, string);
format(string, sizeof(string), "You have taken down %s (%d). You received: $%d ", GetName(playerid), playerid, pay);
SendClientMessage(killerid, COLOR_CYAN, string);
GoToJail{playerid} = true;
//GivePlayerMoney(killerid, pay);
//GivePlayerMoney(playerid, -pay);
}
}
}
}
If that doesn't work, then please show me your entire OnPlayerDeath callback.
Re: OnplayerDeath -
STONEGOLD - 05.07.2015
Well, Thanks guyz. Sorry thresold I couldn't give you rep. because i already gave to roberto and terrorizt.
The problem was {}. I have to use [] instead of {}.
Well, One more thing. In my script if player has 6 stars and shoot others players so other players doesn't lose health. it's because of wanted level cuz it works with 5 stars but whenever i put 6 stars then shoot other players so it doesn't take health other players health. What do you think what code it be like? and on where? i mean onplayerupdate? or what. Where it could be
Re: OnplayerDeath -
Threshold - 05.07.2015
OnPlayerWeaponShot would be useful.
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
if(hitid != INVALID_PLAYER_ID)
{
if(GetPlayerWantedLevel(playerid) >= 6) return 0;
}
}
return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot