[HELP] IsPlayerInArea|SetPlayerWanted
#1

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.
Reply
#2

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

Remove the string[44] on line 14.
Reply
#4

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;
}
Reply
#5

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)
Reply
#6

SetPlayerWantedLevel(playerid, +10); ?

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

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.
Reply
#8

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));
Reply
#9

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.
Reply
#10

Kill the timer when the player is found in the area
Reply
#11

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;
}
Reply
#12

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.
Reply
#13

Reply
#14

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

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

Not like this:
(TRESPASSING ARMY) traspassing ARMY
Reply
#16

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.
Reply
#17

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.
Reply
#18

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?
Reply
#19

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;
}
Reply
#20

*BUMP*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)