Spawn protection - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spawn protection (
/showthread.php?tid=482167)
Spawn protection -
ScRipTeRi - 19.12.2013
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.
Re : Spawn protection -
[HRD]Mar1 - 19.12.2013
Use SetTimerEx
Re: Spawn protection -
[EnErGyS]KING - 19.12.2013
https://sampwiki.blast.hk/wiki/SetTimerEx
Re: Spawn protection -
iOxide - 19.12.2013
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.
Re: Spawn protection - Patrick - 19.12.2013
@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
Re: Spawn protection -
ScRipTeRi - 19.12.2013
Thanks iOxide & pds2k12