How can I use a parameter from a callback?
#8

playerid and killerid are just numbers. Each number represents an index for the array.

So if OnPlayerDeath is called with playerid (0) and killerid (2) and you do:
pawn Код:
if (Variable[playerid] == 1) // it's like doing: if (Variable[0] == 1)
{
    // some code..
}
Keep in mind that if you want to check what value the "Variable" holds for killerid, you'll need to check if killer is not an invalid player (it is when a player dies by themselves).
pawn Код:
if (killerid != INVALID_PLAYER_ID)
{
    if (Variable[killerid] == 0)
    {
        // some code..
    }
}
More informations about arrays:
https://sampwiki.blast.hk/wiki/Scripting_Basics#Arrays
https://sampforum.blast.hk/showthread.php?tid=318212
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)