Spawnkill help!
#1

I made an anti-spawnkill,

but the problem is:

I can't kill people but they can kill me.

The anti-spawnkill also only works on me.

here the codes:
PHP код:
forward spawnkill(playerid);
public 
spawnkill(playerid)
{
    new 
Text3D:label;
    
SetPlayerHealth(playerid100.0);
    
SendClientMessage(playeridCOLOR_RED"Spawn protection is over. You are ready to combat.");
    
Delete3DTextLabel(label);
}
public 
OnPlayerSpawn(playerid)
{
    
/* Spawn Protection*/
    
new Text3D:label Create3DTextLabel("Spawn protection"0x008080FF30.040.050.040.00);
    
Attach3DTextLabelToPlayer(labelplayerid0.00.00.7);
    
SetPlayerHealth(playerid99999);
    
SetTimer("spawnkill"10000false);
        return 
1;

Whats wrong?

Please help
Reply
#2

You are using SetTimer function instead of SetTimerEx. You need to assign the playerid parameter in order for the timer to work for the selected player only.

Also, if you are not using SetPlayerChatBubble function anywhere, I'd recommend you to use it instead of 3D text label.

Something like;

PHP код:
forward AntiSpawnKill(playerid);
public 
AntiSpawnKill(playerid)
{
    
SetPlayerHealth(playerid100.0);
    
SendClientMessage(playeridCOLOR_RED"Spawn protection is over. You are ready to combat.");
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
SetPlayerHealth(playerid99999.99);
    
SendClientMessage(playerid, -1"Anti spawn kill protected for 10 seconds.");
    
SetPlayerChatBubble(playerid"Spawn Kill Protected"COLOR_RED10.010000);
    
SetTimerEx("AntiSpawnKill"10000false"i"playerid);
    return 
1;

Reply
#3

This is wrong
PHP код:
SetTimer("spawnkill"10000false); 
Replace
PHP код:
SetTimerEx("spawnkill"10000false"i"playerid); 
EDIT: Sjn was faster.
Reply
#4

Thank you for explaining!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)