Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #include <YSI\y_ini>
- #include <YSI\y_hooks>
- #include "../include/gl_common.inc"
- #include <zcmd>
- #include <streamer>
- #define SCM SendClientMessage
- #define NOTADMIN ">> Non puoi usare questo comando!"
- //COLORI
- #define COL_TITLES "{FFEE00}"
- #define COL_BIANCO "{FFFFFF}"
- #define COL_ROSSO "{F81414}"
- #define COL_VERDE "{00FF22}"
- #define COL_AZZU "{D6D8FF}"
- #define COL_BLU "{0000C1}"
- #define COLORE_POLIZIA 0x00D9E6FF
- #define COLORE_MEDICI 0xFF0000FF
- #define BIANCO 0xFFFFFFFF
- #define NERO 0x000000FF
- #define VERDE 0x005700FF
- #define BLU 0x0000FFFF
- #define GIALLO 0xFFEE00FF
- #define GIALLOSCURO 0xFFB900FF
- #define ARANCIONE 0xFF6600FF
- #define GRIGIO 0xAFAFAFAA
- #define ROSSO 0xFF0000FF
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD3 0xCBCCCEFF
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_GRAD6 0xF0F0F0FF
- #define DVERDE 0x5DFF00FF
- #define DIALOG_GESTIONE_CASA 150
- #define DIALOG_GESTIONE_CASSAFORTE 151
- #define DIALOG_GESTIONE_PRELEVA 152
- #define DIALOG_GESTIONE_DEPOSITA 153
- //PATH
- #define HPATH "/Utenti/Case/%i.ini"
- new Text3D:hlabel[500];
- new Soldi[MAX_PLAYERS];
- enum HomeInfo{
- Float:hPosX,
- Float:hPosY,
- Float:hPosZ,
- Float:hPosA,
- Float:hPosXX,
- Float:hPosYY,
- Float:hPosZZ,
- Float:hPosAA,
- hIntID,
- hProprietario[MAX_PLAYER_NAME],
- hComprato,
- hIcon,
- hPrezzo,
- hCassa,
- hInterior,
- hVirtualWorld,
- };
- new hInfo[500][HomeInfo];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- new stri[500];
- for(new id = 1; id < sizeof(MAX_HOME); id++){
- format(stri, sizeof(stri), HPATH, id);
- INI_ParseFile(stri, "loadhome_%s", .bExtra = true, .extra = id );
- new strin[250];
- if(hInfo[id][hComprato] == 0){
- format(strin, sizeof(strin), "Casa[ID:%d]\nProprietario: %s\nPrezzo: %d\n Per comprare premi Y",id,hInfo[id][hProprietario],hInfo[id][hPrezzo]);
- hInfo[id][hIcon] = CreateDynamicPickup(1273, 1, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ],0);
- hlabel[id] = CreateDynamic3DTextLabel(strin, GIALLO, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ], 3.0, INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0);
- }else if(hInfo[id][hComprato] == 1){
- hInfo[id][hIcon] = CreateDynamicPickup(1272, 1, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ]);
- format(stri, sizeof(stri), "Casa[ID:%d]\nProprietario: %s\nPrezzo: %d\n Premi Y per interagire",id,hInfo[id][hProprietario],hInfo[id][hPrezzo]);
- hlabel[id] = CreateDynamic3DTextLabel(strin, GIALLO, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ]);}
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new id = 1; id < sizeof(MAX_HOME); id++){
- if(hInfo[id][hPrezzo] == 0) break;
- SaveHome(id);}
- return 1;
- }
- #else
- main() {}
- #endif
- CMD:ccasa(playerid, params[]){
- if(!IsPlayerAdmin(playerid)) return SCM(playerid, GRIGIO, NOTADMIN);
- new prezzo, interior, string0[240], string1[240], id, Float:X, Float:Y, Float:Z, Float:A;
- if(sscanf(params, "ii", prezzo, interior)) return SCM(playerid, GIALLO, "/ccasa [PREZZO] [INTERIOR-ID (1-25)]");
- if(prezzo < 1) return SCM(playerid, GRIGIO, "Prezzo invalido");
- if(interior < 1 || interior > 25) return SCM(playerid, GRIGIO, "ID invalido! Interior ID [1-25]");
- for(new h = 1;h < sizeof(hInfo); h++){
- if(hInfo[h][hPrezzo] == 0){
- id = h;
- break;}}
- GetPlayerPos(playerid, X,Y,Z);
- GetPlayerFacingAngle(playerid, A);
- hInfo[id][hPrezzo] = prezzo;
- hInfo[id][hComprato] = 0;
- hInfo[id][hPosX] = X;
- hInfo[id][hPosY] = Y;
- hInfo[id][hPosZ] = Z;
- hInfo[id][hPosA] = A;
- hInfo[id][hInterior] = interior;
- hInfo[id][hVirtualWorld] = id;
- hInfo[id][hIcon] = CreateDynamicPickup(1273, 1, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ],0);
- format(string0, sizeof(string0), "Nessuno");
- strmid(hInfo[id][hProprietario], string0, 0, strlen(string0), 255);
- format(string1, sizeof(string1), "Casa[ID:%d]\nProprietario: %s\nPrezzo: %d\n Per comprare premi Y", id, hInfo[id][hProprietario], hInfo[id][hPrezzo]);
- hlabel[id] = CreateDynamic3DTextLabel(string1, GIALLO, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ], 3.0, INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0);
- //==Save Interior===============================================================
- if(hInfo[id][hInterior] == 1){//ryder 2
- hInfo[id][hIntID] = 2;
- hInfo[id][hPosXX] = 2466.3015;
- hInfo[id][hPosYY] = -1698.5970;
- hInfo[id][hPosZZ] = 1013.507;}
- else if(hInfo[id][hInterior] == 2){//CJ's 3
- hInfo[id][hIntID] = 3;
- hInfo[id][hPosXX] = 2495.7905;
- hInfo[id][hPosYY] = -1694.3346;
- hInfo[id][hPosZZ] = 1014.7422;}
- else if(hInfo[id][hInterior] == 3){//wuzimu 1
- hInfo[id][hIntID] = 1;
- hInfo[id][hPosXX] = -2167.8662;
- hInfo[id][hPosYY] = 642.4196;
- hInfo[id][hPosZZ] = 1057.5938;}
- else if(hInfo[id][hInterior] == 4){//safehouse group 1
- hInfo[id][hIntID] = 1;
- hInfo[id][hPosXX] = 2233.6919;
- hInfo[id][hPosYY] = -1112.8107;
- hInfo[id][hPosZZ] = 1050.8828;}
- else if(hInfo[id][hInterior] == 5){//safehouse group 3
- hInfo[id][hIntID] = 3;
- hInfo[id][hPosXX] = 2319.1255;
- hInfo[id][hPosYY] = -1023.9523;
- hInfo[id][hPosZZ] = 1050.2109;}
- else if(hInfo[id][hInterior] == 6){//safehouse group 4
- hInfo[id][hIntID] = 4;
- hInfo[id][hPosXX] = 2259.4136;
- hInfo[id][hPosYY] = -1136.4128;
- hInfo[id][hPosZZ] = 1050.6403;}
- else if(hInfo[id][hInterior] == 7){// budget inn motel room 12
- hInfo[id][hIntID] = 12;
- hInfo[id][hPosXX] = 446.3247;
- hInfo[id][hPosYY] = 509.9662;
- hInfo[id][hPosZZ] = 1001.4195;}
- else if(hInfo[id][hInterior] == 8){// pair of uburlgar houses 2
- hInfo[id][hIntID] = 2;
- hInfo[id][hPosXX] = 447.1108;
- hInfo[id][hPosYY] = 1399.5410;
- hInfo[id][hPosZZ] = 1084.3047;}
- else if(hInfo[id][hInterior] == 9){// burlglary house x11 5
- hInfo[id][hIntID] = 5;
- hInfo[id][hPosXX] = 229.1724;
- hInfo[id][hPosYY] = 1114.5135;
- hInfo[id][hPosZZ] = 1080.9922;}
- else if(hInfo[id][hInterior] == 10){// burlglary house x12 4
- hInfo[id][hIntID] = 4;
- hInfo[id][hPosXX] = 261.5108;
- hInfo[id][hPosYY] = 1286.0137;
- hInfo[id][hPosZZ] = 1080.2578;}
- else if(hInfo[id][hInterior] == 11){// burlglary house x14 10
- hInfo[id][hIntID] = 10;
- hInfo[id][hPosXX] = 24.3769;
- hInfo[id][hPosYY] = 1341.1829;
- hInfo[id][hPosZZ] = 1084.3750;}
- else if(hInfo[id][hInterior] == 12){// burlglary house x13 4
- hInfo[id][hIntID] = 4;
- hInfo[id][hPosXX] = 221.6766;
- hInfo[id][hPosYY] = 1142.4962;
- hInfo[id][hPosZZ] = 1082.6094;}
- else if(hInfo[id][hInterior] == 13){// villona 12
- hInfo[id][hIntID] = 12;
- hInfo[id][hPosXX] = 2324.2932;
- hInfo[id][hPosYY] = -1148.6160;
- hInfo[id][hPosZZ] = 1050.7101;}
- else if(hInfo[id][hInterior] == 14){// bulgrrg house x15 4
- hInfo[id][hIntID] = 4;
- hInfo[id][hPosXX] = -262.0143;
- hInfo[id][hPosYY] = 1456.4313;
- hInfo[id][hPosZZ] = 1084.3672;}
- else if(hInfo[id][hInterior] == 15){// bulgrrg house x16 5
- hInfo[id][hIntID] = 5;
- hInfo[id][hPosXX] = 22.6792;
- hInfo[id][hPosYY] = 1405.1183;
- hInfo[id][hPosZZ] = 1084.4297;}
- else if(hInfo[id][hInterior] == 16){// bulgrrg house x17 enorme da mappare 5
- hInfo[id][hIntID] = 5;
- hInfo[id][hPosXX] = 140.4665;
- hInfo[id][hPosYY] = 1368.1595;
- hInfo[id][hPosZZ] = 1083.8625;}
- else if(hInfo[id][hInterior] == 17){// bulgrrg house x18 6
- hInfo[id][hIntID] = 6;
- hInfo[id][hPosXX] = 234.2826;
- hInfo[id][hPosYY] = 1065.2290;
- hInfo[id][hPosZZ] = 1084.2101;}
- else if(hInfo[id][hInterior] == 18){// bulgrrg house x19 6
- hInfo[id][hIntID] = 6;
- hInfo[id][hPosXX] = -68.2355;
- hInfo[id][hPosYY] = 1353.9028;
- hInfo[id][hPosZZ] = 1080.2109;}
- else if(hInfo[id][hInterior] == 19){// bulgrrg house x20 15
- hInfo[id][hIntID] = 15;
- hInfo[id][hPosXX] = -285.4269;
- hInfo[id][hPosYY] = 1470.9344;
- hInfo[id][hPosZZ] = 1084.3750;}
- else if(hInfo[id][hInterior] == 20){// caligula's roof 1
- hInfo[id][hIntID] = 1;
- hInfo[id][hPosXX] = 2215.4458;
- hInfo[id][hPosYY] = -1076.7493;
- hInfo[id][hPosZZ] = 1050.4844;}
- else if(hInfo[id][hInterior] == 21){// old venturas strip casino 2
- hInfo[id][hIntID] = 2;
- hInfo[id][hPosXX] = 2236.8916;
- hInfo[id][hPosYY] = -1078.7402;
- hInfo[id][hPosZZ] = 1049.0234;}
- else if(hInfo[id][hInterior] == 22){// verdant bluffs safehouse 8
- hInfo[id][hIntID] = 8;
- hInfo[id][hPosXX] = 2365.1089;
- hInfo[id][hPosYY] = -1133.0795;
- hInfo[id][hPosZZ] = 1050.8750;}
- else if(hInfo[id][hInterior] == 23){// burgr x21 8
- hInfo[id][hIntID] = 8;
- hInfo[id][hPosXX] = -42.7078;
- hInfo[id][hPosYY] = 1406.8553;
- hInfo[id][hPosZZ] = 1084.4297;}
- else if(hInfo[id][hInterior] == 24){// burgr x22 9
- hInfo[id][hIntID] = 9;
- hInfo[id][hPosXX] = 84.9231;
- hInfo[id][hPosYY] = 1324.3130;
- hInfo[id][hPosZZ] = 1083.8594;}
- else if(hInfo[id][hInterior] == 25){// burgr x23 9
- hInfo[id][hIntID] = 9;
- hInfo[id][hPosXX] = 260.5242;
- hInfo[id][hPosYY] = 1238.9857;
- hInfo[id][hPosZZ] = 1084.2578;}
- //===CREA IL FILE DELLA CASA===//
- new file4[403];
- format(file4, sizeof(file4), HPATH, id);
- new INI:File = INI_Open(file4);
- INI_SetTag(File,"data");
- INI_WriteString(File,"Proprietario", hInfo[id][hProprietario]);
- INI_WriteInt(File,"Comprato", hInfo[id][hComprato]);
- INI_WriteInt(File,"Prezzo", hInfo[id][hPrezzo]);
- INI_WriteInt(File,"Interior", hInfo[id][hInterior]);
- INI_WriteInt(File,"VirtualWorld", hInfo[id][hVirtualWorld]);
- INI_WriteInt(File,"IntID", hInfo[id][hIntID]);
- INI_WriteFloat(File,"PosX", hInfo[id][hPosX]);
- INI_WriteFloat(File,"PosY", hInfo[id][hPosY]);
- INI_WriteFloat(File,"PosZ", hInfo[id][hPosZ]);
- INI_WriteFloat(File,"PosA", hInfo[id][hPosA]);
- INI_WriteFloat(File,"PosXX", hInfo[id][hPosXX]);
- INI_WriteFloat(File,"PosYY", hInfo[id][hPosYY]);
- INI_WriteFloat(File,"PosZZ", hInfo[id][hPosZZ]);
- INI_WriteFloat(File,"PosAA", hInfo[id][hPosAA]);
- INI_WriteInt(File,"Cassa", 0);
- INI_Close(File);
- return 1;
- }
- CMD:carica(playerid, params[]){//non ci metto il break.
- new stri[500];
- for(new id = 1; id < sizeof(hInfo); id++){
- format(stri, sizeof(stri), HPATH, id);
- INI_ParseFile(stri, "loadhome_%s", .bExtra = true, .extra = id );
- new strin[250], strinn[250];
- if(hInfo[id][hComprato] == 0){
- format(strin, sizeof(strin), "Casa[ID:%d]\nProprietario: %s\nPrezzo: %d\n Per comprare premi Y",id,hInfo[id][hProprietario],hInfo[id][hPrezzo]);
- hInfo[id][hIcon] = CreateDynamicPickup(1273, 1, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ],0);
- hlabel[id] = CreateDynamic3DTextLabel(strin, GIALLO, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ], 3.0, INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0);
- }else if(hInfo[id][hComprato] == 1){
- hInfo[id][hIcon] = CreateDynamicPickup(1272, 1, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ]);
- format(strinn, sizeof(strinn), "Casa[ID:%d]\nProprietario: %s\nPrezzo: %d\n Premi Y per interagire",id,hInfo[id][hProprietario],hInfo[id][hPrezzo]);
- hlabel[id] = CreateDynamic3DTextLabel(strinn, GIALLO, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ], 3.0, INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0);}}
- return 1;
- }
- CMD:messaggio(playerid, params[]){
- for(new mex = 1; mex < 10; mex++){
- SCM(playerid, GIALLO, "<10");
- if(mex == 10){
- SCM(playerid, GIALLO, "10");}
- }
- return 1;
- }
- CMD:soldi(playerid,params[]){
- Soldi[playerid] = Soldi[playerid]+5000;
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_GESTIONE_CASA)
- {
- if(!response) {}
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASSAFORTE, DIALOG_STYLE_LIST, "Gestione Cassaforte", "Bilancio\n Deposita\n Preleva", "Ok", "Indietro");
- }
- case 1:
- {
- new id = IsPlayerNearHomeEnt(playerid), str[500], string[200], string1[200];
- Soldi[playerid] = Soldi[playerid]+hInfo[id][hPrezzo]/2;
- DestroyDynamicPickup(hInfo[id][hIcon]);
- hInfo[id][hIcon] = CreateDynamicPickup(1273, 1, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ],0);
- format(string, sizeof(string), "Nessuno");
- strmid(hInfo[id][hProprietario], string, 0, strlen(string), 255);
- format(string1, sizeof(string1), "Casa[ID:%d]\nProprietario: %s\nPrezzo: %d\n Per comprare premi Y",id,hInfo[id][hProprietario],hInfo[id][hPrezzo]);
- DestroyDynamic3DTextLabel(hlabel[id]);
- hlabel[id] = CreateDynamic3DTextLabel(string1, GIALLO, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ], 3.0, INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0);
- hInfo[id][hComprato] = 0;
- SCM(playerid, GIALLO, "Hai venduto la tua casa ricavandone il 50% dal prezzo originale.");
- SaveHome(id);
- INI_ParseFile(str, "loadcon_%s", .bExtra = true, .extra = id );
- }
- }
- }
- }
- if(dialogid == DIALOG_GESTIONE_CASSAFORTE)
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASA, DIALOG_STYLE_LIST, "Gestione","Cassaforte\n Vendi","Ok","Esci");
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- new string[200], id = IsPlayerNearHomeEnt(playerid);
- format(string, sizeof(string), "Bilancio Cassaforte (%d $)", hInfo[id][hCassa]);
- SCM(playerid, GIALLO, string);
- ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASSAFORTE, DIALOG_STYLE_LIST, "Gestione Cassaforte","Bilancio\n Deposita\n Preleva","Ok","Esci");
- }
- case 1:
- {
- ShowPlayerDialog(playerid, DIALOG_GESTIONE_DEPOSITA, DIALOG_STYLE_INPUT, "Gestione Cassaforte","Inserisci l'ammonto che vuoi depositare:","Deposita","Esci");
- }
- case 2:
- {
- ShowPlayerDialog(playerid, DIALOG_GESTIONE_PRELEVA, DIALOG_STYLE_INPUT, "Gestione Cassaforte","Inserisci l'ammonto che vuoi prelevare:","Preleva","Esci");
- }
- }
- }
- }
- if(dialogid == DIALOG_GESTIONE_DEPOSITA)
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASSAFORTE, DIALOG_STYLE_LIST, "Gestione Cassaforte","Bilancio\n Deposita\n Preleva","Ok","Esci");
- if(response)
- {
- new soldi, string[200], id = IsPlayerNearHomeEnt(playerid);
- if(sscanf(inputtext, "d", soldi)) return ShowPlayerDialog(playerid, DIALOG_GESTIONE_DEPOSITA, DIALOG_STYLE_INPUT, "Gestione Cassaforte","{FF0000}Inserisci un ammonto valido da depositare!","Deposita","Indietro");
- if(soldi > GetPlayerMoney(playerid)) return ShowPlayerDialog(playerid, DIALOG_GESTIONE_DEPOSITA, DIALOG_STYLE_INPUT, "Gestione Cassaforte","{FF0000}Non possiedi tutti questi soldi!","Deposita","Indietro");
- hInfo[id][hCassa]= soldi + hInfo[id][hCassa];
- //COMANDO PER TOGLIERE SOLDI
- format(string, sizeof(string), "Hai depositato %d $ nella tua Cassaforte!\n Il nuovo Bilancio è di %d $", soldi, hInfo[id][hCassa]);
- SCM(playerid, GIALLO, string);
- ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASA, DIALOG_STYLE_LIST, "Gestione","Cassaforte\n Vendi","Ok","Esci");
- }
- }
- if(dialogid == DIALOG_GESTIONE_PRELEVA)
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASSAFORTE, DIALOG_STYLE_LIST, "Gestione Cassaforte","Bilancio\n Deposita\n Preleva","Ok","Indietro");
- if(response)
- {
- new soldi, string[200], id = IsPlayerNearHomeEnt(playerid);
- if(sscanf(inputtext, "d", soldi)) return ShowPlayerDialog(playerid, DIALOG_GESTIONE_PRELEVA, DIALOG_STYLE_INPUT, "Gestione Cassaforte","{FF0000}Inserisci un ammonto valido da prelevare!","Preleva","Indietro");
- if(soldi > hInfo[id][hCassa]) return ShowPlayerDialog(playerid, DIALOG_GESTIONE_PRELEVA, DIALOG_STYLE_INPUT, "Gestione Cassaforte","{FF0000}Non possiedi tutti questi soldi in Cassaforte!","Preleva","Indietro");
- hInfo[id][hCassa]= soldi - hInfo[id][hCassa];
- //COMANDO PER DARE SOLDI
- format(string, sizeof(string), "Hai prelevato %d $ dalla tua Cassaforte!\n Il nuovo Bilancio è di %d $", soldi, hInfo[id][hCassa]);
- SCM(playerid, GIALLO, string);
- ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASA, DIALOG_STYLE_LIST, "Gestione","Cassaforte\n Vendi","Ok","Esci");
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- //COMPRA/GESTISCI
- if(newkeys & KEY_YES && IsPlayerNearHomeEnt(playerid)){
- new string2[350], str[500], id = IsPlayerNearHomeEnt(playerid);
- if(id == -1 || id == 0) return SCM(playerid, ROSSO, "Non sei vicino alla casa!");
- if(hInfo[id][hComprato] == 0){
- if(Soldi[playerid] < hInfo[id][hPrezzo]) return SCM(playerid, ROSSO, "Non hai soldi a sufficienza!");
- Soldi[playerid] = Soldi[playerid]-hInfo[id][hPrezzo];
- format(str, sizeof(str), HPATH, id);
- DestroyDynamicPickup(hInfo[id][hIcon]);
- DestroyDynamic3DTextLabel(hlabel[id]);
- hInfo[id][hProprietario] = GetName(playerid);
- hInfo[id][hIcon] = CreateDynamicPickup(1272, 1, hInfo[id][hPosX],hInfo[id][hPosY],hInfo[id][hPosZ]);
- format(string2, sizeof(string2), "Casa[ID:%d]\nProprietario: %s\nPrezzo: %d\n Premi Y per interagire",id,hInfo[id][hProprietario],hInfo[id][hPrezzo]);
- hlabel[id] = CreateDynamic3DTextLabel(string2, GIALLO, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ], 3.0, INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0);
- hInfo[id][hComprato] = 1;
- SaveHome(id);
- INI_ParseFile(str, "loadhome_%s", .bExtra = true, .extra = id );
- }else if(hInfo[id][hComprato] == 1){
- if(strcmp(hInfo[id][hProprietario], GetName(playerid))){ SCM(playerid, ROSSO, "Non sei il proprietario della casa!");}
- else { ShowPlayerDialog(playerid, DIALOG_GESTIONE_CASA, DIALOG_STYLE_LIST, "Gestione","Cassaforte\n Vendi","Ok","Esci");}
- }}
- if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[id][hPosX],hInfo[id][hPosY],hInfo[id][hPosZ])){//ENTRA
- for(new id = 1; id < sizeof(hInfo); id++){
- SetPlayerVirtualWorld(playerid, hInfo[id][hVirtualWorld]);
- SetPlayerInterior(playerid, hInfo[id][hIntID]);
- SetPlayerPos(playerid, hInfo[id][hPosXX], hInfo[id][hPosYY], hInfo[id][hPosZZ]);}}
- if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerNearHomeExt(playerid)){//ESCI
- new id = IsPlayerNearHomeExt(playerid);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, hInfo[id][hPosX], hInfo[id][hPosY], hInfo[id][hPosZ]);}
- return 1;
- }
- forward SaveHome(id);
- public SaveHome(id)
- {
- new file4[403];
- format(file4, sizeof(file4), HPATH, id);
- new INI:File = INI_Open(file4);
- INI_SetTag(File,"data");
- INI_WriteString(File,"Proprietario", hInfo[id][hProprietario]);
- INI_WriteInt(File,"Comprato", hInfo[id][hComprato]);
- INI_WriteInt(File,"Prezzo", hInfo[id][hPrezzo]);
- INI_WriteInt(File,"Interior", hInfo[id][hInterior]);
- INI_WriteInt(File,"VirtualWorld", hInfo[id][hVirtualWorld]);
- INI_WriteInt(File,"IntID", hInfo[id][hIntID]);
- INI_WriteFloat(File,"PosX", hInfo[id][hPosX]);
- INI_WriteFloat(File,"PosY", hInfo[id][hPosY]);
- INI_WriteFloat(File,"PosZ", hInfo[id][hPosZ]);
- INI_WriteFloat(File,"PosA", hInfo[id][hPosA]);
- INI_WriteFloat(File,"PosXX", hInfo[id][hPosXX]);
- INI_WriteFloat(File,"PosYY", hInfo[id][hPosYY]);
- INI_WriteFloat(File,"PosZZ", hInfo[id][hPosZZ]);
- INI_WriteFloat(File,"PosAA", hInfo[id][hPosAA]);
- INI_WriteInt(File,"Cassa", 0);
- INI_Close(File);
- return 1;
- }
- forward loadhome_data(id, name[], value[]);
- public loadhome_data(id, name[], value[])
- {
- INI_String("Proprietario", hInfo[id][hProprietario], 24);
- INI_Int("Comprato", hInfo[id][hComprato]);
- INI_Int("Prezzo", hInfo[id][hPrezzo]);
- INI_Int("Interior", hInfo[id][hInterior]);
- INI_Int("VirtualWorld", hInfo[id][hVirtualWorld]);
- INI_Int("IntID", hInfo[id][hIntID]);
- INI_Float("PosX", hInfo[id][hPosX]);
- INI_Float("PosY", hInfo[id][hPosY]);
- INI_Float("PosZ", hInfo[id][hPosZ]);
- INI_Float("PosA", hInfo[id][hPosA]);
- INI_Float("PosXX", hInfo[id][hPosXX]);
- INI_Float("PosYY", hInfo[id][hPosYY]);
- INI_Float("PosZZ", hInfo[id][hPosZZ]);
- INI_Float("PosAA", hInfo[id][hPosAA]);
- INI_Int("Cassa", hInfo[id][hCassa]);
- return 1;
- }
- IsPlayerNearHomeExt(playerid)
- {
- for(new w = 1; w < 500; w++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[w][hPosXX],hInfo[w][hPosYY],hInfo[w][hPosZZ])) return w;
- }
- return -1;
- }
- IsPlayerNearHomeEnt(playerid)
- {
- for(new b = 1; b < 500; b++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[b][hPosX],hInfo[b][hPosY],hInfo[b][hPosZ])) return b;
- }
- return -1;
- }
- stock GetName(playerid)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- return pName;
- }
- stock RemoveUnderScore(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- for(new i = 0; i < MAX_PLAYER_NAME; i++)
- {
- if(name[i] == '_') name[i] = ' ';
- }
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement