Код:
// ABR FUN FACTORY
// WTF
// LALA
#include <a_samp>
#include <YSI\y_commands>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf>
#include <noclass>
#include <foreach>
#define PATH "/Users/%s.ini"
#define ACTOR_DATA "Actors/%d"
#define MAX_ACTORSS (200)
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_CLIENT (0xAAC4E5FF)
#define COLOR_WHITE (0xFFFFFFFF)
#define COLOR_RED (0xFF0000FF)
#define COLOR_CYAN (0x33CCFFFF)
#define COLOR_LIGHTRED (0xFF6347FF)
#define COLOR_LIGHTGREEN (0x9ACD32FF)
#define COLOR_YELLOW (0xFFFF00FF)
#define COLOR_GREY (0xAFAFAFFF)
#define COLOR_HOSPITAL (0xFF8282FF)
#define COLOR_PURPLE (0xD0AEEBFF)
#define COLOR_LIGHTYELLOW (0xF5DEB3FF)
#define COLOR_DARKBLUE (0x1394BFFF)
#define COLOR_ORANGE (0xFFA500FF)
#define COLOR_LIME (0x00FF00FF)
#define COLOR_GREEN (0x33CC33FF)
#define COLOR_BLUE (0x2641FEFF)
#define COLOR_FACTION (0xBDF38BFF)
#define COLOR_RADIO (0x8D8DFFFF)
#define COLOR_LIGHTBLUE (0x007FFFFF)
#define COLOR_SERVER (0xFFFF90FF) // 6688FF
#define COLOR_DEPARTMENT (0xF0CC00FF)
#define COLOR_ADMINCHAT (0x33EE33FF)
#define DEFAULT_COLOR (0xFFFFFFFF)
#define SCM SendClientMessage //Saves time
#define BPATH "/Business/%i.ini" //Defines the path y_ini will use to find the .ini file we need.
//The below colors do not have to be used, but you will need to edit the script if you choose not to use them.
#define NEWBIE_COLOR 0x7DAEFFFF
#define TCOLOR_WHITE 0xFFFFFF00
#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 COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
//#define COLOR_PURPLE 0xC2A2DAAA
//#define COLOR_RED 0xAA3333AA
//#define COLOR_GREY 0xAFAFAFAA
//#define COLOR_GREEN 0x33AA33AA
#define COLOR_BLACK 0x000001FF
//#define COLOR_BLUE 0x007BD0FF
#define COLOR_LIGHTORANGE 0xFFA100FF
#define COLOR_FLASH 0xFF000080
//#define COLOR_LIGHTRED 0xFF6347AA
//#define COLOR_LIGHTBLUE 0x01FCFFC8
//#define COLOR_LIGHTGREEN 0x9ACD32AA
//#define COLOR_YELLOW 0xFFFF00AA
//#define COLOR_LIGHTYELLOW 0xFFFF91FF
#define COLOR_YELLOW2 0xF5DEB3AA
//#define COLOR_WHITE 0xFFFFFFAA
new onlineplayers=0;
new DropLimit = 5;
new DeleteTime = 20;
new InsideBiz;[MAX_PLAYERS]
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
return 1;
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" ABR Fun Factory by Missclick");
print("----------------------------------\n");
}
#endif
new randomMessages[][] = //here, we're creating the array with the name "randomMessages"
{
"[INFO] We are hiring developers and testers currently.",
"[INFO] You can use /cmds to see the commands and /stats to see your statistics.",
"[INFO] This server is still in developtment so expect bugs."
};
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pScore,
pSkin,
pAssistant,
pFac,
pLead,
pAdminDuty,
BizID
}
new PlayerInfo[MAX_PLAYERS][pInfo];
enum bInfo {
bOwned,
bPrice,
bOwner[MAX_PLAYER_NAME],
bType,
bLocked,
bMoney,
Float:bEntranceX,
Float:bEntranceY,
Float:bEntranceZ,
Float:bEntranceA,
Float:bExitX,
Float:bExitY,
Float:bExitZ,
Float:bExitA,
bInt,
bWorld,
bInsideInt,
bInsideWorld,
bInsideIcon,
bOutsideIcon,
bName[128]
}
new BusinessInfo[200][bInfo];
forward SaveBusiness(id);
public SaveBusiness(id)
{
new file4[40];
format(file4, sizeof(file4), BPATH, id);
new INI:File = INI_Open(file4);
INI_SetTag(File,"data");
INI_WriteInt(File,"bOwned", BusinessInfo[id][bOwned]);
INI_WriteInt(File,"bPrice", BusinessInfo[id][bPrice]);
INI_WriteString(File,"bOwner", BusinessInfo[id][bOwner]);
INI_WriteInt(File,"bType", BusinessInfo[id][bType]);
INI_WriteInt(File,"bLocked", BusinessInfo[id][bLocked]);
INI_WriteInt(File,"bMoney", BusinessInfo[id][bMoney]);
INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bEntranceX]);
INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bEntranceY]);
INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bEntranceZ]);
INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bEntranceA]);
INI_WriteFloat(File,"bExitX", BusinessInfo[id][bExitX]);
INI_WriteFloat(File,"bExitY", BusinessInfo[id][bExitY]);
INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bExitZ]);
INI_WriteFloat(File,"bExitA", BusinessInfo[id][bExitA]);
INI_WriteInt(File,"bInt", BusinessInfo[id][bInt]);
INI_WriteInt(File,"bWorld", BusinessInfo[id][bWorld]);
INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bInsideInt]);
INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bInsideWorld]);
INI_WriteString(File,"bName", BusinessInfo[id][bName]);
INI_Close(File);
return 1;
}
forward loadbiz_data(idx, name[], value[]);
public loadbiz_data(idx, name[], value[])
{
INI_Int("bOwned", BusinessInfo[idx][bOwned]);
INI_Int("bPrice", BusinessInfo[idx][bPrice]);
INI_String("bOwner", BusinessInfo[idx][bOwner], 24);
INI_Int("bType", BusinessInfo[idx][bType]);
INI_Int("bLocked", BusinessInfo[idx][bLocked]);
INI_Int("bMoney", BusinessInfo[idx][bMoney]);
INI_Float("bEntranceX", BusinessInfo[idx][bEntranceX]);
INI_Float("bEntranceY", BusinessInfo[idx][bEntranceY]);
INI_Float("bEntranceZ", BusinessInfo[idx][bEntranceZ]);
INI_Float("bEntranceA", BusinessInfo[idx][bEntranceA]);
INI_Float("bExitX", BusinessInfo[idx][bExitX]);
INI_Float("bExitY", BusinessInfo[idx][bExitY]);
INI_Float("bExitZ", BusinessInfo[idx][bExitZ]);
INI_Float("bExitA", BusinessInfo[idx][bExitA]);
INI_Int("bInt", BusinessInfo[idx][bInt]);
INI_Int("bWorld", BusinessInfo[idx][bWorld]);
INI_Int("bInsideInt", BusinessInfo[idx][bInsideInt]);
INI_Int("bInsideWorld", BusinessInfo[idx][bInsideWorld]);
INI_String("bName", BusinessInfo[idx][bName], 128);
return 1;
}
forward RandomMessages();
public RandomMessages()
{
new randomMsg = random(sizeof(randomMessages));
SendClientMessageToAll(COLOR_GREEN, randomMessages[randomMsg]);
}
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Assistant",PlayerInfo[playerid][pAssistant]);
INI_Int("Faction",PlayerInfo[playerid][pFac]);
INI_Int("Leader",PlayerInfo[playerid][pLead]);
INI_Int("AdminDuty",PlayerInfo[playerid][pAdminDuty]);
return 1;
}
forward DropPlayerWeapons(playerid);
public DropPlayerWeapons(playerid)
{
new playerweapons[13][2];
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, playerweapons[i][0], playerweapons[i][1]);
new model = GetWeaponType(playerweapons[i][0]);
new times = floatround(playerweapons[i][1]/10.0001);
new Float:X = x + (random(3) - random(3));
new Float:Y = y + (random(3) - random(3));
if(playerweapons[i][1] != 0 && model != -1)
{
if(times > DropLimit) times = DropLimit;
for(new a=0; a<times; a++)
{
new pickupid = CreatePickup(model, 3, X, Y, z);
SetTimerEx("DeletePickup", DeleteTime*1000, false, "d", pickupid);
}
}
}
return 1;
}
forward DeletePickup(pickupid);
public DeletePickup(pickupid)
{
DestroyPickup(pickupid);
return 1;
}
GetWeaponType(weaponid) //explainin'
{
switch(weaponid)
{
case 1: return 331; case 2: return 333; case 3: return 334; // this is to define the weapons
case 4: return 335; case 5: return 336; case 6: return 337;
case 7: return 338; case 8: return 339; case 9: return 341;
case 10: return 321; case 11: return 322; case 12: return 323;
case 13: return 324; case 14: return 325; case 15: return 326;
case 16: return 342; case 17: return 343; case 18: return 344;
case 22: return 346; case 23: return 347; case 24: return 348;
case 25: return 349; case 26: return 350; case 27: return 351;
case 28: return 352; case 29: return 353; case 30: return 355;
case 31: return 356; case 32: return 372; case 33: return 357;
case 34: return 358; case 35: return 359; case 36: return 360;
case 37: return 361; case 38: return 362; case 39: return 363;
case 41: return 365; case 42: return 366; case 46: return 371; //example, this case is the id 46 is the parachute, we will drop the parachute, that's if you got one
}
return -1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
stock LevelToRank(level)
{
new rank[30];
switch(level)
{
case 1: rank = "Assistant";
case 2: rank = "Trial Admin";
case 3: rank = "Administrator Assistant";
case 4: rank = "Administrator";
case 5: rank = "Head Admin";
case 6: rank = "Manager";
default: rank = "Player";
}
return rank;
}
stock BusinessType(b)// creates a stock.
{
new string[30];
switch(BusinessInfo[b][bType])//You should know what switch is.
{
case 4: string = "24/7";
case 3: string = "Club";
case 2: string = "Bar";
case 1: string = "Clothes Shop";
}
return string;
}
IsPlayerNearBizEnt(playerid)
{
for(new b = 1; b < sizeof(BusinessInfo); b++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, BusinessInfo[b][bEntranceX], BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ])) return b;
}
return -1;
}
public OnGameModeInit()
{
SetGameModeText("FF|v0.0.1");
//AddPlayerClass(2, 2200.0459, 1285.3773, 10.8203, 93.1433, 0, 0, 0, 0, 0, 0);
SetTimer("RandomMessages", 60000, true);
new str[40];
for(new idx = 1; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
{
format(str, sizeof(str), BPATH, idx);//formats the file path, with the biz ID
INI_ParseFile(str, "loadbiz_%s", .bExtra = true, .extra = idx );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]); //Creates a pickup at the business entrance.
BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]); //Creates a pickup at the exit(Inside the interior)
}
return 1;
}
public OnGameModeExit()
{
for(new id = 1; id < sizeof(BusinessInfo); id++)//Loops through the businesses.
{
if(BusinessInfo[id][bPrice] == 0) break;//Breaks the loop if the price is 0(Meaning it doesn't exist)
SaveBusiness(id);//Calls the SaveBusiness function.
}
return 1;
}
/*public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2200.0459, 1285.3773, 10.8203);
SetPlayerCameraPos(playerid, 2192.5767, 1285.3793, 10.8203);
SetPlayerCameraLookAt(playerid, 2192.5767, 1285.3793, 10.8203);
return 1;
}*/
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
onlineplayers++;
new str[128];
format(str,sizeof(str),"SERVER STATUS: %i players are currently online.",onlineplayers);
SendClientMessageToAll(0xED5F07FF,str);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Assistant",PlayerInfo[playerid][pAssistant]);
INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFac]);
INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLead]);
//INI_WriteInt(File,"AdminDuty",PlayerInfo[playerid][pAdminDuty]);
INI_Close(File);
onlineplayers--;
new str[128];
format(str,sizeof(str),"SERVER STATUS: %i players are currently online.",onlineplayers);
SendClientMessageToAll(0xED5F07FF,str);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
DropPlayerWeapons(playerid);
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
PlayerInfo[killerid][pScore]++;
new targetplayer;
new string[150], pName[MAX_PLAYER_NAME];
GetPlayerName(targetplayer, pName, MAX_PLAYER_NAME);
format(string, sizeof string, "-KILLCAM- "COL_WHITE"You have killed %s and got +1 score and a kill.", pName);
SendClientMessage(killerid, COLOR_RED, string);
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/ignorethis", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",1000);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Skin",2);
INI_WriteInt(File,"Assistant",0);
INI_WriteInt(File,"Faction",0);
INI_WriteInt(File,"Leader",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 2, 2200.0459, 1285.3773, 10.8203, 93.1433, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You just registered. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 2200.0459, 1285.3773, 10.8203, 93.1433, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Updates",""COL_GREEN"Progressn/Addedn/ • Register Systemn/ • Dealership","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public OnPlayerFullyConnected(playerid)
{
SpawnPlayer(playerid);
}
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new string[256];
for(new b = 1;b < sizeof(BusinessInfo);b++)// Loopd through all the businesses again.
{
if(pickupid == BusinessInfo[b][bOutsideIcon])//Checks if it's a biz pickup.
{
if(BusinessInfo[b][bOwned] == 0)//Checks if it is owned.
{
format(string, sizeof(string), "~g~Name:~w~%s~n~~w~This business is ~g~for sale!~n~~r~Price:~g~%i~n~BizType:~w~%s~n~~g~BizID:~w~%i", BusinessInfo[b][bName], BusinessInfo[b][bPrice], BusinessType(b), b);//Formats a string with all the info.
GameTextForPlayer(playerid, string, 3000, 3);
}
if(BusinessInfo[b][bOwned] == 1)//Checks if it owned.
{
format(string, sizeof(string), "~g~Name:~w~%s~n~~g~Owner:~w~%s~n~~g~BizType:~w~%s ~n~~g~BizID:~w~%i", BusinessInfo[b][bName], BusinessInfo[b][bOwner], BusinessType(b), b);//Formats a string with all the info.
GameTextForPlayer(playerid, string, 3000, 3);
}
}
}
return 1;
}
CMD:setskin(playerid, params[])
{
new targetplayer, skinid;
if (PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, 0xFF0000AA, "You have to be atleast Trial Admin.");
//if(IsPlayerAdmin(playerid)) return 0;
{
if(sscanf(params, "ui", targetplayer, skinid)) return SendClientMessage(playerid, COLOR_WHITE, ""COL_LIGHTBLUE"<Usage> "COL_WHITE"/setskin [ID] [skinid]"); // this line is for; if you type /setskin, you will receive a message displayed with the "Usage" part.
if(skinid < 0 || skinid > 311) return SendClientMessage(playerid, COLOR_RED, "<Error> "COL_WHITE"Available skinids 0 - 311");
if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_RED, "<Error> "COL_WHITE"Player is not connected!");
//==-==
new string[150], pName[MAX_PLAYER_NAME];
SetPlayerSkin(targetplayer, skinid);
format(string, sizeof string, "<ACCOUNT> Your skinid has been set by an admin to %i", skinid);
SendClientMessage(targetplayer, COLOR_GREY, string);
GetPlayerName(targetplayer, pName, MAX_PLAYER_NAME);
format(string, sizeof string, "<AdmCmd> You have set %s's skinid to %i", pName, skinid);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
CMD:stats(playerid, params[])
{
new string[250], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "--- %s Stats ---", pName);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), ""COL_WHITE"Cash: "COL_LIGHTBLUE"%d$ "COL_WHITE"| Admin Level: "COL_LIGHTBLUE"%d "COL_WHITE"| Kills: "COL_LIGHTBLUE"%d "COL_WHITE"| Deaths: "COL_LIGHTBLUE"%d "COL_WHITE"| Score: "COL_LIGHTBLUE"%d", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pScore]);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), ""COL_WHITE"Skin: "COL_LIGHTBLUE"%d "COL_WHITE"| Assistant Level: "COL_LIGHTBLUE"%d", PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pAssistant]);
SendClientMessage(playerid, -1, string);
return 1;
}
CMD:suicide(playerid, params[])
{
SetPlayerHealth(playerid, 0);
return 1;
}
CMD:testwep(playerid, params[])
{
GivePlayerWeapon(playerid, 24, 50);
GivePlayerWeapon(playerid, 3, 1);
return 1;
}
CMD:goto(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, 0xFF0000AA, "You have to be atleast Trial Admin.");
new ID;
new pn[MAX_PLAYER_NAME];
new an[MAX_PLAYER_NAME];
new str[128];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, ""COL_LIGHTBLUE"<USAGE> "COL_WHITE"/goto [ID]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, ""COL_RED"ERROR: "COL_WHITE"This player is not connected");
GetPlayerName(playerid, an, MAX_PLAYER_NAME);
GetPlayerName(ID, pn, MAX_PLAYER_NAME);
new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
format(str, sizeof(str), "You have been teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
if(IsPlayerInAnyVehicle(playerid))
{
GetPlayerPos(ID, x, y, z);
SetVehiclePos(playerid, x+1, y+1, z);
}
return 1;
}
CMD:setleader(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, 0xFF0000AA, "You have to be atleast Head Admin.");
new string[256], targetid, faction, name[128];
if(sscanf(params, "ui", targetid, faction))
{
SendClientMessage(playerid, 0xFFFFFFAA, ""COL_LIGHTBLUE"<Usage> "COL_WHITE"/leader [ID] [facID]");
SendClientMessage(playerid, 0xFFFFFFAA, "1-LSPD | 2-CIA | 3-NG");
return 1;
}
if(faction == 1) { name = "LSPD"; }
else if(faction == 2) { name = "CIA"; }
else if(faction == 3) { name = "NG"; }
else { return 1; }
PlayerInfo[targetid][pFac] = faction;
PlayerInfo[targetid][pLead] = faction;
new pname[256], tname[256];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(targetid, tname, sizeof(tname));
format(string, sizeof(string), "You made %s leader of %s.", tname, name);
SendClientMessage(playerid, 0xFFFFFFAA, string);
format(string, sizeof(string), "%s has made you leader of %s.", pname, name);
SendClientMessage(targetid, 0xFFFFFFAA, string);
return 1;
}
CMD:invite(playerid, params[])
{
if(PlayerInfo[playerid][pLead] >= 1)
{
new string[256], targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Syntax: /invite [ID]");
PlayerInfo[targetid][pFac] = PlayerInfo[playerid][pFac];
new pname[256], tname[256];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(targetid, tname, sizeof(tname));
format(string, sizeof(string), "You have invited %s to your faction.", tname);
SendClientMessage(playerid, 0xFFFFFFAA, string);
format(string, sizeof(string), "%s has invited you to their faction.", pname);
SendClientMessage(targetid, 0xFFFFFFAA, string);
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "You're not a faction leader!");
}
return 1;
}
CMD:terminate(playerid, params[])
{
if(PlayerInfo[playerid][pLead] >= 1)
{
new string[256], targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "Syntax: /terminate [ID]");
if(PlayerInfo[targetid][pFac] == PlayerInfo[playerid][pFac])
{
new pname[256], tname[256];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(targetid, tname, sizeof(tname));
format(string, sizeof(string), "You have removed %s from your faction.", tname);
SendClientMessage(playerid, 0xFFFFFFAA, string);
format(string, sizeof(string), "%s has removed you from their faction.", pname);
SendClientMessage(targetid, 0xFFFFFFAA, string);
PlayerInfo[targetid][pFac] = 0;
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "The player you're trying to terminate is not from your faction!");
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFAA, "You're not a faction leader!");
}
return 1;
}
CMD:leavefac(playerid, params[])
{
PlayerInfo[playerid][pFac] = 0;
PlayerInfo[playerid][pLead] = 0;
SendClientMessage(playerid, 0xFFFFFFAA, "You have left your current faction!");
return 1;
}
CMD:aduty(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] < 1)
return SendClientMessage(playerid, COLOR_RED, "You don't have permission to use this command.");
if (!PlayerInfo[playerid][pAdminDuty])
{
SetPlayerColor(playerid, 0x33CC3300);
new pname[256], string[150];
GetPlayerName(playerid, pname, sizeof(pname));
PlayerInfo[playerid][pAdminDuty] = 1;
format(string, sizeof(string), ""COL_LIGHTBLUE"%s "COL_WHITE"is now on duty as admin.", pname);
SendClientMessageToAll(COLOR_GREEN, string);
}
else
{
SetPlayerColor(playerid, COLOR_WHITE);
PlayerInfo[playerid][pAdminDuty] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You are no longer on admin duty.");
}
return 1;
}
CMD:admins(playerid, params[])
{
new count = 0;
new pname[256], string[150];
SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");
foreach (new i : Player) if (PlayerInfo[i][pAdmin] > 0)
{
if (PlayerInfo[i][pAdminDuty])
{
GetPlayerName(playerid, pname, sizeof(pname));
PlayerInfo[playerid][pAdminDuty] = 1;
format(string, sizeof(string), "%s - "COL_LIGHTBLUE"%s "COL_WHITE"("COL_GREEN"On Duty"COL_WHITE")", pname, LevelToRank(PlayerInfo[playerid][pAdmin]));
SendClientMessageToAll(COLOR_WHITE, string);
}
else
{
GetPlayerName(playerid, pname, sizeof(pname));
PlayerInfo[playerid][pAdminDuty] = 1;
format(string, sizeof(string), "%s - "COL_LIGHTBLUE"%s "COL_WHITE"("COL_RED"Off Duty"COL_WHITE")", pname, LevelToRank(PlayerInfo[playerid][pAdmin]));
SendClientMessageToAll(COLOR_WHITE, string);
}
count++;
}
if (!count) {
SendClientMessage(playerid, COLOR_WHITE, "* No admins online.");
}
SendClientMessage(playerid, COLOR_GREY, "-----------------------------------------------------------");
return 1;
}
YCMD:createbiz(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "You aren't authorized to use this command!");//Checks if player is a RCON admin..Change this with your admin system.
new price, level, id, int, world, string[128], Float:Xi, Float:Yi, Float:Zi, inti;//All the new defines we will need.
if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi)) return SendClientMessage(playerid, COLOR_GREY, "YCMD: /createbiz [price] [type] [interior] [X] [Y] [Z]");//d stands for integer, f stands for float.
if(level < 0 || level > 4) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Type cannot go below 0, or above 10.");//
if(price < 10000) return SendClientMessage(playerid, COLOR_GREY, "YCMD: Price cannot go below $10,000.");// Check if the price is below 1000, if it is it will return a message saying it.
for(new h = 1;h < sizeof(BusinessInfo);h++)//Loops through all the businesses
{
if(BusinessInfo[h][bPrice] == 0)//Checks if the price of a business is 0.
{
id = h;
break;//It stops looping if it is.
}
}
new Float:X,Float:Y,Float:Z,Float:A;//More new defines.
GetPlayerPos(playerid, X, Y, Z);//Gets your player position, and saves it into floats.
GetPlayerFacingAngle(playerid, A);//Gets your facing angle, and saves it into a float.
int = GetPlayerInterior(playerid);//Gets your interior, and saves it into a integer.
world = GetPlayerVirtualWorld(playerid);//Gets your Virtual World, and saves it into a integer
BusinessInfo[id][bInsideInt] = inti;
BusinessInfo[id][bExitX] = Xi;
BusinessInfo[id][bExitY] = Yi;
BusinessInfo[id][bExitZ] = Zi;
BusinessInfo[id][bOwned] = 0;
BusinessInfo[id][bPrice] = price;
BusinessInfo[id][bType] = level;
BusinessInfo[id][bEntranceX] = X;
BusinessInfo[id][bEntranceY] = Y;
BusinessInfo[id][bEntranceZ] = Z;
BusinessInfo[id][bEntranceA] = A;
BusinessInfo[id][bLocked] = 1;
BusinessInfo[id][bInt] =int;
BusinessInfo[id][bWorld] =world;
BusinessInfo[id][bInsideWorld] =id;
format(string, sizeof(string), "None");
strmid(BusinessInfo[id][bName], string, 0, strlen(string), 255);
if(BusinessInfo[id][bOutsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bOutsideIcon]);
if(BusinessInfo[id][bInsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bInsideIcon]);
BusinessInfo[id][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ], BusinessInfo[id][bWorld]);//Creates a pickup at your location
BusinessInfo[id][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bExitX], BusinessInfo[id][bExitY], BusinessInfo[id][bExitZ], BusinessInfo[id][bInsideWorld]);//Creates a pickup at your location
new file4[40];
format(file4, sizeof(file4), BPATH, id);
new INI:File = INI_Open(file4);
INI_SetTag(File,"data");
INI_WriteInt(File,"bOwned", BusinessInfo[id][bOwned]);
INI_WriteInt(File,"bPrice", BusinessInfo[id][bPrice]);
INI_WriteString(File,"bOwner", BusinessInfo[id][bOwner]);
INI_WriteInt(File,"bType", BusinessInfo[id][bType]);
INI_WriteInt(File,"bLocked", BusinessInfo[id][bLocked]);
INI_WriteInt(File,"bMoney", BusinessInfo[id][bMoney]);
INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bEntranceX]);
INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bEntranceY]);
INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bEntranceZ]);
INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bEntranceA]);
INI_WriteFloat(File,"bExitX", BusinessInfo[id][bExitX]);
INI_WriteFloat(File,"bExitY", BusinessInfo[id][bExitY]);
INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bExitZ]);
INI_WriteFloat(File,"bExitA", BusinessInfo[id][bExitA]);
INI_WriteInt(File,"bInt", BusinessInfo[id][bInt]);
INI_WriteInt(File,"bWorld", BusinessInfo[id][bWorld]);
INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bInsideInt]);
INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bInsideWorld]);
INI_WriteString(File,"bName", BusinessInfo[id][bName]);
INI_Close(File);
return 1;
}
YCMD:deletebiz(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 1; // Checks if a player is a RCON admin, again change this to your admin system.
new id;
if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "YCMD: /deletebiz [id]");
if(BusinessInfo[id][bOwned] == 1) return SCM(playerid, COLOR_GREY, "This biz is owned.");//Checks if the biz is owned, if it is it won't allow it to be deleted.
//Below it resets all the biz enum info.
BusinessInfo[id][bOwned] = 0;
BusinessInfo[id][bPrice] = 0;
BusinessInfo[id][bOwner] = 0;
BusinessInfo[id][bType] = 0;
BusinessInfo[id][bLocked] = 0;
BusinessInfo[id][bName] = 0;
BusinessInfo[id][bMoney] = 0;
BusinessInfo[id][bEntranceX] = 0;
BusinessInfo[id][bEntranceY] = 0;
BusinessInfo[id][bEntranceZ] = 0;
BusinessInfo[id][bEntranceA] = 0;
BusinessInfo[id][bExitX] = 0;
BusinessInfo[id][bExitY] = 0;
BusinessInfo[id][bExitZ] = 0;
BusinessInfo[id][bExitA] = 0;
BusinessInfo[id][bInt] = 0;
BusinessInfo[id][bWorld] = 0;
if(BusinessInfo[id][bOutsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bOutsideIcon]);//Destroys the pickup.
new string[128];
format(string, sizeof(string), BPATH, id);
fremove(string);
return 1;
}
YCMD:lockbiz(playerid, params[])
{
new id = IsPlayerNearBizEnt(playerid);//Uses the function to find if player is near a biz!
if(id != PlayerInfo[playerid][BizID]) return SCM(playerid, COLOR_GREY, "This isn't your biz!");
if(BusinessInfo[id][bLocked] == 1)
{
BusinessInfo[id][bLocked] = 0;
GameTextForPlayer(playerid, "Biz ~g~unlocked!", 3000, 3);
}
else
{
BusinessInfo[id][bLocked] = 1;
GameTextForPlayer(playerid, "Biz ~r~locked!", 3000, 3);
}
return 1;
}
YCMD:enter(playerid, params[])
{
for(new b = 1; b < sizeof(BusinessInfo); b++)//Loops through all the businesses.
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, BusinessInfo[b][bEntranceX], BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ]))//Checks if player is near the entrance.
{
if(BusinessInfo[b][bLocked] == 1) return SendClientMessage(playerid, COLOR_GREY, "This Business is locked!");//Checks it it is locked/
SetPlayerPos(playerid, BusinessInfo[b][bExitX], BusinessInfo[b][bExitY], BusinessInfo[b][bExitZ]);
SetPlayerFacingAngle(playerid, BusinessInfo[b][bExitA]);
SetPlayerInterior(playerid, BusinessInfo[b][bInsideInt]);
SetPlayerVirtualWorld(playerid, BusinessInfo[b][bInsideWorld]);
InsideBiz[playerid] = b;
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 2.0, BusinessInfo[b][bExitX], BusinessInfo[b][bExitY], BusinessInfo[b][bExitZ]) && GetPlayerVirtualWorld(playerid) == BusinessInfo[b][bInsideWorld])//Checks if player is in near the exit.
{
SetPlayerPos(playerid, BusinessInfo[b][bEntranceX], BusinessInfo[b][bEntranceY], BusinessInfo[b][bEntranceZ]);
SetPlayerFacingAngle(playerid, BusinessInfo[b][bEntranceA]);
SetPlayerInterior(playerid, BusinessInfo[b][bInt]);
SetPlayerVirtualWorld(playerid, BusinessInfo[b][bWorld]);
InsideBiz[playerid] = 0;
return 1;
}
}
return 1;
}
YCMD:buybiz(playerid, params[])
{
new id = IsPlayerNearBizEnt(playerid);
if(id == -1 || id == 0) return SendClientMessage(playerid, COLOR_GREY, "You are not near a biz");
if(BusinessInfo[id][bOwned] != 0 || BusinessInfo[id][bPrice] == 0) return SendClientMessage(playerid, COLOR_GREY, "This biz is not for sale.");
if(PlayerInfo[playerid][BizID] != 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You already own a biz.");
if(PlayerInfo[playerid][Money] < BusinessInfo[id][bPrice]) return SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, you can not afford this biz.");
PlayerInfo[playerid][BizID] = id;
PlayerInfo[playerid][Money] -= BusinessInfo[id][bPrice];
GivePlayerMoney(playerid, -BusinessInfo[id][bPrice]);
BusinessInfo[id][bLocked] = 0;
BusinessInfo[id][bOwned] = 1;
BusinessInfo[id][bOwner] = RemoveUnderScore(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Congratulations on your new biz! Use /bizhelp to get help, or /ask!");
return 1;
}
YCMD:sellbiz(playerid, params[])
{
new id = PlayerInfo[playerid][BizID];
if(PlayerInfo[playerid][BizID] == 0) return SCM(playerid, COLOR_GREY, "You don't own a biz!");
BusinessInfo[id][bOwned] = 0;
BusinessInfo[id][bOwner] = 0;
BusinessInfo[id][bLocked] = 1;
PlayerInfo[playerid][Money] = BusinessInfo[id][bPrice];
PlayerInfo[playerid][BizID] = 0;
SCM(playerid, COLOR_YELLOW, "Business sold!");
return 1;
}
YCMD:bizsetname(playerid, params[])
{
new name[128];
if(sscanf(params, "s[128]", name)) return SCM(playerid, COLOR_GREY, "/bizsetname [name]");
if(PlayerInfo[playerid][BizID] == 0) return SCM(playerid, COLOR_GREY, "You don't own a biz!");
BusinessInfo[PlayerInfo[playerid][BizID]][bName] = name;
SCM(playerid, COLOR_YELLOW, "Business name changed!");
return 1;
}
YCMD:clothes(playerid, params[])
{
new skin;
if(sscanf(params, "i", skin)) return SCM(playerid, COLOR_GREY, "YCMD:/skin [skinid]");
if(PlayerInfo[playerid][Money] < 100) return SCM(playerid, COLOR_GREY, "You need atleast 100%!");
if(BusinessInfo[InsideBiz[playerid]][bType] != 1) return SCM(playerid, COLOR_GREY, "You need to be in clothes shop!");
if(1 > skin || 299 < skin || skin == 288 || skin == 287 || skin == 286 || skin == 285 || skin == 284 || skin == 283 || skin == 282 || skin == 281 || skin == 280 || skin == 279 || skin == 278 || skin == 277 || skin == 276 || skin == 275 || skin == 274) return SCM(playerid, COLOR_GREY, "Invalid skin ID!");
SetPlayerSkin(playerid, skin);
PlayerInfo[playerid][Skin] = skin;
GivePlayerMoney(playerid, -100);
BusinessInfo[InsideBiz[playerid]][bMoney] += 100;
return 1;
}
D:\server\samp\gamemodes\abrffnew.pwn(1099) : error 017: undefined symbol "RemoveUnderScore"