Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Finch Real on Jun 19, 2016, 08:23 AM

Title: Anti Spawn Kill
Post by: Finch Real on Jun 19, 2016, 08:23 AM
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 );
}
}
Title: Re: Anti Spawn Kill
Post by: . on Jun 19, 2016, 08:27 AM
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.
Title: Re: Anti Spawn Kill
Post by: Finch Real on Jun 19, 2016, 08:35 AM
Updated Topic Error was on Line SP( player.ID );
Title: Re: Anti Spawn Kill
Post by: Xmair on Jun 19, 2016, 08:38 AM
Change
AntiSP[ player.ID ] = "true";
AntiSP[ player.ID ] = "false";
to
AntiSP[ player.ID ] = true;
AntiSP[ player.ID ] = false;
Title: Re: Anti Spawn Kill
Post by: Finch Real on Jun 19, 2016, 08:45 AM
Still Same Error attempt to call bool on same line
Title: Re: Anti Spawn Kill
Post by: Kewun on Jun 19, 2016, 08:47 AM
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
Title: Re: Anti Spawn Kill
Post by: Finch Real on Jun 19, 2016, 08:56 AM
Still Same Error
Title: Re: Anti Spawn Kill
Post by: Kewun on Jun 19, 2016, 08:59 AM
did you add that AntiSP to class? i ment

AntiSP[ player.ID ] = YourClass();

Did you use an class or not?

Title: Re: Anti Spawn Kill
Post by: Kewun on Jun 19, 2016, 09:02 AM
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 :(
Title: Re: Anti Spawn Kill
Post by: Kewun on Jun 19, 2016, 09:09 AM
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
Title: Re: Anti Spawn Kill
Post by: KingOfVC on Jun 19, 2016, 09:50 AM
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  */
}
}
Title: Re: Anti Spawn Kill
Post by: KAKAN on Jun 19, 2016, 10:21 AM
And atlast, someone finally did it without timer.
Title: Re: Anti Spawn Kill
Post by: Finch Real on Jun 19, 2016, 10:35 AM
Works Thanks for help @Xmair @KingOfVC @Kewun