Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simple Billboards system v0.1//
- //////*Author: christiand*//////
- //Please don't remove credits//
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <dini>
- #include <dudb>
- #pragma tabsize 0
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_RED 0xFF0000C8
- forward pay(playerid);
- forward nopay(playerid);
- forward requestdestroy(playerid);
- new Float:X;
- new Float:Y;
- new Float:Z;
- // CORDS FOR RENTED BILLBOARD -- YOU CAN OWN A BILLBOARD AND RENTED ONE AT SAME TIME //
- new Float:RX;
- new Float:RY;
- new Float:RZ;
- new nopayt;
- enum pBB
- {
- hasrent,
- hasbuy,
- label,
- paid,
- rentedlabel
- };
- new pickup1;
- new pickup4;
- new stringtext[256];
- new playervariables[MAX_PLAYERS][pBB];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n-------------*********----------------");
- print("Simple Billboard System [fs] by christiand");
- print("----------------Loaded----------------\n");
- pickup1 = CreatePickup(1277,1,756.1639,-949.1958,55.1867,-1);
- pickup4 = CreatePickup(1277,1,873.1735,-1026.0630,29.5987,-1);
- CreatePickup(1277,1,853.9379,-991.9512,33.1571,-1);
- CreatePickup(1277,1,883.9384,-974.5226,36.3131,-1);
- Create3DTextLabel("Billboard Info", 0xFFFF00FF,756.1639,-949.1958,55.1867, 20,0,1);
- Create3DTextLabel("Billboard Info", 0xFFFF00FF,873.1735,-1026.0630,29.5987, 20,0,1);
- Create3DTextLabel("Billboard Info", 0xFFFF00FF,853.9379,-991.9512,33.1571, 20,0,1);
- Create3DTextLabel("Billboard Info", 0xFFFF00FF,883.9384,-974.5226,36.3131, 20,0,1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n-------------*********----------------");
- print("Simple Billboard System [fs] by christiand");
- print("----------------UnLoaded----------------\n");
- return 1;
- }
- #endif
- public pay(playerid)
- {
- playervariables[playerid][paid] = 0;
- SendClientMessage(playerid, COLOR_RED, "You must pay your liability to Billboards company");
- return 1;
- }
- public requestdestroy(playerid)
- {
- SendClientMessage(playerid, COLOR_RED, "Your billboard was deleted. TAX for this service : 5$.");
- GivePlayerMoney(playerid, -5);
- Delete3DTextLabel(playervariables[playerid][rentedlabel]);
- playervariables[playerid][hasrent] = 0;
- return 1;
- }
- public nopay(playerid)
- {
- playervariables[playerid][hasrent] = 0;
- Delete3DTextLabel(playervariables[playerid][label]);
- SendClientMessage(playerid, COLOR_RED, "WARNING: Your billboard was deleted , next time pay your liability.");
- return 1;
- }
- SaveStats(playerid)
- {
- dini_IntSet(billboard(playerid), "X", floatround(X));
- dini_IntSet(billboard(playerid), "Y", floatround(Y));
- dini_IntSet(billboard(playerid), "Z", floatround(Z));
- dini_IntSet(billboard(playerid), "RX", floatround(RX));
- dini_IntSet(billboard(playerid), "RY", floatround(RY));
- dini_IntSet(billboard(playerid), "RZ", floatround(RZ));
- dini_IntSet(billboard(playerid), "hasrent", (playervariables[playerid][hasrent]));
- dini_IntSet(billboard(playerid), "hasbuy", (playervariables[playerid][hasbuy]));
- dini_IntSet(billboard(playerid), "label", (playervariables[playerid][label]));
- dini_IntSet(billboard(playerid), "rentedlabel", (playervariables[playerid][rentedlabel]));
- dini_IntSet(billboard(playerid), "paid", (playervariables[playerid][paid]));
- dini_Set(billboard(playerid),"text",stringtext);
- }
- LoadStats(playerid)
- {
- X = dini_Int(billboard(playerid), "X");
- Y = dini_Int(billboard(playerid), "Y");
- Z = dini_Int(billboard(playerid), "Z");
- RX = dini_Int(billboard(playerid), "RX");
- RY = dini_Int(billboard(playerid), "RY");
- RZ = dini_Int(billboard(playerid), "RZ");
- playervariables[playerid][hasrent] = dini_Int(billboard(playerid), "hasrent");
- playervariables[playerid][hasbuy] = dini_Int(billboard(playerid), "hasbuy");
- playervariables[playerid][label] = dini_Int(billboard(playerid), "label");
- playervariables[playerid][rentedlabel] = dini_Int(billboard(playerid), "rentedlabel");
- playervariables[playerid][paid] = dini_Int(billboard(playerid), "paid");
- stringtext = dini_Get( billboard(playerid),"text" );
- }
- stock Player(playerid)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
- return pname;
- }
- stock billboard(playerid)
- {
- new x[256];
- format(x, sizeof(x), "Billboards/%s.ini",udb_encode(Player(playerid)));
- return x;
- }
- public OnPlayerConnect(playerid)
- {
- LoadStats(playerid);
- if(playervariables[playerid][hasbuy] == 1)
- {
- Create3DTextLabel( stringtext, 0xFFFFFFFF, X, Y, Z, 60.00, 0, 0);
- }
- if(playervariables[playerid][hasrent] == 1)
- {
- Create3DTextLabel( stringtext, 0xFFFFFFFF, RX, RY, RZ, 60.00, 0, 0);
- }
- playervariables[playerid][paid] = 1;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if (!dini_Exists(billboard(playerid)))
- {
- dini_Create(billboard(playerid));
- }
- SaveStats(playerid);
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(pickupid == pickup1)
- SetPlayerPos(playerid, 762.7893,-956.7414,58.2656);
- if(pickupid == pickup4)
- SetPlayerPos(playerid, 871.9459,-1023.2238,47.9922);
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if( playervariables[playerid][hasrent] == 1)
- {
- if( playervariables[playerid][paid] == 0 )
- {
- nopayt = SetTimer("nopay", 240000 ,0);
- }
- }
- return 1;
- }
- CMD:buybb(playerid, params[])
- {
- if( playervariables[playerid][hasbuy] == 0 )
- {
- if( IsPlayerInRangeOfPoint(playerid, 30.0, 871.9459,-1023.2238,47.9922) || IsPlayerInRangeOfPoint(playerid, 30.0, 762.7893,-956.7414,58.2656) )
- {
- if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "Syntax: /buybb [text]");
- GetPlayerPos(playerid, X, Y, Z);
- format(stringtext, sizeof(stringtext), "[ %s ]", params);
- playervariables[playerid][label] = Create3DTextLabel(stringtext, 0xFFFFFFFF, X, Y, Z, 60.00, 0, 0);
- GivePlayerMoney(playerid, -1000);
- SendClientMessage(playerid, COLOR_WHITE, "You bought succesfully billboard for $1000.");
- playervariables[playerid][hasbuy] = 1;
- PlayerPlaySound(playerid, 1149, X, Y, Z);
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You are not at a place where you can buy billboard.");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You already own a billboard.");
- }
- return 1;
- }
- CMD:editbb(playerid, params[])
- {
- if( IsPlayerInRangeOfPoint(playerid, 30.0, X, Y, Z) || IsPlayerInRangeOfPoint(playerid, 30.0, RX, RY, RZ) )
- {
- if( playervariables[playerid][hasbuy] == 1 || playervariables[playerid][hasrent] == 1 )
- {
- if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "Syntax: /editbb [text]");
- format(stringtext, sizeof(stringtext), "[ %s ]", params);
- Update3DTextLabelText(playervariables[playerid][label], COLOR_WHITE, stringtext);
- SendClientMessage(playerid, COLOR_WHITE, "You edited your billboard , additional TAX : 3$");
- GivePlayerMoney(playerid, -3);
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You don't own or have rented a billboard.");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You are not near your billboard place.");
- }
- return 1;
- }
- CMD:destroybb(playerid, params[])
- {
- if( IsPlayerInRangeOfPoint(playerid, 30.0, X, Y, Z) )
- {
- if( playervariables[playerid][hasbuy] == 1 )
- {
- Delete3DTextLabel(playervariables[playerid][label]);
- SendClientMessage(playerid, COLOR_WHITE, "You deleted your billboard.");
- playervariables[playerid][hasbuy] = 0;
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You don't own a billboard");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You are not near your billboard place.");
- }
- return 1;
- }
- CMD:rentbb(playerid, params[])
- {
- if( playervariables[playerid][hasrent] == 0 )
- {
- if( IsPlayerInRangeOfPoint(playerid, 30.0, 871.9459,-1023.2238,47.9922) || IsPlayerInRangeOfPoint(playerid, 30.0, 762.7893,-956.7414,58.2656) )
- {
- if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "Syntax: /rentbb [text]");
- GetPlayerPos(playerid, RX, RY, RZ);
- format(stringtext, sizeof(stringtext), "[ %s ]", params);
- playervariables[playerid][rentedlabel] = Create3DTextLabel(stringtext, 0xFFFFFFFF, RX, RY, RZ, 60.00, 0, 0);
- GivePlayerMoney(playerid, -2);
- SendClientMessage(playerid, COLOR_WHITE, "You have rented a billboard for 2 $ / hour.");
- SendClientMessage(playerid, COLOR_RED, "HINT: You need to pay rent at time or billboard will get deleted.");
- playervariables[playerid][hasrent] = 1;
- playervariables[playerid][paid] = 1;
- PlayerPlaySound(playerid, 1149, RX, RY, RZ);
- SetTimer("pay", 3600000, 1);
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You are not at a place where you can rent billboard.");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You already rented a billboard.");
- }
- return 1;
- }
- CMD:payrentbb(playerid, params[])
- {
- if( playervariables[playerid][paid] == 0 )
- {
- GivePlayerMoney(playerid, -2);
- SendClientMessage(playerid , COLOR_WHITE, "You paid 2$ for rented billboard");
- playervariables[playerid][paid] = 1;
- KillTimer(nopayt);
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You already paid");
- }
- return 1;
- }
- CMD:requestdestroybb(playerid, params[])
- {
- if( playervariables[playerid][hasrent] == 1 )
- {
- SetTimer("requestdestroy", 120000, 0);
- SendClientMessage(playerid, COLOR_WHITE, "You must wait 2 minutes , be patient please");
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "You don't have an rented billboard");
- }
- return 1;
- }
- CMD:mybbstat(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_RED, "________MY BILLBOARD STATUS________");
- if( playervariables[playerid][hasrent] == 1 )
- {
- SendClientMessage(playerid, COLOR_WHITE, "Rented Billboard: YES");
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "Rented Billboard: NO");
- }
- if( playervariables[playerid][hasbuy] == 1 )
- {
- SendClientMessage(playerid, COLOR_WHITE, "Bought Billboard: YES");
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "Bought Billboard: NO");
- }
- if( playervariables[playerid][hasrent] == 1)
- {
- if( playervariables[playerid][paid] == 1 )
- {
- SendClientMessage(playerid, COLOR_WHITE, "Rent Paid?: YES");
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "Rent Paid?: NO ! Pay ASAP !");
- SendClientMessage(playerid, COLOR_RED, "______________________________");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "Rent Paid?: You don't have a rented billboard!");
- }
- return 1;
- }
- CMD:bbhelp(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_RED, "________BILLBOARD COMMANDS_______");
- SendClientMessage(playerid, COLOR_WHITE, "/buybb /rentbb /editbb /destroybb");
- SendClientMessage(playerid, COLOR_WHITE, "/payrentbb /requestdestroybb /mybbstats");
- SendClientMessage(playerid, COLOR_WHITE, "Thanks for using my Filescript!");
- SendClientMessage(playerid, COLOR_RED, "______________________________");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment