Error 029 help.
#1

”error 029: invalid expression, assumed zero”
I got this message, a lots of time, can i have some help?
Reply
#2

Hello!

Can you show us the code of the corresponding error line?

Mencent
Reply
#3

Sure, i need help for a gift box filterscript.
Quote:

/*

-------------------------------------------------------
-------------------------------------------------------
Gift System Update! Version 1.0

Credits to

MouseBreaker, SA-MP Team
RoamPT For Zone System
-------------------------------------------------------
-------------------------------------------------------

*/

// Include
#include <a_samp>

// Server Colours
#define COLOR_WHITE 0xD4D4D4C8
#define COLOR_GREEN 0x00E800FF
#define COLOR_RED 0xEC0000FF

// Definitions
#define MAX_GIFTS (500)

// Forward
forward GetPlayerGiftFounds(playerid);
forward GetPlayerGiftReceiveds(playerid);

// Server Variable
new giftCounter;
new Gift[MAX_GIFTS];
new Picked[MAX_PLAYERS];
new RandomModel[5][1] = {
{19054},
{19055},
{19056},
{19057},
{19058}
};

enum PlayerInfo
{
aGift,
gFound
};

new pInfo[MAX_PLAYERS][PlayerInfo];

#define MAX_ZONE_NAME 28

forward Zones_Update();

enum SAZONE_MAIN {
SAZONE_NAME[28],
Float:SAZONE_AREA[6]
};

static const gSAZones[][SAZONE_MAIN] = {
// NAME AREA (Xmin,Ymin,Zmin,Xmax,Ymax,Zmax) Removed for post, not needed.


public OnPlayerConnect(playerid)
{
Picked[playerid] = 0;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/agift", cmdtext, true, 10) == 0 || strcmp("/admingift", cmdtext, true, 10) == 0)
{
new string[128];
if(IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
switch(random(5))
{
case 0: {
new rand = (100 + random(2400));
GivePlayerMoney(i, rand);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~$%d", rand);
GameTextForPlayer(i, string, 4000, 3);
}
case 1: {
SetPlayerHealth(i, 100);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~A Candy Cane");
GameTextForPlayer(i, string, 4000, 3);
}
case 2: {
SetPlayerArmour(i, 100);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~Full Body Armour");
GameTextForPlayer(i, string, 4000, 3);
}
case 3: {
new rand = (100 + random(2400));
GivePlayerMoney(i, rand);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~$%d", rand);
GameTextForPlayer(i, string, 4000, 3);
}
case 4: {
new rand = (100 + random(2400));
GivePlayerMoney(i, rand);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~$%d", rand);
GameTextForPlayer(i, string, 4000, 3);
}
}
pInfo[i][aGift]++;
}
}
format(string, sizeof(string), "Happy Holidays! You Have Received A Gift From The J:RP Admins.");
SendClientMessageToAll(COLOR_WHITE, string);
}
else
{
return 0;
}
return 1;
}
if (strcmp("/addgift", cmdtext, true, 10) == 0 || strcmp("/creategift", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid))
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new rand = random(sizeof(RandomModel));
Gift[giftCounter] = CreatePickup(RandomModel[rand][0], 1, x + 3, y + 1, z, GetPlayerVirtualWorld(playerid));
giftCounter++;
new string[128 + MAX_ZONE_NAME], zone[MAX_ZONE_NAME];
GetPlayer2DZone(playerid, zone, sizeof(zone));
format(string, sizeof(string), "Santa Claus Has Put A Gift At %s! Go And Open It Fast!", zone);
SendClientMessageToAll(COLOR_RED, string);
}
else
{
return 0;
}
return 1;
}
return 0;
}

public OnPlayerDisconnect(playerid)
{
Picked[playerid] = 0;
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
new string[128];
for(new x = 0; x < MAX_GIFTS; x++)
{
if(pickupid == Gift[x] && Picked[playerid] == 0)
{
switch(random(x))
{
case 0:
{
new rand = (100 + random(2400));
GivePlayerMoney(playerid, rand);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~$%d", rand);
GameTextForPlayer(playerid, string, 4000, 3);
format(string, sizeof(string), "Happy Holidays! You Have Received $%d!", rand);
SendClientMessage(playerid, COLOR_GREEN, string);
}
case 1:
{
SetPlayerHealth(playerid, 100);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~A Candy Cane");
GameTextForPlayer(playerid, string, 4000, 3);
SendClientMessage(playerid, COLOR_GREEN, "You Have Received A Candy Cane! Your Health Has Been Refilled!");
}
case 2:
{
SetPlayerArmour(playerid, 100);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~Full Body Armour");
GameTextForPlayer(playerid, string, 4000, 3);
SendClientMessage(playerid, COLOR_GREEN, "You Have Received Body Armour! Your Armour Has Been Refilled!");
}
case 3:
{
new rand = (100 + random(2400));
GivePlayerMoney(playerid, rand);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~$%d", rand);
GameTextForPlayer(playerid, string, 4000, 3);
format(string, sizeof(string), "Happy Holidays! You Have Received $%d!", rand);
SendClientMessage(playerid, COLOR_GREEN, string);
}
case 4:
{
new rand = (100 + random(2400));
GivePlayerMoney(playerid, rand);
format(string, sizeof(string), "~r~Happy Holidays!~n~~w~Received ~g~$%d", rand);
GameTextForPlayer(playerid, string, 4000, 3);
format(string, sizeof(string), "Happy Holidays! You Have Received $%d!", rand);
SendClientMessage(playerid, COLOR_GREEN, string);
}
}
new zone[MAX_ZONE_NAME], pname[MAX_PLAYER_NAME];
GetPlayer2DZone(playerid, zone, sizeof(zone));
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s Has Opend Their Gift At %s!", pname, zone);
SendClientMessageToAll(COLOR_RED, string);
DestroyPickup(Gift[x]);
pInfo[playerid][gFound]++;
Picked[playerid] = 1;
}
}
Picked[playerid] = 0;
return 1;
}

public GetPlayerGiftFounds(playerid)
{
return pInfo[playerid][gFound];
}

public GetPlayerGiftReceiveds(playerid)
{
return pInfo[playerid][aGift];
}

stock IsPlayerInZone(playerid, zone[])
{
new TmpZone[MAX_ZONE_NAME];
GetPlayer3DZone(playerid, TmpZone, sizeof(TmpZone));
for(new i = 0; i != sizeof(gSAZones); i++)
{
if(strfind(TmpZone, zone, true) != -1)
return 1;
}
return 0;
}

stock GetPlayer2DZone(playerid, zone[], len)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i != sizeof(gSAZones); i++ )
{
if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4])
{
return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
}
}
return 0;
}

stock GetPlayer3DZone(playerid, zone[], len)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i != sizeof(gSAZones); i++ )
{
if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4] && z >= gSAZones[i][SAZONE_AREA][2] && z <= gSAZones[i][SAZONE_AREA][5])
{
return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
}
}
return 0;
}

Reply
#4

:/ show the error line
Reply
#5

Yes, but where is the error there?

Mencent
Reply
#6

Here;
Quote:

C:\Users\Flav\Desktop\Folder nou (2)\filterscripts\Gift.pwn(64) : error 029: invalid expression, assumed zero
C:\Users\Flav\Desktop\Folder nou (2)\filterscripts\Gift.pwn(267) : warning 203: symbol is never used: "OnPlayerConnect"

Reply
#7

You did not close the bracket at the gSAZones array. Your code:
PHP код:
enum SAZONE_MAIN {
    
SAZONE_NAME[28],
    
Float:SAZONE_AREA[6]
};

static const 
gSAZones[][SAZONE_MAIN] = {
    
//    NAME AREA (Xmin,Ymin,Zmin,Xmax,Ymax,Zmax) Removed for post, not needed.
    
    
    
public OnPlayerConnect(playerid)
    {
        
Picked[playerid] = 0;
        return 
1;
    } 
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You did not close the bracket at the gSAZones array. Your code:
PHP код:
enum SAZONE_MAIN {
    
SAZONE_NAME[28],
    
Float:SAZONE_AREA[6]
};
static const 
gSAZones[][SAZONE_MAIN] = {
    
//    NAME AREA (Xmin,Ymin,Zmin,Xmax,Ymax,Zmax) Removed for post, not needed.
    
    
    
public OnPlayerConnect(playerid)
    {
        
Picked[playerid] = 0;
        return 
1;
    } 
That didnt help.
Now the errors look like this:
Quote:

C:\Users\Flav\Desktop\Folder nou (2)\filterscripts\Gift.pwn(61) : error 029: invalid expression, assumed zero
C:\Users\Flav\Desktop\Folder nou (2)\filterscripts\Gift.pwn(61 -- 63) : error 008: must be a constant expression; assumed zero

Maybe i putted in the wrong line, where do i need to put it?
Reply
#9

The code I posted is not the solution but your actual code. By adding }; before OnPlayerConnect would fix the errors but you still have to add some stuff to the gSAZones array as it'll be just empty and without any effect.
Reply
#10

Well then i give up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)