SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/07/2017, 02:11 PM   #1
Sting.
Gangsta
 
Sting.'s Avatar
 
Join Date: May 2011
Location: Malaysia
Posts: 750
Reputation: 81
Exclamation Anti-SpawnKill Tag issue

Hey guys, I'm having a problem, with the Anti-Spawnkill tag, the problem is that it works fine but the problem or issue is that when the player Spawn's, the Tag is displayed and the player's health is blinking, but even after the Timer runs out for the Anti-Spawnkill, 5 seconds, the ridiculous Tag is not destroyed. Below I'll post the code:

Code:
new Text3D:antispawnkill;
Code:
public OnPlayerSpawn(playerid)
{
	SetPlayerHealth(playerid, 99999.0);
	SetPlayerVirtualWorld(playerid, 0);
    SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
    SetPlayerWantedLevel(playerid, 0);
    SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"d",playerid);
    antispawnkill = Create3DTextLabel("Anti-Spawnkill Protected", 0xFF0000FF , 30.0, 40.0, 50.0, 40.0, 0); //SPAWNKILLTAG
    Attach3DTextLabelToPlayer(antispawnkill, playerid, 0.0, 0.0, 0.7);
Code:
public AntiSpawnkill(playerid)
{
    DeletePlayer3DTextLabel(playerid, PlayerText3D:antispawnkill);   //SpawnKill TAG
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
    return 1;
}
So what's the problem, can anyone help out in this mess?
Sting. is offline   Reply With Quote
Old 16/07/2017, 02:39 PM   #2
GuilhermeNunes
Gangsta
 
Join Date: Feb 2017
Posts: 583
Reputation: 8
Default Re: Anti-SpawnKill Tag issue

In your time put False
This bug is of the time and usually happens when ta in True has to be false.
GuilhermeNunes is offline   Reply With Quote
Old 16/07/2017, 03:55 PM   #3
Sting.
Gangsta
 
Sting.'s Avatar
 
Join Date: May 2011
Location: Malaysia
Posts: 750
Reputation: 81
Default Re: Anti-SpawnKill Tag issue

You mean like this?

Code:
SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500, false,"d",playerid);
Sting. is offline   Reply With Quote
Old 16/07/2017, 04:00 PM   #4
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 11,094
Reputation: 2647
Default Re: Anti-SpawnKill Tag issue

You need an array to store the labelids otherwise you won't be able to destroy them.
__________________
Vince is offline   Reply With Quote
Old 16/07/2017, 04:03 PM   #5
GuilhermeNunes
Gangsta
 
Join Date: Feb 2017
Posts: 583
Reputation: 8
Default Re: Anti-SpawnKill Tag issue

Yes, I did a spawn kill and it's giving you the same error yours, I put it false and it worked
GuilhermeNunes is offline   Reply With Quote
Old 16/07/2017, 04:43 PM   #6
Sting.
Gangsta
 
Sting.'s Avatar
 
Join Date: May 2011
Location: Malaysia
Posts: 750
Reputation: 81
Default Re: Anti-SpawnKill Tag issue

Quote:
Originally Posted by Vince View Post
You need an array to store the labelids otherwise you won't be able to destroy them.

Hey Vince, long time no see. Anyway man, can you elaborate? Label ID's?
Sting. is offline   Reply With Quote
Old 16/07/2017, 04:47 PM   #7
Paulice
Huge Clucker
 
Paulice's Avatar
 
Join Date: Jul 2017
Posts: 480
Reputation: 42
Default Re: Anti-SpawnKill Tag issue

Quote:
Originally Posted by Sting. View Post
Hey Vince, long time no see. Anyway man, can you elaborate? Label ID's?
You must store the IDs of every player's 3DTextLabel (this is returned by Create3DTextLabel), you're currently storing only one ID and destroying that ID regardless. Also, destroy the old 3DTextLabel when the player spawns to avoid any overlapping.

PHP Code:
new Text3D:antispawnkill
should be
PHP Code:
new Text3D:antispawnkill[MAX_PLAYERS]; 
and I guess you know what to do next
Paulice is offline   Reply With Quote
Old 16/07/2017, 06:08 PM   #8
Jefff
High-roller
 
Join Date: Dec 2007
Posts: 2,588
Reputation: 303
Default Re: Anti-SpawnKill Tag issue

Code:
public OnPlayerSpawn(playerid)
{
	SetPlayerHealth(playerid, 99999.0);
	SetPlayerVirtualWorld(playerid, 0);
	SendClientMessage(playerid, 0xFF0000AA, "You can't be killed for 5 second(s) (spawn protection)");
	SetPlayerWantedLevel(playerid, 0);
	antispawnkill = Create3DTextLabel("Anti-Spawnkill Protected", 0xFF0000FF , 30.0, 40.0, 50.0, 40.0, 0); //SPAWNKILLTAG
	Attach3DTextLabelToPlayer(antispawnkill, playerid, 0.0, 0.0, 0.7);
	SetTimerEx("AntiSpawnkill",PROTECTIONTIME*1500,0,"ii",playerid,_:antispawnkill);


public AntiSpawnkill(playerid, labelid)
{
	Delete3DTextLabel(Text3D:labelid);  //SpawnKill TAG
	SetPlayerHealth(playerid, 100.0);
	SendClientMessage(playerid, 0x00ff00ff, "Anti Spawn kill protection over.");
	return 1;
}
Jefff is offline   Reply With Quote
Old 16/07/2017, 06:19 PM   #9
Sting.
Gangsta
 
Sting.'s Avatar
 
Join Date: May 2011
Location: Malaysia
Posts: 750
Reputation: 81
Default Re: Anti-SpawnKill Tag issue

Code:
public AntiSpawnkill(playerid, labelid)
I get an error.

Code:
error 025: function heading differs from prototype
Sting. is offline   Reply With Quote
Old 16/07/2017, 06:25 PM   #10
kubak01
Little Clucker
 
Join Date: Jul 2017
Posts: 18
Reputation: 3
Default Re: Anti-SpawnKill Tag issue

Code:
forward AntiSpawnkill(playerid, labelid);
kubak01 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Anti Spawnkill s4kuL Português/Portuguese 11 22/02/2014 01:51 PM
How can you set a Anti-Spawnkill lulo356 Scripting Help 6 02/11/2013 12:54 AM
Anti-Spawnkill Tag. Sting. Scripting Help 7 29/09/2013 12:52 PM
[FilterScript] Anti-SpawnKill BlackHorse Filterscripts 1 16/06/2013 06:23 AM
[FilterScript] Anti-SpawnKill V:0.1 ACI Filterscripts 7 27/03/2013 11:29 AM


All times are GMT. The time now is 10:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.