stock LoadProperties() { if(fexist("PropertySystem/PropertyInfo.txt")) { CountProperties(); new Argument[9][70]; new entry[256], BoughtProps; new File: propfile = fopen("PropertySystem/PropertyInfo.txt", io_read); if (propfile) { for(new id; id<PropertiesAmount; id++) { fread(propfile, entry); split(entry, Argument, ','); format(PropInfo[id][PropName], 64, "%s", Argument[0]); PropInfo[id][PropX] = floatstr(Argument[1]); PropInfo[id][PropY] = floatstr(Argument[2]); PropInfo[id][PropZ] = floatstr(Argument[3]); PropInfo[id][PropValue] = strval(Argument[4]); PropInfo[id][PropEarning] = strval(Argument[5]); format(PropInfo[id][PropOwner], MAX_PLAYER_NAME, "%s", Argument[6]); PropInfo[id][PropIsBought] = strval(Argument[7]); PropInfo[id][PropUnbuyableTime] = strval(Argument[8]); PropInfo[id][PickupNr] = CreatePickup(1273, 1, PropInfo[id][PropX], PropInfo[id][PropY], PropInfo[id][PropZ]); if(PropInfo[id][PropIsBought] == 1) { BoughtProps++; } } fclose(propfile); printf("==================================="); printf("|| %d Propiedades A La Venta||", PropertiesAmount); printf("|| %d propiedades compradas||", BoughtProps); printf("==================================="); } } } stock SaveProperties() { new entry[256]; new File: propfile = fopen("PropertySystem/PropertyInfo.txt", io_write); for(new id; id<PropertiesAmount; id++) { format(entry, 128, "%s,%.2f,%.2f,%.2f,%d,%d,%s,%d,%d \r\n",PropInfo[id][PropName], PropInfo[id][PropX], PropInfo[id][PropY], PropInfo[id][PropZ], PropInfo[id][PropValue], PropInfo[id][PropEarning], PropInfo[id][PropOwner], PropInfo[id][PropIsBought], PropInfo[id][PropUnbuyableTime]); fwrite(propfile, entry); } printf("Saved %d Properties!", PropertiesAmount); fclose(propfile); } forward split(const strsrc[], strdest[][], delimiter); public split(const strsrc[], strdest[][], delimiter) { new i, li; new aNum; new len; while(i <= strlen(strsrc)){ if(strsrc[i]==delimiter || i==strlen(strsrc)){ len = strmid(strdest[aNum], strsrc, li, i, 128); strdest[aNum][len] = 0; li = i+1; aNum++; } i++; } return 1; }
El problema es que al comprar una propiedad le quita dinero a todos, y cuando se lo da en casa 5 minutos, les da a todos,osea que al comprar una casa se compra para todos los jugadores no lo eh podido areglar їAlguna soluciуn?..
|
if(strcmp(cmd, "/comprar", true)==0 || strcmp(cmd, "/buyprop", true)==0) { new strbnm[128]; #if ENABLE_LOGIN_SYSTEM == 1 if(PlayerInfo[playerid][LoggedIn] == 0) { format(strbnm, 128, "~r~~h~~h~no estas logueado %s.", LOGIN_COMMAND); GameTextForPlayer(playerid, strbnm,3000,3); return 1; } #endif new propid = IsPlayerNearProperty(playerid); if(propid == -1) { GameTextForPlayer(playerid,"~r~~h~~h~no estas en el icono para comprarla",3000,3); return 1; } if(PlayerProps[playerid] == MAX_PROPERTIES_PER_PLAYER) { GameTextForPlayer(playerid,"~r~~h~~h~llegaste al maximo de propiedades por jugador",3000,3); return 1; } if(PropInfo[propid][PropIsBought] == 1) { new ownerid = GetPlayerID(PropInfo[propid][PropOwner]); if(ownerid != playerid) { GameTextForPlayer(playerid,"~r~~h~~h~Esta propiedad ya esta vendida!",3000,3); return 1; } } if(PropInfo[propid][PropIsBought] == 1) { new ownerid = GetPlayerID(PropInfo[propid][PropOwner]); if(ownerid == playerid) { GameTextForPlayer(playerid,"~r~~h~~h~esta propiedad ya es tuya",3000,3); return 1; } else { if(PropInfo[propid][PropUnbuyableTime] > 0) { GameTextForPlayer(playerid,"~r~~h~~h~espera unos minutos para comprar esta propiedada",4000,3); return 1; } } } if(GetPlayerMoney(playerid) < PropInfo[propid][PropValue]) { GameTextForPlayer(playerid,"~r~~h~~h~no tienes suficiente dinero",6000,3); return 1; } new pNamebnm[MAX_PLAYER_NAME]; GetPlayerName(playerid, pNamebnm, sizeof(pNamebnm)); if(PropInfo[propid][PropIsBought] && PropInfo[propid][PropUnbuyableTime] == 0) { new ownerid = GetPlayerID(PropInfo[propid][PropOwner]); GivePlayerMoney(ownerid, (PropInfo[propid][PropValue]/2)); GameTextForPlayer(playerid,"~r~~h~~h~compraron tu propiedad, recibiras la mitad~n~~r~~h~~h~de su valor", 4000,3); PlayerProps[ownerid]--; } PropInfo[propid][PropOwner] = pNamebnm; PropInfo[propid][PropIsBought] = 1; PropInfo[propid][PropUnbuyableTime] = UNBUYABLETIME; EarningsForPlayer[playerid] += PropInfo[propid][PropEarning]; GivePlayerMoney(playerid, (0-PropInfo[propid][PropValue])); format(strbnm, 128, "Compraste la propiedad \"%s\" Por [ $%d ]", PropInfo[propid][PropName], PropInfo[propid][PropValue]); SendClientMessage(playerid, 0xFFFF00AA, strbnm); new ptName[MAX_PLAYER_NAME]; GetPlayerName(playerid, ptName, MAX_PLAYER_NAME); format(str, 128, "{FFFF00}* %s ha comprado la propiedad \"%s\".", ptName, PropInfo[propid][PropName]); SendClientMessageToAll(0x00FFFFAA, str); PlayerProps[playerid]++; return 1; }