Menu Punishment for TK
#1

I wanted to create a Team Kill Punishment menu and the person who got killed would choose the punishment...
pawn Code:
if(Team[killerid] == Team[playerid])
{
ShowMenuForPlayer(playerid,punish);
}
But how would I punish the team killer? What would I put under onplayerselectmenurow?
Reply
#2

Follow the guide on this page: https://sampwiki.blast.hk/wiki/OnPlayerSelectedMenuRow . It gives you everything you need to know how to create and use a dialog.
Reply
#3

Quote:
Originally Posted by Bakr
View Post
Follow the guide on this page: https://sampwiki.blast.hk/wiki/OnPlayerSelectedMenuRow . It gives you everything you need to know how to create and use a dialog.
But the problem is, OnPlayerSelectedMenuRow doesn't have a killerid parameter so how would I punish the team killer?
Reply
#4

Store the ID of the killer in a per-player variable, and access it inside the callback when necessary
pawn Code:
// global variable
new g_PlayerKiller[ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... };

//OnPlayerDeath
if( Team[ killerid ] == Team[ playerid ] )
{
   g_PlayerKiller[ playerid ] = killerid;
   // rest of code
}

//OnPlayerSelectedMenuRow
SetPlayerHealth( g_PlayerKiller[ playerid ], 0.00 ); // example punishment, killing the player
g_PlayerKiller[ playerid ] = INVALID_PLAYER_ID;
Reply
#5

Quote:
Originally Posted by Bakr
View Post
Store the ID of the killer in a per-player variable, and access it inside the callback when necessary
pawn Code:
// global variable
new g_PlayerKiller[ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... };

//OnPlayerDeath
if( Team[ killerid ] == Team[ playerid ] )
{
   g_PlayerKiller[ playerid ] = killerid;
   // rest of code
}

//OnPlayerSelectedMenuRow
SetPlayerHealth( g_PlayerKiller[ playerid ], 0.00 ); // example punishment, killing the player
g_PlayerKiller[ playerid ] = INVALID_PLAYER_ID;
OK, thanks. But what would I put after the three "...":
pawn Code:
{ INVALID_PLAYER_ID, ... };
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)