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=157445)
OnPlayerDeath -
Sir_bomber - 06.07.2010
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(MArea[playerid] == 1)
{
(GetPlayerColor(playerid) == blue) //here is the 1. error
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 0);
}
return 1;
}
else if(GetPlayerColor(playerid) == red)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
return 1;
}
if(MArea[playerid] == 2)
{
(GetPlayerColor(playerid) == red) // here is the 2. error
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 0);
}
return 1;
}
else if
(GetPlayerColor(playerid) == blue)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
return 1;
}
if(MArea[playerid] == 0)
if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
GameTextForPlayer(killerid, "Killer", 4000, 4);
GameTextForPlayer(playerid, "~b~OMG you ~r~died! ~g~haha!", 500, 1);
SendDeathMessage(killerid, playerid, reason);
return 1;
}
Код:
C:\Documents and Settings\ben\Desktop\Server\filterscripts\cmds.pwn(249 -- 250) : error 029: invalid expression, assumed zero
C:\Documents and Settings\ben\Desktop\Server\filterscripts\cmds.pwn(262 -- 263) : error 029: invalid expression, assumed zero
Okey, when player is in MArea 1 a player cant get score if he kills a blue color guy, and in MArea 2 a red guy cant get score if he kills a red guy. (i have made MArea[playerid] == 1; and MArea[playerid] == 2; )
Anyone?
(and if anyone is OUTSIDE MArea 1 or 2 he gets score whoever he/she kills!)
Re: OnPlayerDeath -
matdav - 06.07.2010
(GetPlayerColor(playerid) == red)
Have u define this color ?
Re: OnPlayerDeath -
Jeffry - 06.07.2010
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(MArea[playerid] == 1)
{
if(GetPlayerColor(playerid) == blue) //here is the 1. error
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 0);
}
return 1;
}
else if(GetPlayerColor(playerid) == red)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
return 1;
}
if(MArea[playerid] == 2)
{
if(GetPlayerColor(playerid) == red) // here is the 2. error
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 0);
}
return 1;
}
else if
if(GetPlayerColor(playerid) == blue)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
return 1;
}
if(MArea[playerid] == 0)
if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
GameTextForPlayer(killerid, "Killer", 4000, 4);
GameTextForPlayer(playerid, "~b~OMG you ~r~died! ~g~haha!", 500, 1);
SendDeathMessage(killerid, playerid, reason);
return 1;
}
Try it. I think you forgot the "
if"
Re: OnPlayerDeath -
Sir_bomber - 06.07.2010
yup, both is defined
(on top)
#define red 0xFF0000FF
#define blue 0x06F8F5
Re: OnPlayerDeath -
Sir_bomber - 06.07.2010
Thanks Jeffry
Re: OnPlayerDeath -
Jeffry - 06.07.2010
Quote:
Originally Posted by Sir_bomber
Thanks Jeffry
|
No problem. Have fun.
Re: OnPlayerDeath -
Sir_bomber - 06.07.2010
(didnt work
)
Re: OnPlayerDeath -
Jeffry - 07.07.2010
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//Area 1
if(MArea[playerid] == 1)
{
//Case BLUE & Area 1
if(GetPlayerColor(playerid) == blue)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 0);
return 1;
}
//Case RED & Area 1
else if(GetPlayerColor(playerid) == red)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
return 1;
}
}
//Area 2
if(MArea[playerid] == 2)
{
//Case BLUE & Area 2
if(GetPlayerColor(playerid) == red)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 0);
return 1;
}
//Case RED & Area 2
else if(GetPlayerColor(playerid) == blue)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
return 1;
}
}
if(MArea[playerid] == 0)
{
if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
GameTextForPlayer(killerid, "Killer", 4000, 4);
GameTextForPlayer(playerid, "~b~OMG you ~r~died! ~g~haha!", 500, 1);
SendDeathMessage(killerid, playerid, reason);
return 1;
}
I compiled it, and there are no errors. Now it's up to you to test it in your server. Tell me if it works.