errrors in a filterscript
#1

i found this filterscript wich allow me to place mines
pawn Код:
#include <dcmd>
#include <a_samp>
#define MAX_PLAYER 20
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
enum pInfo
{
  team,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward ActivateMine(objectid);
forward MineCheck();
new LandMines[MAX_PLAYER], MineState[MAX_OBJECTS], IsMine[MAX_OBJECTS], MineOwner[MAX_OBJECTS], MineKilled[MAX_PLAYER], MineKiller[MAX_PLAYER];
public OnFilterScriptInit()
{
     SetTimer("MineCheck", 100, true);
     for(new i=0;i<MAX_OBJECTS;i++)
    {
        IsMine[i] = 0;
        MineState[i] = 0;
    }
     return 1;
}
public OnPlayerConnect(playerid)
{
    MineKilled[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(getmine, 7, cmdtext);
    dcmd(plantmine, 9, cmdtext);
    return 0;
}
dcmd_getmine(playerid, params[])
{
    if(GetPlayerMoney(playerid) < 500) SendClientMessage(playerid, COLOR_RED, "Not enough money: One mine cost 500$");
    else
    {
        LandMines[playerid]++;
        GivePlayerMoney(playerid, -500);
        SendClientMessage(playerid, COLOR_YELLOW, "Successfuly bought a mine, plant it with /plantmine");
    }
    return 1;
    #pragma unused params
}

dcmd_plantmine(playerid, params[])
{
    if(LandMines[playerid] < 1) SendClientMessage(playerid, COLOR_RED, "You have no mines, get one with /getmine");
    else
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        new mine;
        mine = CreateObject(1211, x, y, z-1.5, 0, 0, 0);
        IsMine[mine] = 1;
        SendClientMessage(playerid, COLOR_YELLOW, "Planted a mine, the mine will be activated in 10 seconds!");
        SetTimerEx("ActivateMine", 10000, false, "i", mine);
        LandMines[playerid]--;
        MineOwner[mine] = playerid;
    }
    return 1;
    #pragma unused params
}
public OnPlayerDeath(playerid, killerid, reason)
{
    if(MineKilled[playerid] == 1)
    {
        SetPlayerScore(MineKiller[playerid], GetPlayerScore(MineKiller[playerid])+1);
        GivePlayerMoney(MineKiller[playerid], 1250);
        SendDeathMessage(MineKiller[playerid], playerid, reason);
        MineKilled[playerid] = 0;
    }
    else
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
        SendDeathMessage(killerid, playerid, reason);
        GivePlayerMoney(killerid, 1250);
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    for(new i=0;i<MAX_OBJECTS;i++)
    {
        if(IsValidObject(i) && IsMine[i] == 1)
        {
            if(MineOwner[i] == playerid)
            {
                MineOwner[i] = 255;
            }
        }
    }

}
public ActivateMine(objectid)
{
    MineState[objectid] = 1;
    return 1;
}

public MineCheck()
{
    new Float:x, Float:y, Float:z;
    for(new i=0;i<MAX_PLAYER;i++)
    {
        if(IsPlayerConnected(i))
        {
            for(new o=0;o<MAX_OBJECTS;o++)
            {
                if(IsValidObject(o))
                {
                    GetPlayerPos(i, x, y, z);
                    if(GetObjectDistanceToPointEx(o, x, y, z) < 3)
                    {
                        if(IsMine[o] == 1 && MineState[o] == 1 && PlayerInfo[playerid][team][MineOwner[o]] != PlayerInfo[playerid][team][i])
                        {
                            DestroyObject(o);
                            CreateExplosion(x, y, z, 3, 200);
                            CreateExplosion(x+1, y, z, 3, 200);
                            CreateExplosion(x-1, y, z, 3, 200);
                            CreateExplosion(x, y+1, z, 3, 200);
                            CreateExplosion(x, y-1, z, 3, 200);
                            GameTextForPlayer(i, "~w~You have hit a ~r~landmine~w~!", 2000, 3);
                            IsMine[o] = 0;
                            MineState[o] = 0;
                            if(MineOwner[o] != 255)
                            {
                                MineKiller[i] = MineOwner[o];
                                MineKilled[i] = 1;
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
GetObjectDistanceToPointEx(objectid,Float:x,Float:y,Float:z)
{
     new Float:x1,Float:y1,Float:z1;
     new Float:tmpdis;
     GetObjectPos(objectid,x1,y1,z1);
     tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z1)),2));
     return floatround(tmpdis);
}
i want use this filterscript on SATDM V9 gamemode but i got these errors:
Код:
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(121) : error 017: undefined symbol "playerid"
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(121) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(121) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(121) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(121) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
the line 121 is this:
pawn Код:
if(IsMine[o] == 1 && MineState[o] == 1 && PlayerInfo[playerid][team][MineOwner[o]] != PlayerInfo[playerid][team][i])
can anyone help me with this and give me a clue how to make it work with SATDM
Reply
#2

Instead of "playerid" put "i"
Reply
#3

now i got these errors
Код:
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : error 001: expected token: ")", but found "["
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
in this line
pawn Код:
if(IsMine[o] == 1 && MineState[o] == 1 && PlayerInfo[i][team][MineOwner[o]] != PlayerInfo[i][team][i])
Reply
#4

any ideas??
Reply
#5

Try this:

pawn Код:
if(IsMine[o] == 1 && MineState[o] == 1 && PlayerInfo[i][team] && MineOwner[o] != PlayerInfo[i][team]);
Code has been edited.
Reply
#6

now i got this:
pawn Код:
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\Downloads\mine\mine.pwn(119) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
errors are in the same line u gave me!!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)