I was making spawn protection.
I added this onplayerspawn
player.Immunity = 31;
MessagePlayer("Spawn Protection Enabled", player);
NewTimer("visibility", 5000, 1, player.ID);
Function
function visibility(player)
{
player.Immunity = 0;
MessagePlayer("Spawn Protection Disabled", player);
}
Error
An error has occured[trying to set in integer]
NewTimer("visibility", 5000, 1, player.ID);
You're passing player.ID and automagically expecting it to become 'player' instance.
function visibility(player)
{
player.Immunity = 0;
MessagePlayer("Spawn Protection Disabled", player);
}
They all are player's IDs, not instances. So, your code is doing: 0.Immunity = 0; MsgPlr( "", 0 );
Quote from: KAKAN on Oct 16, 2017, 11:46 AMNewTimer("visibility", 5000, 1, player.ID);
You're passing player.ID and automagically expecting it to become 'player' instance.
function visibility(player)
{
player.Immunity = 0;
MessagePlayer("Spawn Protection Disabled", player);
}
They all are player's IDs, not instances. So, your code is doing: 0.Immunity = 0; MsgPlr( "", 0 );
Oh yeah..
I used
NewTimer("visibility", 5000, 1, player);
but now it shuts my server "Server.exe has stopped working"
Timer doesn't send instance use player.ID(integer) instead of player(instance).
NewTimer("visibility", 5000, 1, player.ID);
and this in function.
local player = FindPlayer(playerID);
Like this
function visibility(playerID)
{
local player = FindPlayer(playerID);
if ( !player ) return;
player.Immunity = 0;
MessagePlayer("Spawn Protection Disabled", player);
}
Worked Thanks