Spawn protection
#1

Hello again,
i want to make spawn protection with 3dlabbel when player spawn Attach 3D Text Label To Player and countdown 5 seconda
Thank you.
Reply
#2

Use SetTimerEx
Reply
#3

https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#4

pawn Код:
#include <a_samp>

#define Spawnkill 30
forward SpawnProtection(playerid);
new Text3D:SP[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    new string[128];
    format(string, sizeof(string), "You are anti spawnkill protected.", Spawnkill);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    SetPlayerHealth(playerid, 10000.0);
    SP[playerid] = Create3DTextLabel("Spawn Kill Protected",0xFFFF00FF,30.0,40.0,50.0,40.0,0);
    Attach3DTextLabelToPlayer(SP[playerid], playerid, 0.0, 0.0, 0.3);
    SetTimerEx("AntiSpawnKill",Spawnkill*1000,0,"d",playerid);
    return 1;
}

public SpawnProtection(playerid)
{
    SetPlayerHealth(playerid, 100.0);
    Delete3DTextLabel(SP[playerid]);
    SendClientMessage(playerid, 0xFF0000AA, "Spawn Protection over.");
    return 1;
}
Haven't tested. Tell me if it works or not.
Reply
#5

@Above Post - Why are you sending him how to use SetTimerEx? If you know what to do it's really simple how to create Anti-Spawn Kill

@ScRipTeRiI used SetPlayerChatBubble instead of 3DTextLabel they almost work the same.

pawn Код:
/*
================================[Parameters]================================
SetPlayerChatBubble(playerid, text[], color, Float:drawdistance, expiretime);
SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...);
SetPlayerHealth(playerid, health);
SetPlayerArmour(playerid, armour);
*/


#define function::%0(%1) \
    forward %0(%1); \
        public %0(%1)

#define INFINITY_HP:AR \
    999999

#define NORMAL_HP:AR \
    100

public OnPlayerSpawn(playerid)
{
    SetTimerEx( "OnAntiSpawnKill", 5000, false, "i", playerid ), SetPlayerChatBubble( playerid, "Anti spawn kill", 0xFF0000FF, 100.0, 50000 );
    SetPlayerHealth( playerid, INFINITY_HP:AR ), SetPlayerArmour( playerid, INFINITY_HP:AR );
    return true;
}

function:: OnAntiSpawnKill(playerid)
{
    SetPlayerChatBubble( playerid, "Anti spawn kill ended", 0xFF0000FF, 100.0, 50000 );
    SetPlayerHealth( playerid, NORMAL_HP:AR), SetPlayerArmour(playerid, NORMAL_HP:AR );
    return true;
}
EDIT: Late but okay, we both have a different code, your choice which one to use :P
Reply
#6

Thanks iOxide & pds2k12
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)