SA-MP Forums Archive
where is wrong here?? - 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: where is wrong here?? (/showthread.php?tid=157982)



where is wrong here?? - iJumbo - 08.07.2010

no errors no warning but not work any help ??
pawn Код:
public killzone(playerid)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X >= 1331.278 && X <= 2207.118 && Y >= -2755.979 && Y <= -2125.373)
    {
    SendClientMessage(playerid,COLOR_RED,"you are in ADMIN ZONE!!!");
    print("admin zone violated");
        SetPlayerHealth(playerid,0);
    }
    return 1;
}



Re: where is wrong here?? - Jeffry - 08.07.2010

Well, the code is okey. Can you post the code/command/timer when you use/start it?


Re: where is wrong here?? - iJumbo - 08.07.2010

only this under ongamemodeint
pawn Код:
SetTimer("killzone",1000,1);
pawn Код:
forward killzone(playerid);



Re: where is wrong here?? - Jeffry - 08.07.2010

pawn Код:
public killzone(playerid)
{
for(playerid=0; playerid<MAX_PLAYERS; playerid++)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X >= 1331.278 && X <= 2207.118 && Y >= -2755.979 && Y <= -2125.373)
    {
    SendClientMessage(playerid,COLOR_RED,"you are in ADMIN ZONE!!!");
    print("admin zone violated");
        SetPlayerHealth(playerid,0);
    }
}
    return 1;
}

Try this.


Re: where is wrong here?? - iJumbo - 08.07.2010

yeah work fine thx and how to make if im a admin not kill me?
pawn Код:
public killzone(playerid)
{
for(playerid=0; playerid<MAX_PLAYERS; playerid++)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X >= 1331.278 && X <= 2207.118 && Y >= -2755.979 && Y <= -2125.373)
    {
        SendClientMessage(playerid,COLOR_RED,"you are in ADMIN ZONE!!!");
        print("admin zone violated");
        SetPlayerHealth(playerid,0);
        }
        else if(!IsPlayerAdmin(playerid))
        {
        }
    }
    return 1;
}
this can work?


Re: where is wrong here?? - Script - 08.07.2010

Quote:
Originally Posted by gigi1223
Посмотреть сообщение
only this under ongamemodeint
pawn Код:
SetTimer("killzone",1000,1);
pawn Код:
forward killzone(playerid);
The problem is with your timer change it to this:

SetTimerEx("killzone", 1000, 0, "d", playerid);


Re: where is wrong here?? - iJumbo - 08.07.2010

now work -.- read up ihave a question now read up


Re: where is wrong here?? - Miikkel - 08.07.2010

Quote:
Originally Posted by Script
Посмотреть сообщение
The problem is with your timer change it to this:

SetTimerEx("killzone", 1000, 0, "d", playerid);
Why SetTimerEx? SetTimer would work aswell.

Try:

pawn Код:
if(PlayerAdmin[playerid] == 1)
{
//Nothing as the player is an admin.
}
else
{
//Code Here.
}



Re: where is wrong here?? - iJumbo - 08.07.2010

yea work but i want if is a admin send a message welcome admin but this message show 100000 times XD how to show 1 times?
pawn Код:
if(PlayerAdmin[playerid] = 1)
{
SendClientMessage .......... welcome admin
}
else
{
//Code Here.
}



Re: where is wrong here?? - Miikkel - 08.07.2010

Quote:
Originally Posted by gigi1223
Посмотреть сообщение
yea work but i want if is a admin send a message welcome admin but this message show 100000 times XD how to show 1 times?
pawn Код:
if(PlayerAdmin[playerid] = 1)
{
SendClientMessage .......... welcome admin
}
else
{
//Code Here.
}
That is cuz your time is checking every 1 second, meaning that the admin would get the message every 1 second. Try:

pawn Код:
public killzone(playerid)
{
    for(playerid=0; playerid<MAX_PLAYERS; playerid++)
    {
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        if(X >= 1331.278 && X <= 2207.118 && Y >= -2755.979 && Y <= -2125.373)
        {
            SendClientMessage(playerid,COLOR_RED,"You're in the Admin Zone, and will be killed.");
            print("Admin Zone Violated");
            SetPlayerHealth(playerid,0);
        }
        else if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid,COLOR_RED,"Welcome to Admin Zone!"); //Send the message for the admin.
            KillTimer("killzone") // Kill the timer if the player is an admin.
        }
    }
    return 1;
}
pawn Код:
forward killzone(playerid);
Under OnPlayerConnect
pawn Код:
SetTimerEx("killzone", 1000, 1, "d", playerid);