24.11.2012, 15:40
Код:
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; }