en dit is het script ik ben er niet zo goed in dus miss kan iemand er mee helpen.
//required includes
#include <a_samp> //everything needs it
#include <dini> //dini
#include <dudb> //dudb
//requiered defines
#define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1
//required functions
//properties files are called by their propid, so less memory used as we dont need to udb_encode() it
stock propfile(prop)
{
new string[256];
format(string, sizeof(string), "%d.prop", prop);
return string;
}
//what your players login files are.
//change it, if yours are different
stock playerfile(playerid)
{
new string[256];
format(string, sizeof(string), "%s.sav", udb_encode(Playername(playerid)));
return string;
}
stock GetDistanceBetweenTwoPoints(Float:x,Float:y, Float:x1,Float:y1)
{
new Float:tmpdis;
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(
y,y1)),2));
return floatround(tmpdis);
}
//less params then SendClientMessage()
stock SendPlayerText(playerid, const text[])
{
return SendClientMessage(playerid, 0x35FFC2AA, text);
}
//required to get the owner of the property that has been bought.
stock GetPlayerid(name[])
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(strcmp(Playername(i), name, true) == 0)
{
return i;
}
}
}
return INVALID_PLAYER_ID;
}
/*
NOTE:
Not all these functions are by me. If you want to find the original authors,
look in the useful functions thread or around sa-mp forum.
*/
//required forwards
forward ConstFunctions();
//required stats
enum PLAYER_PARAMS
{
proparea,
bool:Logged
}
new PlayerParameters[MAX_PLAYERS][PLAYER_PARAMS];
//------------------------------------------------------------------------------
//checkpoint stuff
#define MAX_PROPS 1000 //if you have 1000+ properties, just change it
new PropInfo[MAX_PROPS];
new InfoPoint[MAX_PROPS][256];
//------------------------------------------------------------------------------
//add property
//adds a property (each property creates its own file, so dont change the propid after youve started the mode once.
stock AddProperty(playerid, Float:x, Float:y, Float:z, name[], price, bool:forsale, propid, size)
{
if(!fexist(propfile(propid)))
{
dini_Create(propfile(propid));
dini_Set(propfile(propid), "name", name);
dini_IntSet(propfile(propid), "price", price);
dini_FloatSet(propfile(propid), "x", x);
dini_FloatSet(propfile(propid), "y", y);
dini_FloatSet(propfile(propid), "z", z);
if(forsale)
{
dini_IntSet(propfile(propid), "forsale", 1);
} else {
dini_IntSet(propfile(propid), "forsale", 0);
}
}
new Float:xp, Float:yp, Float:zp;
GetPlayerPos(playerid, xp, yp, zp);
if(GetDistanceBetweenTwoPoints(x,y, xp,yp) < 40)
{
if(PlayerParameters[playerid][proparea]!=propid)
{
SetPlayerCheckpoint(playerid, x, y, z, size);
PlayerParameters[playerid][proparea]=propid;
}
} else if(PlayerParameters[playerid][proparea]==propid)
{
PlayerParameters[playerid][proparea]=0;
DisablePlayerCheckpoint(playerid);
}
PropInfo[propid]=1;
return 1;
}
//------------------------------------------------------------------------------
//add info point
//adds a checkpoint which, when walked into, tells the player information
stock AddInfoPoint(playerid, Float:x, Float:y, Float:z, line[], infoid, size)
{
new Float:xp, Float:yp, Float:zp;
GetPlayerPos(playerid, xp, yp, zp);
if(GetDistanceBetweenTwoPoints(x,y, xp,yp) < 40)
{
if(PlayerParameters[playerid][proparea]!=infoid)
{
SetPlayerCheckpoint(playerid, x, y, z, size);
PlayerParameters[playerid][proparea]=infoid;
}
} else if(PlayerParameters[playerid][proparea]==infoid)
{
PlayerParameters[playerid][proparea]=0;
DisablePlayerCheckpoint(playerid);
}
PropInfo[infoid]=2;
set(InfoPoint[infoid], line);
return 1;
}
//------------------------------------------------------------------------------
//this is where to add properties or info points
stock PropertyCheckpointUpdate(playerid)
{
AddProperty(playerid,2024.6274,1007.8792,10.8203, "Four Dragons Casino", 20000000, true, 1, 5/2);
AddProperty(playerid,1680.5830,1447.9042,10.7735, "The Airport", 50000000, false, 2, 5/2);
AddProperty(playerid,1607.0425,1819.7314,10.8280, "Hospital", 150000, false, 3, 5/2);
//Bank
AddInfoPoint(playerid,2418.9380,1123.6112,10.8203, "BANK: You can safely store your money in the bank", 4, 5/2);
return 1;
}
//------------------------------------------------------------------------------
//what happens when someone enters the checkpoint.
public OnPlayerEnterCheckpoint(playerid)
{
new string[256], propid;
propid=PlayerParameters[playerid][proparea];
if(PropInfo[propid]==1)
{
format(string, sizeof(string), "-- %s --", dini_Get(propfile(propid), "name"));
SendPlayerText(playerid, string);
format(string, sizeof(string), "Price: %d", dini_Int(propfile(propid), "price"));
SendPlayerText(playerid, string);
if(dini_Int(propfile(propid), "forsale") == 1) SendPlayerText(playerid, "Forsale: Yes");
if(dini_Int(propfile(propid), "forsale") == 0) SendPlayerText(playerid, "Forsale: No");
if(dini_Isset(propfile(propid), "owner"))
{
format(string, sizeof(string), "Owner: %s", dini_Get(propfile(propid), "owner"));
SendPlayerText(playerid, string);
}
} else if(PropInfo[propid]==2)
{
SendPlayerText(playerid, InfoPoint[propid]);
}
return 1;
}
//------------------------------------------------------------------------------
//Playername (not created by me, but required)
stock Playername(playerid) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
//------------------------------------------------------------------------------
//converts integer into string (easier to type then valstr())
stock str(value)
{
new string[256];
format(string, sizeof(string), "%d", value);
return string;
}
//------------------------------------------------------------------------------
//one function, created so you can run constant functions off one timer
public ConstFunctions()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
PropertyCheckpointUpdate(i);
}
}
return 1;
}
//------------------------------------------------------------------------------
public OnGameModeInit()
{
SetTimer("ConstFunctions", 400, 1); //loops the function (you may want to make it higher if you have alot of properties in your server)
//other stuff
return 1;
}
//------------------------------------------------------------------------------
//put the property up for sale
dcmd_sell(playerid, params[])
{
#pragma unused params
if(!PlayerParameters[playerid][Logged]) return SendPlayerText(playerid, "ERROR: You must be logged in");
new propid = PlayerParameters[playerid][proparea];
if(!IsPlayerInCheckpoint(playerid) || PropInfo[propid]!=1) return SendPlayerText(playerid, "ERROR: You must be in a property checkpoint");
if(!dini_Isset(propfile(propid), "owner")) return SendPlayerText(playerid, "ERROR: You don't own this property");
if(strcmp(dini_Get(propfile(propid), "owner"), Playername(playerid), true) == 0)
{
// if(!strlen(params)) return SendPlayerText(playerid, "USAGE: /sell [price]");
if(dini_Int(propfile(propid), "forsale") == 1) return SendPlayerText(playerid, "ERROR: Property is already for sale");
dini_IntSet(propfile(propid), "forsale", 1);
SendPlayerText(playerid, "PROPERTY: Set for sale");
} else {
SendPlayerText(playerid, "ERROR: You don't own this property");
}
return 1;
}
//change the price of the property (if you own it)
dcmd_value(playerid, params[])
{
if(!PlayerParameters[playerid][Logged]) return SendPlayerText(playerid, "ERROR: You must be logged in");
new propid = PlayerParameters[playerid][proparea];
if(!IsPlayerInCheckpoint(playerid) || PropInfo[propid]!=1) return SendPlayerText(playerid, "ERROR: You must be in a property checkpoint");
if(!dini_Isset(propfile(propid), "owner")) return SendPlayerText(playerid, "ERROR: You don't own this property");
if(strcmp(dini_Get(propfile(propid), "owner"), Playername(playerid), true) == 0)
{
if(!strlen(params)) return SendPlayerText(playerid, "USAGE: /value [price]");
new string[256];
format(string, sizeof(string), "PROPERTY: Set value to $%d", strval(params));
SendPlayerText(playerid, string);
dini_IntSet(propfile(propid), "price", strval(params));
} else {
SendPlayerText(playerid, "ERROR: You don't own this property");
}
return 1;
}
//buy a property
dcmd_buy(playerid, params[])
{
#pragma unused params
if(!PlayerParameters[playerid][Logged]) return SendPlayerText(playerid, "ERROR: You must be logged in");
new propid = PlayerParameters[playerid][proparea];
if(!IsPlayerInCheckpoint(playerid) || PropInfo[propid]!=1) return SendPlayerText(playerid, "ERROR: You must be in a property checkpoint");
if(strcmp(dini_Get(propfile(propid), "name"), Playername(playerid), true) == 0) return SendPlayerText(playerid, "ERROR: You already own this property");
if(dini_Int(propfile(propid), "forsale") == 0) return SendPlayerText(playerid, "ERROR: Property is not for sale");
new price;
price=dini_Int(propfile(propid), "price");
if(price > GetPlayerMoney(playerid)) return SendPlayerText(playerid, "ERROR: Not enough money");
new string[256];
if(dini_Isset(propfile(propid), "owner"))
{
format(string, sizeof(string), "PROPERTY: You have bought %s off %s", dini_Get(propfile(propid), "name"), dini_Get(propfile(propid), "owner"));
SendPlayerText(playerid, string);
new sellerid = GetPlayerid(dini_Get(propfile(propid), "owner"));
if(IsPlayerConnected(sellerid))
{
GivePlayerMoney(sellerid, price);
format(string, sizeof(string), "PROPERTY: Your property \"%s\" has been bought buy %s", dini_Get(propfile(propid), "name"), Playername(playerid));
SendPlayerText(sellerid, string);
} else {
dini_IntSet(udb_encode(dini_Get(propfile(propid), "owner")), "money", price + dini_Int(udb_encode(dini_Get(propfile(propid), "owner")), "money"));
}
} else {
format(string, sizeof(string), "PROPERTY: You have bought %s", dini_Get(propfile(propid), "name"));
SendPlayerText(playerid, string);
}
dini_IntSet(propfile(propid), "forsale", 0);
GivePlayerMoney(playerid, price * -1);
dini_Set(propfile(propid), "owner", Playername(playerid));
return 1;
}
//pulls the property off the market
dcmd_unsell(playerid, params[])
{
#pragma unused params
if(!PlayerParameters[playerid][Logged]) return SendPlayerText(playerid, "ERROR: You must be logged in");
new propid = PlayerParameters[playerid][proparea];
if(!IsPlayerInCheckpoint(playerid) || PropInfo[propid]!=1) return SendPlayerText(playerid, "ERROR: You must be in a property checkpoint");
if(!dini_Isset(propfile(propid), "owner")) return SendPlayerText(playerid, "ERROR: You don't own this property");
if(strcmp(dini_Get(propfile(propid), "owner"), Playername(playerid), true) == 0)
{
if(dini_Int(propfile(propid), "forsale") == 0) return SendPlayerText(playerid, "ERROR: Property is already not for sale");
dini_IntSet(propfile(propid), "forsale", 0);
SendPlayerText(playerid, "PROPERTY: Set to not for sale");
} else {
SendPlayerText(playerid, "ERROR: You don't own this property");
}
return 1;
}
//------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[], text[])
{
dcmd(sell,4,cmdtext);
dcmd(buy,3,cmdtext);
dcmd(unsell,6,cmdtext);
dcmd(value,5,cmdtext);
return 0;
}
ik heb hier een script en volgens mij een best goede voor huizen en property's
alleen een paar foutjes
dit zijn ze:
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(55) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(106) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(111) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(123) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(149) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(168) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(189) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(230) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(250) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(251) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(253) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(259) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(260) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(271) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(272) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(274) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(279) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(295) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(296) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(298) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(300) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(337) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(338) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(340) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(345) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(346) : warning 217: loose indentation
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(354) : error 025: function heading differs from prototype
C:\Documents and Settings\Guido\Bureaublad\gta server\filterscripts\property.pwn(360) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
en dit is het script ik ben er niet zo goed in dus miss kan iemand er mee helpen.