rendered paste body//RoNaLD wAz ere anD grafeeteed on tomozj's pasteBin 20/3/07
// lol ron :D
//Grove:
#include <a_samp>
#include <core>
#include <float>
#include dini
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
//Colour Defines 2
#define GREY 0x808080AA
#define GREEN 0x20B2AAAA
#define YELLOW 0xFFFF00AA //0xFFFFE0AA
#define ORANGE 0xDA70D6AA
#define WHITE 0xFFFFFFAA
#define RED 0xFF0000AA //0xAA3333AA
#define DARKRED 0x660000AA
#define PINK 0xFF66FFAA
#define BLUE 0x0000BBAA
#define LIGHTBLUE 0x33CCFFAA
#define PocketMoney 100000 // Amount player recieves on spawn.
#define INACTIVE_PLAYER_ID 255
#define GIVECASH_DELAY 5000 // Time in ms between /givecash commands.
#define NUMVALUES 4
forward MoneyGrubScoreUpdate();
forward Givecashdelaytimer(playerid);
//forward GrubModeReset();
forward SetPlayerRandomSpawn(playerid);
forward SetupPlayerForClassSelection(playerid);
forward GameModeExitFunc();
forward OnPlayerPrivmsg(playerid, senderid, text[]);
//------------------------
//--Weapon Defines by-----
//-------tomozj-----------
//------------------------
//#define Unarmed 0
//#define BrassKnuckle 1
#define GolfClub 2
#define NightStick 3
#define Knife 4
#define BaseballBat 5
#define Shovel 6
#define PoolCue 7
#define Katana 8
#define Chainsaw 9
#define DoubleEndedDildo 10
#define BigWhiteVibrator 11
#define MediumWhiteVibrator 12
#define SmallSilverVibrator 13
#define Flowers 14
#define Cane 15
//#define Grenade 16
//#define Teargas 17
#define Molotov 18
//#define RPG 19
//#define HeatRPG 20
//#define HydraRocket 21
#define Pistol 22
#define SPistol 23
#define DesertEagle 24
#define Shotgun 25
#define SawnoffShotgun 26
#define CombatShotgun 27
#define MicroUzi 28
#define MP5 29
#define AK47 30
#define M4 31
#define Tec9 32
//#define CountryRifle 33
//#define SniperRifle 34
//#define RocketLauncher 35
//#define HSRocketLauncher 36
#define Flamethrower 37
#define Minigun 38
//#define SatchelCharge 39
//#define Detonator 40
#define Spraycan 41
#define FireExtinguisher 42
#define Camera 43
#define Nightvision 44
#define InfraredVision 45
#define Parachute 46
#define FakePistol 47
//#define VehicleDeath 49
//#define DrownedDeath 53
//#define Collision/SplashDeath 54
//------------------------------------------------------------------------------------------------------
new CashScoreOld;
//new iSpawnSet[MAX_PLAYERS];
new gActivePlayers[MAX_PLAYERS];
new gLastGaveCash[MAX_PLAYERS];
//------------------------------------------------------------------------------------------------------
main()
{
print("n----------------------------------");
print(" Running ColdThugZ Trainingn");
print(" Hosted and Coded By");
print(" tomozj");
print("----------------------------------n");
}
//------------------------------------------------------------------------------------------------------
public MoneyGrubScoreUpdate()
{
new CashScore;
new name[MAX_PLAYER_NAME];
//new string[256];
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof(name));
CashScore = GetPlayerMoney(i);
SetPlayerScore(i, CashScore);
if (CashScore > CashScoreOld)
{
CashScoreOld = CashScore;
//format(string, sizeof(string), "$$$ %s is now in the lead $$$", name);
//SendClientMessageToAll(COLOR_YELLOW, string);
}
}
}
}
//------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"~w~SA-MP: ~r~ColdThugZ ~g~Training",5000,5);
SendPlayerFormattedText(playerid, "Welcome to the ColdThugZ Training Server, For help type /help.", 0);
SendPlayerFormattedText(playerid, "Login before spawn, or you will be kicked.", 0);
gActivePlayers[playerid]++;
gLastGaveCash[playerid] = GetTickCount();
return 1;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid)
{
gActivePlayers[playerid]--;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new giveplayerid, moneys, idx;
// new idx;
// new string[256];
new command[256];
command = strtok(cmdtext, idx);
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/help", true) == 0) {
SendPlayerFormattedText(playerid,"ColdThugZ Training Coded and Hosted By tomozj",0);
SendPlayerFormattedText(playerid,"Type: /objective : to find out what to do in this gamemode.",0);
SendPlayerFormattedText(playerid,"Type: /givecash [playerid] [money-amount] to send money to other players.",0);
SendPlayerFormattedText(playerid,"Type: /regiser [password] to register your id on this server.", 0);
SendPlayerFormattedText(playerid,"Type: /tips : to see some tips from the creator of the gamemode.", 0);
return 1;
}
if(strcmp(cmd, "/objective", true) == 0) {
SendPlayerFormattedText(playerid,"Practice hard-to-do stuff, like parachuting and long range crap. You can practice a whole range of stuff.",0);
SendPlayerFormattedText(playerid,"If you'd like a weapon, just ask an admin. I will implement that you can do it yourself, soon :)",0);
return 1;
}
if(strcmp(cmd, "/givecash", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
moneys = strval(tmp);
//printf("givecash_command: %d %d",giveplayerid,moneys);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
}
}
else {
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
// PROCESS OTHER COMMANDS - new
if (strcmp(command, "/tp", true)==0)
{
new endid;
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{ //if there is no params
SendClientMessage(playerid,WHITE,"USAGE: /tp <id>");
}
else { //if there are any params! :)
if(!IsPlayerConnected(endid)) { //Checks if they are connected
SendClientMessage(playerid,GREY,"Enter a valid player id!.");
return 1;
}
else {
endid = strval(tmp);
new end_player[MAX_PLAYER_NAME];
new start_player[MAX_PLAYER_NAME];
new Float:X, Float:Y, Float:Z;
GetPlayerName(endid,end_player,sizeof(end_player));
GetPlayerName(playerid,start_player,sizeof(start_player));
GetPlayerPos(endid,Float:X,Float:Y,Float:Z);
SetPlayerPos(playerid,Float:X+1,Float:Y+1,Float:Z);
format(string,sizeof(string),"You've been teleported to %s!",end_player);
SendClientMessage(playerid, YELLOW, string);
format(string,sizeof(string),"%s has been teleported to you!",start_player);
SendClientMessage(endid,YELLOW,string);
}
}
return 1;
}
if (strcmp(command, "/ctp", true)==0)
{
new tmp[256];
new endid;
tmp = strtok(cmdtext, idx);
endid = strval(tmp);
if(!strlen(tmp))
{ //if there is no params
SendClientMessage(playerid,WHITE,"USAGE: /ctp <id>");
}
else { //if there are any params! :)
if(!IsPlayerConnected(endid)) { //Checks if they are connected
SendClientMessage(playerid,GREY,"Enter a valid player id!.");
return 1;
}
else {
new end_player[MAX_PLAYER_NAME];
new start_player[MAX_PLAYER_NAME];
new Float:X, Float:Y, Float:Z;
GetPlayerName(endid,end_player,sizeof(end_player));
GetPlayerName(playerid,start_player,sizeof(start_player));
GetPlayerPos(endid,Float:X,Float:Y,Float:Z);
SetVehiclePos(playerid,Float:X,Float:Y,Float:Z+3);
format(string,sizeof(string),"You have car teleported to %s!",end_player);
SendClientMessage(playerid, YELLOW, string);
format(string,sizeof(string),"%s has car teleported to you!",start_player);
SendClientMessage(endid,YELLOW,string);
}
}
return 1;
}
if(strcmp(command,"/dive",true)==0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,Float:X,Float:Y,Float:Z);
SetPlayerPos(playerid,Float:X,Float:Y,Float:Z+500);
GameTextForPlayer(playerid,"WOOHOO!!!",5000,3);
GivePlayerWeapon(playerid, 46, 1 );
return 1;
}
if(strcmp(command,"/time",true)==0) {
new hour,minute,second;
gettime(hour, minute, second);
format(string,sizeof(string),"Time: %d:%d:%d",hour,minute,second);
SendClientMessage(playerid, YELLOW,string);
return 1;
}
if(strcmp(command,"/date",true)==0) {
new year,month,day;
getdate(year,month,day);
format(string,sizeof(string),"Date: %d/%d/%d",day,month,year);
SendClientMessage(playerid, YELLOW,string);
return 1;
}
//admincommands via RCON
if(IsPlayerAdmin(playerid) == 1) {
if (strcmp(command, "/fetch", true)==0)
{
new endid;
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{ //if there is no params
SendClientMessage(playerid,WHITE,"USAGE: /fetch <id>");
}
else { //if there are any params! :)
if(!IsPlayerConnected(endid)) { //Checks if they are connected
SendClientMessage(playerid,GREY,"Enter a valid player id!");
return 1;
}
else {
endid = strval(tmp);
new end_player[MAX_PLAYER_NAME];
new start_player[MAX_PLAYER_NAME];
new Float:X, Float:Y, Float:Z;
GetPlayerName(endid,end_player,sizeof(end_player));
GetPlayerName(playerid,start_player,sizeof(start_player));
GetPlayerPos(playerid,Float:X,Float:Y,Float:Z);
SetPlayerPos(endid,Float:X,Float:Y,Float:Z);
format(string,sizeof(string),"You have fetched %s.",end_player);
SendClientMessage(playerid, YELLOW, string);
format(string,sizeof(string),"You've been fetched by an administrator!",start_player);
SendClientMessage(endid,YELLOW,string);
}
}
return 1;
}
}//endofadmin ++++++
return 0;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerSpawn(playerid)
{
GivePlayerMoney(playerid, PocketMoney);
SetPlayerInterior(playerid,0);
//SetPlayerRandomSpawn(playerid);
return 1;
}
/*public SetPlayerRandomSpawn(playerid)
{
new rand = random(sizeof(gRandomPlayerSpawns));
SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
//}
//return 1;
}*/
//------------------------------------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
new playercash;
if(killerid == INVALID_PLAYER_ID) {
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
ResetPlayerMoney(playerid);
} else {
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
playercash = GetPlayerMoney(playerid);
if (playercash > 0) {
GivePlayerMoney(killerid, playercash);
ResetPlayerMoney(playerid);
}
else
{
}
}
return 1;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerRequestClass(playerid, classid)
{
SetupPlayerForClassSelection(playerid);
return 1;
}
public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}
public GameModeExitFunc()
{
GameModeExit();
}
public OnGameModeInit()
{
SetGameModeText("ColdThugZ Practice Server from tomozj");
ShowPlayerMarkers(1);
ShowNameTags(1);
AddPlayerClass(107,1460.5353,2789.9490,10.8203,269.1425,MicroUzi,16000,SawnoffShotgun,15000,M4,15000); //Groves
AddPlayerClass(264,1785.9087,2848.6279,10.6738,42.3208,MicroUzi,16000,SawnoffShotgun,15000,M4,15000); //Clowns
AddPlayerClass(50,2149.753906,-1810.177490,16.140625,269.1425,MicroUzi,16000,SawnoffShotgun,15000,M4,15000); // Spectators
//PROPERTIES
/required includes
#include <a_samp> //everything needs it :D
#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;
}
// Cars!!!!
//Airport
AddStaticVehicle(497,1604.5009,1632.5208,10.6584,165.4447,-1,-1); // heli N
AddStaticVehicle(488,1653.2899,1551.5253,10.6297,28.1039,-1,-1); // Heli S1
AddStaticVehicle(487,1630.6370,1538.0615,10.6363,20.9186,-1,-1); // Heli S2
AddStaticVehicle(513,1275.2164,1322.2445,10.6578,269.8379,-1,-1); // Stuntplane
AddStaticVehicle(548,1334.0558,1612.1644,12.4814,268.3840,1,1); // cargobob
/*//Stuff
AddStaticVehicle(502,1771.6277,1713.6118,8.4002,176.5937,18,1); // Under bridge near airport
AddStaticVehicle(508,1892.3022,1740.1941,10.6505,355.2742,18,1); // Staticcar
AddStaticVehicle(539,2075.0254,1687.5909,10.5100,182.6338,18,1); // Caluigas Static
AddStaticVehicle(528,2040.4146,1550.0151,10.5099,181.2650,18,1); // Pirate ship static
AddStaticVehicle(523,2196.8042,1855.9552,10.6588,183.9444,18,1); // Static carpark
AddStaticVehicle(434,2175.3594,1985.5201,10.6578,354.0914,18,1); // Static car 24-7
AddStaticVehicle(429,2098.4536,2065.6353,10.6583,19.8687,18,1); // Static Banshee
AddStaticVehicle(438,2106.6731,2216.9944,10.6587,103.8177,18,1); // Staticcar 24-7 north
AddStaticVehicle(438,2137.6179,2232.7024,10.6811,328.1266,18,1); // Staticcar middle
AddStaticVehicle(438,2198.3364,2346.4541,10.5099,331.3130,18,1); // Staticcar
AddStaticVehicle(596,2257.1960,2460.6353,10.6585,328.5564,18,1); // PS1
AddStaticVehicle(597,2271.6089,2459.2036,10.6585,213.9797,18,1); // PS2
AddStaticVehicle(598,2232.0371,2513.9004,10.5058,4.0112,18,1); // Ramp Staticcar
AddStaticVehicle(603,2047.7943,2652.9763,10.6604,68.8819,18,1); // North 1
AddStaticVehicle(603,1885.5183,2712.6055,10.5101,74.7906,18,1); // fence
AddStaticVehicle(599,2161.8704,2786.7180,10.6584,238.9728,18,1); // Burger shot nort car
AddStaticVehicle(599,2061.6829,2735.9634,10.6612,94.7349,18,1); // car
AddStaticVehicle(603,2002.6414,2419.8474,10.6574,132.1344,18,1); // car
//Defenders
//AddStaticPickup(1240,15,1460.5353,2789.9490,10.8203); // hp gang base
//AddStaticPickup(350,15,1460.2203,2796.4148,10.8203); // Shotgun gang base
//AddPlayerClass(0,1458.4514,2774.1108,10.8203,244.2857,0,0,0,0,0,0); // Property, gang base
//AddStaticPickup(1242,2,1491.2185,2773.6294,15.9894); // Armour gang base
//AddPlayerClass(0,1450.2231,2772.6238,18.8203,297.1567,0,0,0,0,0,0); // Balcony gang base
//AddPlayerClass(0,1430.8402,2789.6694,20.5233,97.4699,0,0,0,0,0,0); // Back of gang base
//AddPlayerClass(604,1436.8529,2773.5029,28.2280,277.3029,0,0,0,0,0,0); // Base Parachute target
AddStaticVehicle(604,1553.5896,2769.9963,10.6559,216.2977,18,1); // outside base
AddStaticVehicle(604,1473.2418,2878.8699,10.6581,0.9508,18,1); // Gang car
AddStaticVehicle(604,1528.0138,2818.6165,10.6576,272.0461,18,1); // gangcar2
AddStaticVehicle(431,1520.5764,2753.8655,10.6578,1.0676,18,1); // Bus block 1
AddStaticVehicle(431,1516.4530,2757.7400,10.6585,5.3710,18,1); // bus block 2
AddStaticVehicle(431,1503.0283,2772.5369,10.6673,358.5714,18,1); // Bus block 3
AddStaticVehicle(509,1481.4053,2733.6621,10.6579,245.3801,18,1); // Bike ?
//Attackers
AddStaticVehicle(603,1764.1752,2727.5298,10.6739,17.2817,18,1); // gang base two (attackers)
AddStaticVehicle(603,1785.9087,2848.6279,10.6738,42.3208,18,1); // GB2 spawn
AddStaticVehicle(603,1766.1143,2765.5012,10.6742,223.8507,18,1); // GB2spawnfront
AddStaticVehicle(605,1773.9674,2727.8069,10.6744,187.6822,18,1); // GB2 car
AddStaticVehicle(603,1766.5037,2728.9314,10.6734,179.7206,18,1); // GB2 bus
AddStaticVehicle(605,1760.1360,2725.7617,10.6747,187.2195,18,1); // GB2 pheonix
AddStaticVehicle(605,1749.7617,2725.5532,10.6739,188.4158,18,1); // GB2 phoenix
AddStaticVehicle(509,1754.7230,2688.9216,10.6052,136.2856,18,1); // gb2 bike
AddStaticVehicle(509,1763.3322,2697.9502,10.6582,136.4017,18,1); // GB2 bike
AddStaticVehicle(509,1765.1759,2689.1890,10.6585,224.0960,18,1); // Gb2 bike
AddStaticVehicle(605,1781.4313,2727.8630,10.6737,182.3311,18,1); // Pheonix GB2
//Shooting Practice
AddPlayerClass(0,2494.6423,2781.3252,10.8203,254.5655,0,0,0,0,0,0); // Checkpoint to get in
AddPlayerClass(0,2530.5044,2785.8953,10.8203,288.0301,0,0,0,0,0,0); // Shooting practice spawn 1
AddPlayerClass(0,2545.5120,2754.5957,10.8203,205.8532,0,0,0,0,0,0); // Shooting practice spawn 2
AddPlayerClass(0,2501.0344,2751.0037,10.9844,92.7377,0,0,0,0,0,0); // Hp SP
AddPlayerClass(0,2500.6753,2745.5601,10.9844,159.0127,0,0,0,0,0,0); // armour SP
AddPlayerClass(0,2499.7344,2785.4690,10.8203,274.4723,0,0,0,0,0,0); // checkpoint to get out
AddPlayerClass(0,2499.8782,2789.0295,10.8203,320.0604,0,0,0,0,0,0); // checkpoint in spawn
AddPlayerClass(0,2494.8655,2788.1851,10.8203,271.1069,0,0,0,0,0,0); // Checkpoint spawn out*/
//Armour
//new Float:gArmourPickups[][ PickupSpawnInfo ] =
//{
// { 1491.2185,2773.6294,15.9894 },
// { 2089.0508, 1449.1014, 10.8203 },
//{ 1982.9528, 1623.2513, 12.1968 },
// { 2110.3594, 2057.5906, 10.8203 },
// { -377.4450, 2241.7900, 46.1869 },
// { -2669.0249, 1428.7522, 906.4609 },
// { 1491.0803, 2773.4373, 15.9706 }
//};
SetTimer("MoneyGrubScoreUpdate", 1000, 1);
//SetTimer("GameModeExitFunc", gRoundTime, 0);
return 1;
}
public SendPlayerFormattedText(playerid, const str[], define)
{
new tmpbuf[256];
format(tmpbuf, sizeof(tmpbuf), str, define);
SendClientMessage(playerid, 0xFFFF00AA, tmpbuf);
}
public SendAllFormattedText(playerid, const str[], define)
{
new tmpbuf[256];
format(tmpbuf, sizeof(tmpbuf), str, define);
SendClientMessageToAll(0xFFFF00AA, tmpbuf);
}
/*strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}*/