SA-MP Forums Archive
[HELP] IsPlayerInArea|SetPlayerWanted - 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: [HELP] IsPlayerInArea|SetPlayerWanted (/showthread.php?tid=192115)

Pages: 1 2


[HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 21.11.2010

What's wrong? i got 1 ERROR:

pawn Код:
#include <a_samp>

forward CheckPInArea(playerid);

public CheckPInArea(playerid)
{
    if(IsPlayerInArea(playerid, 896.5746, 2057.332, 978.5764, 2184.978) && !IsPlayerAdmin(playerid)){ //X, Y, Z
            //Get & SetPlayerWanted
            SetPlayerWantedLevel( playerid, (GetPlayerWantedLevel( playerid ) + 10) );
            new wantedlevel;
            wantedlevel = GetPlayerWantedLevel(playerid);
            new tmp[64];
            //GetPlayerName
            new name[MAX_PLAYER_NAME], string[44];
            GetPlayerName(playerid, name, sizeof(name));
            //TextToShow
            format(tmp, sizeof(tmp), "(TRASPASSING) %s is traspassing ARMY, his/her wanted level is now: %i", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);

    }
    return 1;
}

stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    if(pX >= MinX && pX <= MaxX && pY >= MinY && pY <= MaxY)
        return true;
    else
        return false;
}

ERROR:

pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\WantedInArea.pwn(14) : warning 204: symbol is assigned a value that is never used: "string"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.



Re: [HELP] IsPlayerInArea|SetPlayerWanted - TheXIII - 21.11.2010

It's a warning, not an error. Read it, and you will understand it. Pretty straight forward.


Re: [HELP] IsPlayerInArea|SetPlayerWanted - Flyfishes - 21.11.2010

Remove the string[44] on line 14.


Re: [HELP] IsPlayerInArea|SetPlayerWanted - HyperZ - 21.11.2010

Try this
pawn Код:
#include <a_samp>

forward CheckPInArea(playerid);

public CheckPInArea(playerid)
{
    if(IsPlayerInArea(playerid, 896.5746, 2057.332, 978.5764, 2184.978) && !IsPlayerAdmin(playerid)){ //X, Y, Z
            //Get & SetPlayerWanted
            SetPlayerWantedLevel( playerid, (GetPlayerWantedLevel( playerid ) + 10) );
            new wantedlevel;
            wantedlevel = GetPlayerWantedLevel(playerid);
            new tmp[64];
            //GetPlayerName
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            //TextToShow
            format(tmp, sizeof(tmp), "(TRASPASSING) %s is traspassing ARMY, his/her wanted level is now: %i", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);

    }
    return 1;
}

stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    if(pX >= MinX && pX <= MaxX && pY >= MinY && pY <= MaxY)
        return true;
    else
        return false;
}



Re: [HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 21.11.2010

Hmm Thx to you all but i need more help... It wont work (When i enter the area then i dont get any wanted level)


Re: [HELP] IsPlayerInArea|SetPlayerWanted - WillyP - 21.11.2010

SetPlayerWantedLevel(playerid, +10); ?

This forum requires that you wait 120 seconds between posts. Please try again in 38 seconds.


Re: [HELP] IsPlayerInArea|SetPlayerWanted - Toni - 21.11.2010

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
SetPlayerWantedLevel(playerid, +10); ?

This forum requires that you wait 120 seconds between posts. Please try again in 38 seconds.
No.

And the reason you don't get a wanted level, is because you don't have any thing activating the "IsPlayerInArea".

You need to set a timer.


Re: [HELP] IsPlayerInArea|SetPlayerWanted - DiddyBop - 21.11.2010

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
SetPlayerWantedLevel(playerid, +10); ?

This forum requires that you wait 120 seconds between posts. Please try again in 38 seconds.
goodjob cpt.obvious but he already has it.

pawn Код:
SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + 10));



Re: [HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 21.11.2010

ok, i have edited the script a bit, but it still dont work and i got an ERROR now >.<
Nothing happends when i enter the area -.-

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

forward CheckPInArea(playerid);

public CheckPInArea(playerid)
{
    if(IsPlayerInArea(playerid, 917.74, 2043.3, 997.12, 2183) && !IsPlayerAdmin(playerid)){ //X, Y, Z
            //Get & SetPlayerWanted
            SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + 10));
            new wantedlevel;
            wantedlevel = GetPlayerWantedLevel(playerid);
            new tmp[64];
            //GetPlayerName
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            //TextToShowForAll
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY) %s, traspassing ARMY.", wantedlevel);
            SendClientMessageToAll(playerid, 0xFF0000FF, tmp);
            //TextToShowForPlayer
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY) Your wanted level is now: %i", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);

    }
    return 1;
}

stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    if(pX >= MinX && pX <= MaxX && pY >= MinY && pY <= MaxY)
        return true;
    else
        return false;
}
ERROR:
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\WantedInArea.pwn(20) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: [HELP] IsPlayerInArea|SetPlayerWanted - Victor - 21.11.2010

Kill the timer when the player is found in the area


Re: [HELP] IsPlayerInArea|SetPlayerWanted - The_Gangstas - 21.11.2010

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

new pTimer_Check[MAX_PLAYERS];
new pSecondsInArea[MAX_PLAYERS];

forward CheckPInArea(playerid);
forward ResetVars();
public OnFilterScriptInit()
{
    SetTimer("ResetVars",1000,true);
}
public OnPlayerSpawn(playerid)
{
    pTimer_Check[playerid] = SetTimerEx("CheckPInArea", 1000, true, "i", playerid);
    pSecondsInArea[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid)
{
    KillTimer(pTimer_Check[playerid]);
    pSecondsInArea[playerid] = 0;
    return 1;
}
public ResetVars()
{
    if(pSecondsInArea[playerid]>=1)
    {
        pSecondsInArea[playerid]--;
    }
}
public CheckPInArea(playerid)
{
    if(IsPlayerInArea(playerid, 917.74, 2043.3, 997.12, 2183) && !IsPlayerAdmin(playerid))
    { //X, Y, Z
        if(pSecondsInArea[playerid] == 0)
        {
            //Get & SetPlayerWanted
            SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + 10));
            new wantedlevel;
            wantedlevel = GetPlayerWantedLevel(playerid);
            new tmp[64];
            //GetPlayerName
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            //TextToShowForAll
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY) %s traspassing ARMY.", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);
            //TextToShowForPlayer
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY) Your wanted level is now: %i", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);
            pSecondsInArea[playerid]+=75;
        }

    }
    return 1;
}
stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    if(pX >= MinX && pX <= MaxX && pY >= MinY && pY <= MaxY)
        return true;
    else
        return false;
}



Re: [HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 21.11.2010

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
pawn Код:
#include <a_samp>

#define FILTERSCRIPT

new pTimer_Check[MAX_PLAYERS];
new pSecondsInArea[MAX_PLAYERS];

forward CheckPInArea(playerid);
forward ResetVars();
public OnFilterScriptInit()
{
    SetTimer("ResetVars",1000,true);
}
public OnPlayerSpawn(playerid)
{
    pTimer_Check[playerid] = SetTimerEx("CheckPInArea", 1000, true, "i", playerid);
    pSecondsInArea[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid)
{
    KillTimer(pTimer_Check[playerid]);
    pSecondsInArea[playerid] = 0;
    return 1;
}
public ResetVars()
{
    if(pSecondsInArea[playerid]>=1)
    {
        pSecondsInArea[playerid]--;
    }
}
public CheckPInArea(playerid)
{
    if(IsPlayerInArea(playerid, 917.74, 2043.3, 997.12, 2183) && !IsPlayerAdmin(playerid))
    { //X, Y, Z
        if(pSecondsInArea[playerid] == 0)
        {
            //Get & SetPlayerWanted
            SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + 10));
            new wantedlevel;
            wantedlevel = GetPlayerWantedLevel(playerid);
            new tmp[64];
            //GetPlayerName
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            //TextToShowForAll
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY) %s traspassing ARMY.", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);
            //TextToShowForPlayer
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY) Your wanted level is now: %i", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);
            pSecondsInArea[playerid]+=75;
        }

    }
    return 1;
}
stock IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    if(pX >= MinX && pX <= MaxX && pY >= MinY && pY <= MaxY)
        return true;
    else
        return false;
}
This one got two ERROR:
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\WantedInArea.pwn(31) : error 017: undefined symbol "playerid"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\WantedInArea.pwn(33) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.



Re: [HELP] IsPlayerInArea|SetPlayerWanted - WillyP - 21.11.2010




Re: [HELP] IsPlayerInArea|SetPlayerWanted - The_Gangstas - 21.11.2010

get foreach include
public ResetVars()
{
foreach(Player,i)
{
if(pSecondsInArea[i]>=1)
{
pSecondsInArea[i]--;
}
}
}


Re: [HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 21.11.2010

Thanks, But This text should be like this
(TRESPASSING ARMY) *PlayerName+ID* traspassing ARMY

Not like this:
(TRESPASSING ARMY) traspassing ARMY


Re: [HELP] IsPlayerInArea|SetPlayerWanted - Th3Angel - 22.11.2010

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
ok, i have edited the script a bit, but it still dont work and i got an ERROR now >.<
Nothing happends when i enter the area -.-

pawn Код:
format(tmp, sizeof(tmp), "(TRASPASSING ARMY)%s, traspassing ARMY.", wantedlevel);
            SendClientMessageToAll(playerid, 0xFF0000FF, tmp);
If you actually took the time to look, you're not even trying to display the persons name or id. Instead you're displaying "wantedlevel" as a string which wont work because "wantedlevel" is an integer.


Re: [HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 22.11.2010

Quote:
Originally Posted by Th3Angel
Посмотреть сообщение
If you actually took the time to look, you're not even trying to display the persons name or id. Instead you're displaying "wantedlevel" as a string which wont work because "wantedlevel" is an integer.
If i do that, it gives me an ERROR who i cant fix:

pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\WantedInArea.pwn(56) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: [HELP] IsPlayerInArea|SetPlayerWanted - Th3Angel - 22.11.2010

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
If i do that, it gives me an ERROR who i cant fix:

pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\WantedInArea.pwn(56) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
show me how you fixed it?


Re: [HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 22.11.2010

Quote:
Originally Posted by Th3Angel
Посмотреть сообщение
show me how you fixed it?
That part looks like this now:
pawn Код:
public CheckPInArea(playerid)
{
    if(IsPlayerInArea(playerid, 917.74, 2043.3, 997.12, 2183) && !IsPlayerAdmin(playerid))
    { //X, Y, Z
        if(pSecondsInArea[playerid] == 0)
        {
            //Get & SetPlayerWanted
            SetPlayerWantedLevel(playerid, (GetPlayerWantedLevel(playerid) + 10));
            new wantedlevel;
            wantedlevel = GetPlayerWantedLevel(playerid);
            new tmp[64];
            //GetPlayerName
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            //TextToShowForAll
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY)%s, traspassing ARMY.", wantedlevel);
            SendClientMessageToAll(playerid, 0xFF0000FF, tmp);
            //TextToShowForPlayer
            format(tmp, sizeof(tmp), "(TRASPASSING ARMY) Your wanted level is now: %i", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);
            pSecondsInArea[playerid]+=75;
        }

    }
    return 1;
}



Re: [HELP] IsPlayerInArea|SetPlayerWanted - Larsey123IsMe - 22.11.2010

*BUMP*