SA-MP Forums Archive
Auto kill after 15 sec - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Auto kill after 15 sec (/showthread.php?tid=188664)



Auto kill after 15 sec - Larsey123IsMe - 08.11.2010

If someone goes in a admin area (NoN-Admin), then he will get this text up "Get our or be killed in: (Count down from 15)"

And after 15 sec he get auto killed! (If he dident leave the area)

How to make this? In advance please


Re: Auto kill after 15 sec - Cameltoe - 08.11.2010

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
If someone goes in a admin area (NoN-Admin), then he will get this text up "Get our or be killed in: (Count down from 15)"

And after 15 sec he get auto killed! (If he dident leave the area)

How to make this? In advance please
Really? what about searching ?

http://forum.sa-mp.com/showthread.ph...dmin+area+kill


Re: Auto kill after 15 sec - Larsey123IsMe - 08.11.2010

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
I did but i dont understan any thing, can you please make a full script of that, all i got is

pawn Код:
if(/* Playerinareafunction */)
{
       if(/* IsplayeradminCode */)
      {
       /* your code here*/
      }
}
else
{
SetPlayerHealth(playerid,0.0);
}
}



Re: Auto kill after 15 sec - Cameltoe - 08.11.2010

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
I did but i dont understan any thing, can you please make a full script of that, all i got is

pawn Код:
if(/* Playerinareafunction */)
{
       if(/* IsplayeradminCode */)
      {
       /* your code here*/
      }
}
else
{
SetPlayerHealth(playerid,0.0);
}
}
This forum is to discuss not to request.

but that piece of code you have there is pretty explanatory.

pawn Код:
if(IsPlayerInRange(playerid, Rangeshithere)) // http://wiki.sa-mp.com and search for the function.
{
       if(!IsPlayerAdmin(playerid)) // Is Player RCON ADMIN? kill if not..
      {
            SetPlayerHealth(playerid,0.0); // Kill the player..
      }
}



Re: Auto kill after 15 sec - The_Moddler - 08.11.2010

pawn Код:
new pKill[MAX_PLAYERS];
new pCount[MAX_PLAYERS];

if(IsPlayerInArea(playerid, x_MAX, x_MIN, y_MAX, y_MIN))
{
    if(!IsPlayerAdmin(playerid))
    {
        pKill[playerid] = SetTimerEx("KillTime", 15000, false, "i", playerid);
    }
    return 1;
}
else if(!IsPlayerInArea(playerid, x_MAX, x_MIN, y_MAX, y_MIN))
{
    KillTimer(pKill(playerid));
    pCount[playerid] = 15;
    return 1;
}

forward KillTime(playerid);
public KillTime(playerid)
{
    pCount[playerid]--;
    if(pCount > 15)
    {
        SetPlayerHealth(playerid, 0.0);
        pCount[playerid] = 15;
    }
}
You obviusly will have to create your textdraw and add the coordinates.


Re: Auto kill after 15 sec - Larsey123IsMe - 08.11.2010

Edited:

pawn Код:
new pKill[MAX_PLAYERS];
new pCount[MAX_PLAYERS];

if(IsPlayerInArea(playerid, 997, 917, 2046, 2182))
{
    if(!IsPlayerAdmin(playerid))
    {
        pKill[playerid] = SetTimerEx("KillTime", 15000, false, "i", playerid);
    }
    return 1;
}
else if(!IsPlayerInArea(playerid, 997, 917, 2046, 2182))
{
    KillTimer(pKill(playerid));
    pCount[playerid] = 15;
    return 1;
}

forward KillTime(playerid);
public KillTime(playerid)
{
    pCount[playerid]--;
    if(pCount > 15)
    {
        SetPlayerHealth(playerid, 0.0);
        pCount[playerid] = 15;
    }
}

It got 11 Error's

pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(1) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(2) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(2) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(4) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(6) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(10) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(12) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(14) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(14 -- 16) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(23) : error 033: array must be indexed (variable "pCount")
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(25) : error 017: undefined symbol "SetPlayerHealth"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(29) : warning 203: symbol is never used: "KillTimer"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(29) : warning 203: symbol is never used: "pKill"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.



Re: Auto kill after 15 sec - Cameltoe - 08.11.2010

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
Edited:

pawn Код:
new pKill[MAX_PLAYERS];
new pCount[MAX_PLAYERS];

if(IsPlayerInArea(playerid, 997, 917, 2046, 2182))
{
    if(!IsPlayerAdmin(playerid))
    {
        pKill[playerid] = SetTimerEx("KillTime", 15000, false, "i", playerid);
    }
    return 1;
}
else if(!IsPlayerInArea(playerid, 997, 917, 2046, 2182))
{
    KillTimer(pKill(playerid));
    pCount[playerid] = 15;
    return 1;
}

forward KillTime(playerid);
public KillTime(playerid)
{
    pCount[playerid]--;
    if(pCount > 15)
    {
        SetPlayerHealth(playerid, 0.0);
        pCount[playerid] = 15;
    }
}

It got 11 Error's

pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(1) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(2) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(2) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(4) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(6) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(10) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(12) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(14) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(14 -- 16) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(23) : error 033: array must be indexed (variable "pCount")
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(25) : error 017: undefined symbol "SetPlayerHealth"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(29) : warning 203: symbol is never used: "KillTimer"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(29) : warning 203: symbol is never used: "pKill"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.
Did you include a_samp?


Re: Auto kill after 15 sec - Larsey123IsMe - 08.11.2010

I forgot that. (now added) but i still got some error:

Whole Scrip i got:
pawn Код:
#include <a_samp>

new pKill[MAX_PLAYERS];
new pCount[MAX_PLAYERS];

if(IsPlayerInArea(playerid, 997, 917, 2046, 2182))
{
    if(!IsPlayerAdmin(playerid))
    {
        pKill[playerid] = SetTimerEx("KillTime", 15000, false, "i", playerid);
    }
    return 1;
}
else if(!IsPlayerInArea(playerid, 997, 917, 2046, 2182))
{
    KillTimer(pKill(playerid));
    pCount[playerid] = 15;
    return 1;
}

forward KillTime(playerid);
public KillTime(playerid)
{
    pCount[playerid]--;
    if(pCount > 15)
    {
        SetPlayerHealth(playerid, 0.0);
        pCount[playerid] = 15;
    }
}
Error:
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(6) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(8) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(12) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(14) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(18) : error 010: invalid function or declaration
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(25) : error 033: array must be indexed (variable "pCount")
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\KillInArea.pwn(31) : warning 203: symbol is never used: "pKill"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.



Re: Auto kill after 15 sec - Cameltoe - 08.11.2010

pawn Код:
#include <a_samp>

new pKill[MAX_PLAYERS];
new pCount[MAX_PLAYERS];

public OnFilterScriptInit()
{
    SetTimer("Area_Check", 5000, true);
}

forward Area_Check();
public Area_Check()
{
    for(new i; i < MAX_PLAYERS +1; i++)
    {
        if(IsPlayerInArea(i, 997, 917, 2046, 2182))
        {
            if(!IsPlayerAdmin(i))
            {
                pKill[i] = SetTimerEx("KillTime", 15000, false, "i", i);
            }
        }
        else if(!IsPlayerInArea(i, 997, 917, 2046, 2182))
        {
            KillTimer(pKill[i]);
            pCount[i] = 15;
        }
    }
    return 1;
}

forward KillTime(playerid);
public KillTime(playerid)
{
    pCount[playerid]--;
    if(pCount[playerid] > 15)
    {
        SetPlayerHealth(playerid, 0.0);
        pCount[playerid] = 15;
    }
}

stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}



Re: Auto kill after 15 sec - Larsey123IsMe - 08.11.2010

You know where the Las Venturas Meat Factory is?

If you know, then can you make when he walk inside the Factory area then the countdown should start. I think i placed the MAX_X, MIN_Y... Wrong