I have added this on PlayerSpawn
SP( player.ID );
But Whenever I spawn it shows error at console
attempt to call 'bool'
on Line 707 which is SP( player.ID );
Function SP and SPoff
function SP( plr )
{
local player = FindPlayer(plr);
AntiSP[ player.ID ] = "true";
NewTimer( "SPoff", 5000, 1, player.ID );
MessagePlayer( "[#daff00]Spawn Protection has been Enabled for 5 Seconds" , player );
}
function SPoff( p )
{
local player = FindPlayer(p);
if(player){
AntiSP[ player.ID ] = "false";
MessagePlayer( "[#83bab3]Spawn Protection has been Disabled" , player );
}
}
Are we supposed to guess the line where that happened? Are we supposed to guess the remaining information about the error? If not, then I guess we're supposed to also not give a phuk about the topic and move on to better things.
If we can take the time to look through some foreign code and detect an issue. Then you scan also take your time to report the error properly. So we can get over this crap quicker.
But oh no. Why should things be that easy.
Updated Topic Error was on Line SP( player.ID );
Change
AntiSP[ player.ID ] = "true";
AntiSP[ player.ID ] = "false";
to
AntiSP[ player.ID ] = true;
AntiSP[ player.ID ] = false;
Still Same Error attempt to call bool on same line
try changing
SP( player.ID );
to
SP( player );
+
NewTimer( "SPoff", 5000, 1, player.ID );
to
NewTimer( "SPoff", 5000, 1, player );
and those "true" "falses" without the " things
Still Same Error
did you add that AntiSP to class? i ment
AntiSP[ player.ID ] = YourClass();
Did you use an class or not?
last thing would be
AntiSP[ player.ID ] = "true";
AntiSP[ player.ID ] = "false";
change to
AntiSP[ player.ID ] = return true;
AntiSP[ player.ID ] = return false;
if doesnt help then idk :(
well,
AntiSK <- false;
function onPlayerSpawn(player)
{
AntiSK = true;
NewTimer("DisableSK" , 5500 , 1, player );
return 1;
}
function onPlayerHealthChange( player, lastHP, newHP )
{
if (AntiSK)
{
player.Health = 100;
}
}
function DisableSK(player)
{
AntiSK = false;
MessagePlayer("Anti spawn kill disabled", player )
}
tell me if works or not
SP <- array( 100, null )
function onPlayerSpawn( player )
{
SP[ player.ID ] = time();
}
function onPlayerKill( killer , player, reason bodypart )
{
if( ( time() - SP[ player.ID ] ) < 10 )
{
/* take action against killer */
}
}
And atlast, someone finally did it without timer.
Works Thanks for help
@Xmair @KingOfVC @Kewun