Error 029 help.
#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


Messages In This Thread
Error 029 help. - by SpyGames - 15.04.2015, 15:42
AW: Error 029 help. - by Mencent - 15.04.2015, 15:43
Re: Error 029 help. - by SpyGames - 15.04.2015, 15:49
Re: Error 029 help. - by ATGOggy - 15.04.2015, 15:50
AW: Error 029 help. - by Mencent - 15.04.2015, 15:51
Re: Error 029 help. - by SpyGames - 15.04.2015, 15:55
Re: Error 029 help. - by Konstantinos - 15.04.2015, 15:58
Re: Error 029 help. - by SpyGames - 15.04.2015, 16:07
Re: Error 029 help. - by Konstantinos - 15.04.2015, 16:16
Re: Error 029 help. - by SpyGames - 15.04.2015, 16:19

Forum Jump:


Users browsing this thread: 1 Guest(s)