[HHT]DRON Дата: Воскресенье, 24.07.2011, 19:16:05 | Сообщение # 3
Группа: Пользователи
Сообщений: 91
я его отсюда скачивалДобавлено (24.07.2011, 19:16) --------------------------------------------- #include <a_samp> #include <zcmd> #include <sscanf> #include <dini> #include <streamer> #define PAYDAY_TIME 1800000 #define MAX_BUSS 100 #define NO_OWNER "INVALID_PLAYER_ID" #define CASE_SENSETIVE true #define White 0xFFFFFFFF #define Yellow 0xFFFF00FF #define Grey 0xC0C0C0FF #define Red 0xFF0000AA #define Green 0x45E01FFF new cpid[32]; new OwnBus[32]; new String[200]; new Name[MAX_PLAYER_NAME]; new Float:X,Float:Y,Float:Z; new Label[128]; enum Business { CP, Text3D:bLabel, Cost, Payout, bName[128], } new BusinessInfo[MAX_BUSS][Business]; public OnFilterScriptInit() { print("___________________________"); print("-Бизнес - by 26_RUSSS-------"); print("___________________________"); LoadBusinesses(); SetTimer("PayDay",PAYDAY_TIME,true); return 1; } public OnFilterScriptExit() { UnloadBusinesses(); return 1; } public OnPlayerEnterDynamicCP(playerid, checkpointid) { for(new i = 0;i<MAX_BUSS;i++) { if(checkpointid == BusinessInfo[i][CP]) { cpid[playerid] = i; format(String,sizeof(String),"Business/%i.ini",i); if(dini_Int(String, "HasOwner") == 0) { ShowPlayerDialog(playerid,219,DIALOG_STYLE_MSGBOX,"Покупка бизнеса","Вы хотите купить этот бизнес?","Купить","Нет"); } } } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 219) { if(response == 1) { format(String,sizeof(String),"Business/%i.ini",cpid[playerid]); if(OwnBus[playerid] == 1)return SendClientMessage(playerid,Red,"Вы уже являетесь владельцем бизнеса"); if(dini_Int(String,"Cost") > GetPlayerMoney(playerid))return SendClientMessage(playerid,Red,"У вас нет достаточно денег, чтобы купить этот бизнес"); GivePlayerMoney(playerid, -dini_Int(String,"Cost")); GetPlayerName(playerid,Name,sizeof(Name)); dini_Set(String, "Owner",Name); dini_IntSet(String, "OwnedBus",1); dini_IntSet(String, "HasOwner",1); format(Label, sizeof(Label), "Название: %s\nВладелец: %s\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"),dini_Get(String, "Owner"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); Update3DTextLabelText(BusinessInfo[cpid[playerid]][bLabel],White,Label); format(String,sizeof(String),"Вы успешно приобрели %s.",dini_Get(String, "Name")); SendClientMessage(playerid,Green,String); OwnBus[playerid] = 1; } if(response == 0) { SendClientMessage(playerid,Yellow,"Вы решили не покупать этот бизнес"); } } if(dialogid == 220) { if(response == 1) { GetPlayerName(playerid,Name,sizeof(Name)); format(String,sizeof(String),"Business/%i.ini",cpid[playerid]); format(Label, sizeof(Label), "Название: %s\nВладелец: %s\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); Update3DTextLabelText(BusinessInfo[cpid[playerid]][bLabel],White,Label); dini_Set(String, "Owner","No Owner"); dini_IntSet(String, "Cost",dini_Int(String, "Cost")); dini_IntSet(String, "Payout",dini_Int(String, "Payout")); dini_IntSet(String, "OwnedBus",0); dini_IntSet(String, "HasOwner",0); GivePlayerMoney(playerid,dini_Int(String, "Cost")/4); SendClientMessage(playerid,Green,"Вы продали свой бизнес и получил 25 процентов от цены."); OwnBus[playerid] = 0; } } return 1; } COMMAND:createbus(playerid, params[]) { new busid,cost,payout,name[128]; if(!IsPlayerAdmin(playerid))return 0; if(sscanf(params,"iiis",busid,cost,payout,name))return SendClientMessage(playerid, 0xFF0000AA, "Использование: /createbus [Бизнес ID] [Стоимость] [выплата] [Название]"); format(String,sizeof(String),"Business/%i.ini",busid); if(dini_Exists(String))return SendClientMessage(playerid,Red,"Это бизнес уже занят."); BusinessInfo[busid][bName] = name; BusinessInfo[busid][Cost] = cost; BusinessInfo[busid][Payout] = payout; GetPlayerPos(playerid, X, Y, Z); dini_Create(String); dini_Set(String, "Name", name); dini_Set(String, "Owner","No Owner"); dini_IntSet(String, "Cost",cost); dini_IntSet(String, "Payout",payout); dini_FloatSet(String, "BusX", X); dini_FloatSet(String, "BusY", Y); dini_FloatSet(String, "BusZ", Z); dini_IntSet(String, "World",GetPlayerVirtualWorld(playerid)); dini_IntSet(String, "Interior",GetPlayerInterior(playerid)); dini_IntSet(String, "OwnedBus",0); dini_IntSet(String, "HasOwner",0); BusinessInfo[busid][CP] = CreateDynamicCP(X,Y,Z,1.0,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid),-1,50.0); format(Label, sizeof(Label), "Название: %s\nВдаделец: Не кто\nСтоимость: $%i\nВыплата: $%i", name,cost,payout); BusinessInfo[busid][bLabel] = Create3DTextLabel(Label,White,X,Y,Z,100.0,GetPlayerVirtualWorld(playerid),1); format(String,sizeof(String),"Название: %s | Стоимость: $%i | Выплата: $%i | Владелец: Не кто",name,cost,payout); SendClientMessage(playerid,Green,String); return 1; } COMMAND:sellbus(playerid, params[]) { if(OwnBus[playerid] == 1) { ShowPlayerDialog(playerid,220,DIALOG_STYLE_MSGBOX,"Продажа бизнеса","Вы хотите продать свой бизнес?","Продать","Нет"); } else return SendClientMessage(playerid,Red,"Вы не являетесь владельцем бизнеса"); return 1; } stock GetBusOwner(bussid) { new owner[MAX_PLAYER_NAME]; format(owner, MAX_PLAYER_NAME, NO_OWNER); format(String, sizeof(String), "Business/%i.ini", bussid); if(dini_Exists(String)) { format(owner, MAX_PLAYER_NAME, "%s", dini_Get(String, "Owner")); return owner; } return owner; } COMMAND:debus(playerid, params[]) { new id; if(!IsPlayerAdmin(playerid))return 0; if(sscanf(params,"u", id))return SendClientMessage(playerid, 0xFF0000AA, "Использование: /debus [id]"); OwnBus[playerid] = 0; GetPlayerName(id,Name,MAX_PLAYER_NAME); format(String, sizeof(String), "Вы удалили %s как владелец его свой бизнес.",Name); SendClientMessage(playerid,Red, String); return 1; } stock LoadBusinesses() { new count = 0; for(new i=0; i<MAX_BUSS; i++) { format(String,sizeof(String),"Business/%i.ini",i); if(dini_Exists(String)) { BusinessInfo[i][CP] = CreateDynamicCP(dini_Float(String, "BusX"),dini_Float(String, "BusY"),dini_Float(String, "BusZ"),1.0,dini_Int(String, "World"),dini_Int(String, "Interior"),-1,100.0); if(!strcmp(GetBusOwner(i), NO_OWNER, CASE_SENSETIVE)) { format(Label, sizeof(Label), "Название: %s\nВладелец: Не кто\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); BusinessInfo[i][bLabel] = Create3DTextLabel(Label,White,dini_Float(String, "BusX"),dini_Float(String, "BusY"),dini_Float(String, "BusZ")+1,100.0,0,1); } if(strcmp(GetBusOwner(i), NO_OWNER, CASE_SENSETIVE)) { format(Label, sizeof(Label), "Название: %s\nВладелец: %s\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"), dini_Get(String, "Owner"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); BusinessInfo[i][bLabel] = Create3DTextLabel(Label,White,dini_Float(String, "BusX"),dini_Float(String, "BusY"),dini_Float(String, "BusZ")+1,100.0,0,1); } count++; } } return printf("Total Businesses Loaded: %i",count); } stock GetLastBusinessID() { new count = 0; for(new i=0; i<MAX_BUSS; i++) { format(String,sizeof(String),"Business/%i.ini",i); { count++; } } return count; } stock UnloadBusinesses() { for(new i=0; i<MAX_BUSS; i++) { Delete3DTextLabel(BusinessInfo[i][bLabel]); DestroyDynamicCP(BusinessInfo[i][CP]); } return 1; } forward PayDay(playerid); public PayDay(playerid) { Payday(); return 1; } COMMAND:forcepayday(playerid,params[]) { if(!IsPlayerAdmin(playerid))return 0; SendClientMessage(playerid,Grey,"Вы забрали свою зарплату от своего бизнеса."); Payday(); return 1; } Payday() { new id[32]; new Owner[300]; Owner = dini_Get(String,"Owner"); for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { id[i] = Owner[i]; format(String,sizeof(String),"Business/%i.ini",i); { SendClientMessage(Owner[i],Yellow,"Вы заработали деньги от вашего бизнеса"); GivePlayerMoney(Owner[i],dini_Int(String,"Payout")); } } } }
[HHT]DRON 109.68.190:242:7868
Сообщение я его отсюда скачивалДобавлено (24.07.2011, 19:16) --------------------------------------------- #include <a_samp> #include <zcmd> #include <sscanf> #include <dini> #include <streamer> #define PAYDAY_TIME 1800000 #define MAX_BUSS 100 #define NO_OWNER "INVALID_PLAYER_ID" #define CASE_SENSETIVE true #define White 0xFFFFFFFF #define Yellow 0xFFFF00FF #define Grey 0xC0C0C0FF #define Red 0xFF0000AA #define Green 0x45E01FFF new cpid[32]; new OwnBus[32]; new String[200]; new Name[MAX_PLAYER_NAME]; new Float:X,Float:Y,Float:Z; new Label[128]; enum Business { CP, Text3D:bLabel, Cost, Payout, bName[128], } new BusinessInfo[MAX_BUSS][Business]; public OnFilterScriptInit() { print("___________________________"); print("-Бизнес - by 26_RUSSS-------"); print("___________________________"); LoadBusinesses(); SetTimer("PayDay",PAYDAY_TIME,true); return 1; } public OnFilterScriptExit() { UnloadBusinesses(); return 1; } public OnPlayerEnterDynamicCP(playerid, checkpointid) { for(new i = 0;i<MAX_BUSS;i++) { if(checkpointid == BusinessInfo[i][CP]) { cpid[playerid] = i; format(String,sizeof(String),"Business/%i.ini",i); if(dini_Int(String, "HasOwner") == 0) { ShowPlayerDialog(playerid,219,DIALOG_STYLE_MSGBOX,"Покупка бизнеса","Вы хотите купить этот бизнес?","Купить","Нет"); } } } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 219) { if(response == 1) { format(String,sizeof(String),"Business/%i.ini",cpid[playerid]); if(OwnBus[playerid] == 1)return SendClientMessage(playerid,Red,"Вы уже являетесь владельцем бизнеса"); if(dini_Int(String,"Cost") > GetPlayerMoney(playerid))return SendClientMessage(playerid,Red,"У вас нет достаточно денег, чтобы купить этот бизнес"); GivePlayerMoney(playerid, -dini_Int(String,"Cost")); GetPlayerName(playerid,Name,sizeof(Name)); dini_Set(String, "Owner",Name); dini_IntSet(String, "OwnedBus",1); dini_IntSet(String, "HasOwner",1); format(Label, sizeof(Label), "Название: %s\nВладелец: %s\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"),dini_Get(String, "Owner"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); Update3DTextLabelText(BusinessInfo[cpid[playerid]][bLabel],White,Label); format(String,sizeof(String),"Вы успешно приобрели %s.",dini_Get(String, "Name")); SendClientMessage(playerid,Green,String); OwnBus[playerid] = 1; } if(response == 0) { SendClientMessage(playerid,Yellow,"Вы решили не покупать этот бизнес"); } } if(dialogid == 220) { if(response == 1) { GetPlayerName(playerid,Name,sizeof(Name)); format(String,sizeof(String),"Business/%i.ini",cpid[playerid]); format(Label, sizeof(Label), "Название: %s\nВладелец: %s\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); Update3DTextLabelText(BusinessInfo[cpid[playerid]][bLabel],White,Label); dini_Set(String, "Owner","No Owner"); dini_IntSet(String, "Cost",dini_Int(String, "Cost")); dini_IntSet(String, "Payout",dini_Int(String, "Payout")); dini_IntSet(String, "OwnedBus",0); dini_IntSet(String, "HasOwner",0); GivePlayerMoney(playerid,dini_Int(String, "Cost")/4); SendClientMessage(playerid,Green,"Вы продали свой бизнес и получил 25 процентов от цены."); OwnBus[playerid] = 0; } } return 1; } COMMAND:createbus(playerid, params[]) { new busid,cost,payout,name[128]; if(!IsPlayerAdmin(playerid))return 0; if(sscanf(params,"iiis",busid,cost,payout,name))return SendClientMessage(playerid, 0xFF0000AA, "Использование: /createbus [Бизнес ID] [Стоимость] [выплата] [Название]"); format(String,sizeof(String),"Business/%i.ini",busid); if(dini_Exists(String))return SendClientMessage(playerid,Red,"Это бизнес уже занят."); BusinessInfo[busid][bName] = name; BusinessInfo[busid][Cost] = cost; BusinessInfo[busid][Payout] = payout; GetPlayerPos(playerid, X, Y, Z); dini_Create(String); dini_Set(String, "Name", name); dini_Set(String, "Owner","No Owner"); dini_IntSet(String, "Cost",cost); dini_IntSet(String, "Payout",payout); dini_FloatSet(String, "BusX", X); dini_FloatSet(String, "BusY", Y); dini_FloatSet(String, "BusZ", Z); dini_IntSet(String, "World",GetPlayerVirtualWorld(playerid)); dini_IntSet(String, "Interior",GetPlayerInterior(playerid)); dini_IntSet(String, "OwnedBus",0); dini_IntSet(String, "HasOwner",0); BusinessInfo[busid][CP] = CreateDynamicCP(X,Y,Z,1.0,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid),-1,50.0); format(Label, sizeof(Label), "Название: %s\nВдаделец: Не кто\nСтоимость: $%i\nВыплата: $%i", name,cost,payout); BusinessInfo[busid][bLabel] = Create3DTextLabel(Label,White,X,Y,Z,100.0,GetPlayerVirtualWorld(playerid),1); format(String,sizeof(String),"Название: %s | Стоимость: $%i | Выплата: $%i | Владелец: Не кто",name,cost,payout); SendClientMessage(playerid,Green,String); return 1; } COMMAND:sellbus(playerid, params[]) { if(OwnBus[playerid] == 1) { ShowPlayerDialog(playerid,220,DIALOG_STYLE_MSGBOX,"Продажа бизнеса","Вы хотите продать свой бизнес?","Продать","Нет"); } else return SendClientMessage(playerid,Red,"Вы не являетесь владельцем бизнеса"); return 1; } stock GetBusOwner(bussid) { new owner[MAX_PLAYER_NAME]; format(owner, MAX_PLAYER_NAME, NO_OWNER); format(String, sizeof(String), "Business/%i.ini", bussid); if(dini_Exists(String)) { format(owner, MAX_PLAYER_NAME, "%s", dini_Get(String, "Owner")); return owner; } return owner; } COMMAND:debus(playerid, params[]) { new id; if(!IsPlayerAdmin(playerid))return 0; if(sscanf(params,"u", id))return SendClientMessage(playerid, 0xFF0000AA, "Использование: /debus [id]"); OwnBus[playerid] = 0; GetPlayerName(id,Name,MAX_PLAYER_NAME); format(String, sizeof(String), "Вы удалили %s как владелец его свой бизнес.",Name); SendClientMessage(playerid,Red, String); return 1; } stock LoadBusinesses() { new count = 0; for(new i=0; i<MAX_BUSS; i++) { format(String,sizeof(String),"Business/%i.ini",i); if(dini_Exists(String)) { BusinessInfo[i][CP] = CreateDynamicCP(dini_Float(String, "BusX"),dini_Float(String, "BusY"),dini_Float(String, "BusZ"),1.0,dini_Int(String, "World"),dini_Int(String, "Interior"),-1,100.0); if(!strcmp(GetBusOwner(i), NO_OWNER, CASE_SENSETIVE)) { format(Label, sizeof(Label), "Название: %s\nВладелец: Не кто\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); BusinessInfo[i][bLabel] = Create3DTextLabel(Label,White,dini_Float(String, "BusX"),dini_Float(String, "BusY"),dini_Float(String, "BusZ")+1,100.0,0,1); } if(strcmp(GetBusOwner(i), NO_OWNER, CASE_SENSETIVE)) { format(Label, sizeof(Label), "Название: %s\nВладелец: %s\nСтоимость: $%i\nВыплата: $%i",dini_Get(String, "Name"), dini_Get(String, "Owner"),dini_Int(String, "Cost"),dini_Int(String, "Payout")); BusinessInfo[i][bLabel] = Create3DTextLabel(Label,White,dini_Float(String, "BusX"),dini_Float(String, "BusY"),dini_Float(String, "BusZ")+1,100.0,0,1); } count++; } } return printf("Total Businesses Loaded: %i",count); } stock GetLastBusinessID() { new count = 0; for(new i=0; i<MAX_BUSS; i++) { format(String,sizeof(String),"Business/%i.ini",i); { count++; } } return count; } stock UnloadBusinesses() { for(new i=0; i<MAX_BUSS; i++) { Delete3DTextLabel(BusinessInfo[i][bLabel]); DestroyDynamicCP(BusinessInfo[i][CP]); } return 1; } forward PayDay(playerid); public PayDay(playerid) { Payday(); return 1; } COMMAND:forcepayday(playerid,params[]) { if(!IsPlayerAdmin(playerid))return 0; SendClientMessage(playerid,Grey,"Вы забрали свою зарплату от своего бизнеса."); Payday(); return 1; } Payday() { new id[32]; new Owner[300]; Owner = dini_Get(String,"Owner"); for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { id[i] = Owner[i]; format(String,sizeof(String),"Business/%i.ini",i); { SendClientMessage(Owner[i],Yellow,"Вы заработали деньги от вашего бизнеса"); GivePlayerMoney(Owner[i],dini_Int(String,"Payout")); } } } }
Автор - [HHT]DRON Дата добавления - 24.07.2011 в 19:16:05