29.08.2011, 10:01
i found this filterscript wich allow me to place mines
i want use this filterscript on SATDM V9 gamemode but i got these errors:
the line 121 is this:
can anyone help me with this and give me a clue how to make it work with SATDM
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);
}
Код:
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.
pawn Код:
if(IsMine[o] == 1 && MineState[o] == 1 && PlayerInfo[playerid][team][MineOwner[o]] != PlayerInfo[playerid][team][i])