Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define PropBuy 147
- #define PropSell 148
- #define Msg 149
- #define PayTime 3 // Pay Timer (In MINUTES!!!!)
- new Ptime[MAX_PLAYERS]=0;
- new HProps[MAX_PLAYERS];
- enum Prop
- {
- PName[30],
- PPrice,
- PEarn,
- Float:Px,
- Float:Py,
- Float:Pz,
- POwner[24],
- PoID
- };
- new PropVar[][Prop] =
- {
- // {"Name", Price, Earning, X, Y, Z},
- {"LV Gas Station", 15000, 70, 2117.5022,897.8309,11.1797},
- {"LV Ammunation", 20000, 2000, 2155.4102,946.4137,10.8203},
- {"Four-Dragons Casino",100000, 5000, 2024.5090,1008.0150,10.5257},
- {"LV Money Ship", 50000, 2500, 2008.6862,1544.8174,12.4446},
- {"Royal Casino", 70000, 3500, 2087.8044,1516.0709,10.5244}
- };
- new Pu[sizeof(PropVar)+1];
- new Text3D:Pt[sizeof(PropVar)+1];
- new CurrentP[MAX_PLAYERS];
- new str[256];
- public OnFilterScriptInit()
- {
- for(new i; i<sizeof(PropVar); i++)
- {
- format(PropVar[i][POwner], 24, "None");
- PropVar[i][PoID] = -1;
- Pu[i] = CreatePickup(1272, 1, PropVar[i][Px], PropVar[i][Py] , PropVar[i][Pz], -1);
- format(str, 256, "{FF0000}%s\n{FFFF00}Owner: {FFFFFF}%s\n{FFFF00}Price: {FFFFFF}%d$\n{FFFF00}Earning: {FFFFFF}%d$",PropVar[i][PName], PropVar[i][POwner], PropVar[i][PPrice], PropVar[i][PEarn]);
- Pt[i] = Create3DTextLabel(str, 0xFFFFFFAA, PropVar[i][Px], PropVar[i][Py] , PropVar[i][Pz], 20.0, 0, 0);
- }
- print(">>PropSys By _DucK_ >>....Loaded");
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i; i<sizeof(PropVar)+1; i++)
- {
- DestroyPickup(Pu[i]);
- Delete3DTextLabel(Pt[i]);
- }
- print(">>PropSys By _DucK_ >>....UnLoaded");
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- for(new i; i<sizeof(PropVar); i++)
- {
- if(pickupid == Pu[i])
- {
- if(!strcmp(PropVar[i][POwner], "None", false))
- {
- format(str, 256, "{FFFFFF}Do You Want To Buy {0000FF}%s {FFFFFF}For {0000FF}%d$ {FFFFFF}And Earn {0000FF}%d$?", PropVar[i][PName], PropVar[i][PPrice], PropVar[i][PEarn]);
- ShowPlayerDialog(playerid, PropBuy, DIALOG_STYLE_MSGBOX, "{FFFFFF}Property System",str, "Buy", "Exit");
- CurrentP[playerid] = i;
- }
- else if(!strcmp(PropVar[i][POwner], GetName(playerid), false))
- {
- format(str, 256, "{FFFFFF}Do You Want To Sell {0000FF}%s {FFFFFF}For {0000FF}%d$ {FFFFFF}And Stop Earning Money From It?", PropVar[i][PName], PropVar[i][PPrice]/2);
- ShowPlayerDialog(playerid, PropSell, DIALOG_STYLE_MSGBOX, "{FFFFFF}Property System", str, "Sell", "Exit");
- }
- else
- {
- format(str, 256, "{FFFFFF}Owned Property. {FFFFFF}This Property Is Owned By Another Player, So You Can't Buy Ita");
- SendClientMessage(playerid, -1, str);
- }
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == PropBuy && response)
- {
- if(GetPlayerMoney(playerid) < PropVar[CurrentP[playerid]][PPrice]) return SendClientMessage(playerid, -1, "no Enough Money");
- GivePlayerMoney(playerid, -PropVar[CurrentP[playerid]][PPrice]);
- format(PropVar[CurrentP[playerid]][POwner], 24, "%s", GetName(playerid));
- PropVar[CurrentP[playerid]][PoID] = playerid;
- format(str, 256, "{00FF00}%s\n{FFFF00}Owner: {FFFFFF}%s\n{FFFF00}Price: {FFFFFF}%d$\n{FFFF00}Earning: {FFFFFF}%d$", PropVar[CurrentP[playerid]][PName], PropVar[CurrentP[playerid]][POwner], PropVar[CurrentP[playerid]][PPrice], PropVar[CurrentP[playerid]][PEarn]);
- Update3DTextLabelText(Pt[CurrentP[playerid]], 0xFFFFFFAA, str);
- PayTimer(playerid);
- SendClientMessage(playerid, -1, "{FFFF00}PropSys: You Have Bought A New Propery! (/PropList)");
- }
- if(dialogid == PropSell && response)
- {
- GivePlayerMoney(playerid, PropVar[CurrentP[playerid]][PPrice]/2);
- format(PropVar[CurrentP[playerid]][POwner], 24, "None");
- PropVar[CurrentP[playerid]][PoID] = -1;
- format(str, 256, "{FF0000}%s\n{FFFF00}Owner: {FFFFFF}%s\n{FFFF00}Price: {FFFFFF}%d$\n{FFFF00}Earning: {FFFFFF}%d$", PropVar[CurrentP[playerid]][PName], PropVar[CurrentP[playerid]][POwner], PropVar[CurrentP[playerid]][PPrice], PropVar[CurrentP[playerid]][PEarn]);
- Update3DTextLabelText(Pt[CurrentP[playerid]], 0xFFFFFFAA, str);
- SendClientMessage(playerid, -1, "{FFFF00}PropSys: You Have Sold Your Propery! (/PropList)");
- CurrentP[playerid] = 0;
- HProps[playerid]--;
- if(HProps[playerid] == 0)
- {
- KillTimer(Ptime[playerid]);
- }
- }
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/PropList", true))
- {
- if(HProps[playerid] == 0) return ShowPlayerDialog(playerid, Msg, DIALOG_STYLE_MSGBOX, "{FFFF00}PropSys", "{FFFFFF}You Don't Have Any Properties!", "OK", "");
- new Te;
- format(str, sizeof(str), "");
- for(new i; i<sizeof(PropVar); i++)
- {
- if(playerid == PropVar[i][PoID])
- {
- format(str, 256, "%s\n{FFFFFF}Name: {FFFF00}%s {FFFFFF}- Earning: {FFFF00}%d$", str, PropVar[i][PName], PropVar[i][PEarn]);
- Te += PropVar[i][PEarn];
- }
- }
- format(str, 256, "%s\n{FFFFFF}Total Earning: {0000FF}%d$", str, Te);
- ShowPlayerDialog(playerid, Msg, DIALOG_STYLE_MSGBOX, "{FFFF00}PropSys", str, "OK", "");
- return 1;
- }
- if(!strcmp(cmdtext, "/Credit", true))
- {
- ShowPlayerDialog(playerid, Msg, DIALOG_STYLE_MSGBOX, "{FFFF00}PropSys", "{FF0000}Credits:\n{FFFFFF}\n\nPropSys By _DucK_\nv0.1\nDO NOT REMOVE", "OK", "");
- return 1;
- }
- return 0;
- }
- public OnPlayerDisconnect(playerid)
- {
- for(new i; i<sizeof(PropVar); i++)
- {
- format(PropVar[i][POwner], 24, "None");
- PropVar[i][PoID] = -1;
- format(str, 256, "{FF0000}%s\n{FFFF00}Owner: {FFFFFF}%s\n{FFFF00}Price: {FFFFFF}%d$\n{FFFF00}Earning: {FFFFFF}%d$", PropVar[i][PName], PropVar[i][POwner], PropVar[i][PPrice], PropVar[i][PEarn]);
- Update3DTextLabelText(Pt[i], 0xFFFFFFAA, str);
- HProps[playerid] = 0;
- }
- return 1;
- }
- forward PayTimer(playerid);
- public PayTimer(playerid)
- {
- if(HProps[playerid] == 0)
- {
- Ptime[playerid] = SetTimerEx("PayTZ",1000*60*PayTime,1,"i",playerid);
- }
- HProps[playerid]++;
- }
- forward PayTZ(playerid);
- public PayTZ(playerid)
- {
- new Earn[MAX_PLAYERS];
- for(new i; i<sizeof(PropVar); i++)
- {
- if(PropVar[i][PoID] == playerid)
- {
- Earn[playerid] += PropVar[i][PEarn];
- }
- }
- format(str, 256, "{FFFF00}PropSys: {FFFFFF}You Have Earned {00FF00}%d$ {FFFFFF}From Your Properties {FF0000}(/PropList)", Earn[playerid]);
- SendClientMessage(playerid, -1, str);
- GivePlayerMoney(playerid, Earn[playerid]);
- }
- stock GetName(playerid)
- {
- new xname[MAX_PLAYER_NAME];
- GetPlayerName(playerid,xname,sizeof(xname));
- return xname;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement