hmm -
LifeRah - 20.05.2016
hello guys, i am using a gift system:-
PHP код:
/*--S-Giftbox created by simo0000*/
#include <a_samp>
#include <streamer>
#include <sscanf2>
#include <zcmd>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000FF
#define MAX_RANDOM_GIFTS 6
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("S-AFK system by simo0000 is loaded.");
print("--------------------------------------\n");
return 1;
}
#pragma tabsize 0
stock RandomGift(playerid)
{
new randomgift = random(MAX_RANDOM_GIFTS) + 1;
switch (randomgift)
{
case 1:
{
GivePlayerMoney(playerid, 10000);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 10000$ enjoy!.");
}
case 2:
{
GivePlayerMoney(playerid, 200);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 200$ enjoy!.");
}
case 3:
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 100 armour enjoy!.");
}
case 4:
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 100 HP enjoy!.");
}
case 5:
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
SendClientMessage(playerid, COLOR_YELLOW, "You have won a free level up!.");
}
case 6:
{
SendClientMessage(playerid, COLOR_YELLOW, "Sorry, you got nothing try again!.");
}
}
return 1;
}
new Float:giftPos[4];
new giftboxobject;
new giftboxcreated = 0;
new Text3D:giftbox3DText;
CMD:giftbox(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not an admin!");
if (isnull(params))
{
SendClientMessage(playerid, -1, "/giftbox [Option]");
SendClientMessage(playerid, COLOR_YELLOW, "[OPTIONS]: place, destroy");
return 1;
}
static
Float:X,
Float:Y,
Float:Z,
Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
if (!strcmp(params, "place", true))
{
if (IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_RED, "You must be outside vehicle first.");
if(giftboxcreated == 1) return SendClientMessage(playerid, COLOR_RED, "Giftbox is already placed.");
giftPos[0] = X;
giftPos[1] = Y;
giftPos[2] = Z;
giftboxcreated = 1;
giftboxobject = CreateDynamicObject(19054, X, Y, Z - 0.4, 0.0, 0.0, A);
giftbox3DText = CreateDynamic3DTextLabel("/getgift\nTo get your gift.",0x10F441AA,X, Y, Z+0.25,8.0);
SendClientMessage(playerid, -1, "You have placed a giftbox");
return 1;
}
if (!strcmp(params, "destroy", true))
{
if(giftboxcreated == 0) return SendClientMessage(playerid, COLOR_RED, "Giftbox is not placed yet.");
DestroyDynamicObject(giftboxobject);
DestroyDynamic3DTextLabel(giftbox3DText);
giftboxcreated = 0;
SendClientMessage(playerid, -1, "You have destoryed the giftbox");
return 1;
}
return 1;
}
new TimeCMD[MAX_PLAYERS];
CMD:getgift(playerid)
{
if(!IsPlayerConnected(playerid))
return SendClientMessage(playerid, -1, "You must be logged in to do this.");
if(TimeCMD[playerid] > gettime())
return SendClientMessage(playerid, 0xFF0000FF, "You have reached the limit, try again after sometime!");
TimeCMD[playerid] = 2 * 60 * 60 + gettime();
GetObjectPos(giftboxobject, giftPos[0], giftPos[1], giftPos[2]);
if(IsPlayerInRangeOfPoint(playerid, 5.0, giftPos[0], giftPos[1], giftPos[2]) && giftboxcreated == 1)
{
RandomGift(playerid);
}
return 1;
}
i want that instead of making giftbox's it must be placed at one same place and thats anywhere near city hall so plz tell me how to make a permenant giftbox near city hall?
Re: hmm -
Nin9r - 20.05.2016
It is to simple. You have to write a command for this.
Add it to PUBLIC ONGAMEMODEINIT:
Код HTML:
CreateDynamicObject(19054, X, Y, Z - 0.4, 0.0, 0.0, A);
CreateDynamic3DTextLabel("/getgift\nTo get your gift.",0x10F441AA,X, Y, Z+0.25,8.0);
Код HTML:
CMD:getgift(playerid, params[])
{
if(TimeCMD[playerid] > gettime())
return SendClientMessage(playerid, 0xFF0000FF, "You have reached the limit, try again after sometime!");
if(IsPlayerInRangeOfPoint(playerid, 15.0, 1083.3048,-1796.6688,13.6722))
{
TimeCMD[playerid] = 2 * 60 * 60 + gettime();
new gift = random(7);
switch (gift)
{
case 1:
{
GivePlayerMoney(playerid, 10000);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 10000$ enjoy!.");
}
case 2:
{
GivePlayerMoney(playerid, 200);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 200$ enjoy!.");
}
case 3:
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 100 armour enjoy!.");
}
case 4:
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, COLOR_YELLOW, "You have won 100 HP enjoy!.");
}
case 5:
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
SendClientMessage(playerid, COLOR_YELLOW, "You have won a free level up!.");
}
case 6:
{
SendClientMessage(playerid, COLOR_YELLOW, "Sorry, you got nothing try again!.");
}
}
orejucate[playerid] = 0;
}
else
{
CP[playerid] = 385;
SCM(playerid,COLOR_WHITE, "You are not at gift location. Go to checkpoint.");
SetPlayerCheckpoint(playerid, 1083.3048,-1796.6688,13.6722, 2);
}
return 1;
}
Go in game and save the city hall gift position with /save. Don't forget to replace 1083.3048,-1796.6688,13.6722 with your coordinates. Also X,Y,Z from the pickup/3dtext in ONGAMEMODEINIT.