#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#pragma tabsize 0
#if defined FILTERSCRIPT
#define WEAPONS 2341
#define PATH "/Database/%s.ini"
#define COLOR_GREY 0xAFAFAFAA
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define COLOR_FADE1 0xFFFFFFFF
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_LIGHTGREEN 0x90EE90FF
#define COLOR_MEDIUMPURPLE 0x9370DBFF
#define COLOR_GOLD 0xFFD700FF
#define COLOR_LIGHTSKYBLUE 0x87CEFAFF
#define COLOR_CRIMSON 0xDC143CFF
new bool: ooc;
forward AutoWeather();
enum pInfo
{
pPass,
pCash,
pAdminLevel,
pKills,
pDeaths,
pSkin
}
new iSpawnSet[MAX_PLAYERS];
new PlayerInfo[MAX_PLAYERS][pInfo];
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][pAdminLevel]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Skin", PlayerInfo[playerid][pSkin]);
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;
}
new ObjectFire;//global variable
/*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;
}
main()
{
print("\n----------------------------------");
print(" FCRP Gamemode by Gooday");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText("Fort Carson Roleplay");
DisableInteriorEnterExits();
ShowPlayerMarkers(0);
SetGameModeText("Fort Carson Roleplay");
SetTimer("AutoWeather", 600000, 1);
LoadStaticVehiclesFromFile("/Database/vehicles.txt");
AddPlayerClass(283, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(183, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(184, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(235, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(240, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(250, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(60, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(30, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddStaticPickup(1318, 1, 246.7839, 63.9001, 1004.1406, 0);
AddStaticPickup(1318, 1, -217.8443,979.1246,20.1040, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
AddPlayerClass(101, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(183, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(184, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(235, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(240, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(250, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(60, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(30, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
iSpawnSet[playerid] = 0;
SetupPlayerForClassSelection(playerid);
return 1;
}
forward SetupPlayerForClassSelection(playerid);
public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid, 258.4893, -41.4008, 1002.0234);
SetPlayerFacingAngle(playerid, 185.4673);
SetPlayerCameraPos(playerid, 256.0815, -43.0475, 1004.0234);
SetPlayerCameraLookAt(playerid, 258.4893, -41.4008, 1002.0234);
AddPlayerClass(101, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(183, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(184, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(235, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(240, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(250, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(60, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(30, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
CreateDynamicObject(970, -205.609650, 991.024109, 19.603674, 0.0000, 0.0000, 271.7189);
CreateDynamicObject(970, -205.678558, 995.182007, 19.648087, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -205.677200, 999.317383, 19.730896, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -205.682617, 1003.476685, 19.771322, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -207.270172, 1006.903809, 19.789442, 0.0000, 0.0000, 319.2972);
CreateDynamicObject(970, -210.938019, 1008.257202, 19.793669, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(970, -230.519119, 999.826172, 19.144413, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.519043, 995.703735, 19.128332, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.532074, 991.570923, 19.112217, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.516602, 987.408936, 19.118702, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.513962, 983.282959, 19.127382, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.463608, 979.134949, 19.132366, 0.0000, 0.0000, 271.1688);
CreateDynamicObject(803, -226.136337, 1004.791809, 20.595205, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -223.304352, 1002.123108, 19.694927, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -206.406036, 988.999695, 19.543804, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -206.409195, 984.935669, 19.410149, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -214.281097, 1002.169006, 19.783312, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1216, -205.396805, 1002.670837, 19.406557, 0.0000, 0.0000, 90.0000);
CreateDynamicObject(1226, -229.728210, 991.873047, 22.389072, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(1226, -229.689285, 998.605774, 22.456175, 0.0000, 0.0000, 178.2812);
CreateDynamicObject(1437, -302.149200, 1040.584839, 19.979918, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(3886, -422.301697, 1168.756836, 0.071592, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(3886, -422.287476, 1158.649658, 0.071584, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(11505, -245.978912, 1217.520264, 23.140045, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -239.585754, 1212.757324, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -239.576202, 1220.454834, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -252.243210, 1212.759033, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -252.305862, 1220.473145, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(16360, -269.659668, 1216.444824, 18.740452, 0.0000, 0.0000, 93.4377);
CreateDynamicObject(11417, -229.186646, 1209.988770, 23.616035, 0.0000, 0.0000, 135.0000);
CreateDynamicObject(1211, -246.413971, 1207.817505, 19.352993, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.490570, 1212.240601, 18.467503, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.500900, 1213.314697, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.505615, 1220.980469, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.510971, 1219.915405, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.806152, 1213.361572, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.776062, 1212.159058, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.873779, 1219.891968, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.827698, 1220.983398, 18.442514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1226, -264.786865, 1210.297974, 22.616608, 0.0000, 0.0000, 181.7189);
CreateDynamicObject(1226, -247.575867, 1224.798584, 22.616608, 0.0000, 0.0000, 91.7189);
CreateDynamicObject(3167, -106.015465, 941.370239, 19.716732, 0.0000, 0.0000, 56.2500);
CreateDynamicObject(3168, -118.227112, 959.917969, 19.528189, 0.0000, 0.0000, 123.7499);
CreateDynamicObject(3168, -33.683365, 931.870850, 18.949020, 0.0000, 0.0000, 191.2500);
CreateDynamicObject(3169, -98.623184, 994.715454, 18.786861, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(3241, -101.528351, 1048.167236, 19.348783, 0.0000, 0.0000, 11.2500);
CreateDynamicObject(3242, -100.108063, 1028.102661, 20.666046, 0.0000, 0.0000, 191.2500);
CreateDynamicObject(3640, 45.976234, 1130.046631, 23.146557, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(3634, 29.924252, 1083.473389, 21.689949, 0.0000, 0.0000, 202.5000);
CreateDynamicObject(3639, -81.771729, 1051.507446, 23.140820, 0.0000, 0.0000, 90.0000);
CreateDynamicObject(3642, -77.740196, 1018.082092, 21.693289, 0.0000, 0.0000, 124.9871);
CreateDynamicObject(3655, -19.340351, 994.817139, 21.595230, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(3698, -155.119537, 1039.391602, 21.631117, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(3515, -297.682068, 1080.874268, 17.854595, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(869, -297.655914, 1080.949341, 19.208811, 0.0000, 0.0000, 33.7500);
CreateDynamicObject(869, -297.573517, 1080.903442, 19.208811, 0.0000, 0.0000, 326.2500);
CreateDynamicObject(869, -297.485077, 1080.860107, 19.208811, 0.0000, 0.0000, 11.2500);
CreateDynamicObject(869, -297.774139, 1080.716431, 19.208811, 0.0000, 0.0000, 326.2500);
CreateDynamicObject(869, -297.516479, 1080.543945, 19.208811, 0.0000, 0.0000, 101.2500);
CreateDynamicObject(869, -297.440887, 1080.594604, 19.208811, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(1280, -306.739929, 1081.020630, 19.143543, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1280, -306.776093, 1076.556885, 19.143543, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1280, -306.756409, 1085.285400, 19.143543, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -307.057251, 1073.529541, 19.306511, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -307.073792, 1088.203125, 19.306511, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(745, -290.232239, 1078.817749, 19.341095, 0.0000, 0.0000, 22.5000);
CreateDynamicObject(746, -289.108612, 1083.948608, 19.944870, 0.0000, 0.0000, 315.0000);
CreateDynamicObject(747, -291.517181, 1081.946289, 19.133242, 0.0000, 0.0000, 236.2501);
CreateDynamicObject(748, -291.720978, 1080.537720, 19.565540, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(890, -288.950714, 1035.317261, 19.815779, 0.0000, 0.0000, 78.7500);
CreateDynamicObject(891, -287.613220, 1029.108154, 18.693661, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(892, -287.478577, 1022.784668, 18.736897, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -290.477509, 1031.934326, 19.230431, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -290.483734, 1019.135315, 19.235624, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(983, -290.509674, 1009.537659, 19.311314, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -296.971558, 1005.332581, 19.219604, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(983, -305.952057, 1005.330994, 19.267479, 0.0000, 0.0000, 90.0000);
CreateDynamicObject(984, -309.168823, 1011.720703, 19.229378, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -309.174988, 1024.533447, 19.249065, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(983, -309.136597, 1034.136963, 19.303673, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(983, -309.174988, 1035.202881, 19.278120, 0.0000, 0.0000, 0.0000);
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"You are already registered, write your chosen password to log in! ","Login","Quit");
}
else {
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to Fort Carson Roleplay, Our database tell us your new here, chose your password to register!","Register","Quit");
}
if(!IsRolePlayName(playerid)) {
SendClientMessage(playerid, COLOR_CRIMSON, "[NORTON DEFENDER] - [KICKED]: Please come back and use a roleplay name. (Example: Jacob_Smith)");
Kick(playerid);
TogglePlayerClock(playerid, 1); // Show the clock
}
return 1;
}
{
new string[254];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s has joined the server!", playername);
SendClientMessageToAll(0xFFEE00, string);
//DONE
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][pAdminLevel]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Skin", PlayerInfo[playerid][pSkin]);
INI_Close(File);
return 1;
}
{
new string[254];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s Left the Server.", playername);
SendClientMessageToAll(0xFFEE00, string);
//DONE
return 1;
}
forward loz_SetPlayerSkin(playerid, skinid);
public loz_SetPlayerSkin(playerid, skinid) PlayerInfo[playerid][pSkin] = skinid;
#define loz_SetPlayerSkin SetPlayerSkin
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,-203.7558,1090.0508,19.7344);
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,"Welcome to Fort Carson!");
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,"You may will have a TOTAL-BLACK screen. RILOG for fix it (this happend JUST the first time).");
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
new pname[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, pname, sizeof(pname));
strreplace(pname, '_', ' ');
//This will show when player speaks FirstName_LastName says: test
format(str, sizeof(str), "%s : %s", pname, text);
ProxDetector(30.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
return 0;
}
//-----------------------COMMANDS-----------------------
CMD:ooc(playerid, params[])
{
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
strreplace(sendername, '_', ' ');
format(string, sizeof(string), "(OOC-G) %s: %s ", sendername, params);
SendClientMessageToAll(COLOR_GREY, string);
return 1;
}
CMD:setadmin(playerid, params[])
{
if(IsPlayerConnected(playerid)) {
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) {
new sendername[MAX_PLAYER_NAME];
new giveplayername[MAX_PLAYER_NAME];
new giveplayerid,level;
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
//u = username.
if (!sscanf(params, "ui", giveplayerid,level)) {
if (giveplayerid != INVALID_PLAYER_ID) {
new string[128];
format(string, sizeof(string), "[INFO]: Administrator %s has promoted you to level %d Administrator",sendername,level);
SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "[INFO]: You have promoted %s into level %d Administrator",giveplayername,level);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
PlayerInfo[giveplayerid][pAdminLevel] = level;
}
}
else SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX] :/setadmin [playerid] [level]");
}
}
return 1;
}
CMD:me(playerid, params[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
if(isnull(params))
return SendClientMessage(playerid,COLOR_LIGHTBLUE -1,"[SYNTAX]: /me [Action]");
format(str,sizeof(str),"*%s %s",name, params);
ProxDetector(30.0, playerid, str, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE);
return 1;
}
CMD:do(playerid, params[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
if(isnull(params))
return SendClientMessage(playerid,COLOR_LIGHTBLUE -1,"[SYNTAX]: /do [Environment]");
format(str,sizeof(str),"*%s ((%s))",params, name);
ProxDetector(30.0, playerid, str, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE);
return 1;
}
CMD:o(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /o [local ooc chat]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "(OOC-L) %s: %s ", sendername, params);
ProxDetector(30.0, playerid, string, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY);
return 1;
}
CMD:meg(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /meg [Megaphone] *JUST COPS*");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "(MEGAPHONE) Officer %s: %s ", sendername, params);
ProxDetector(30.0, playerid, string, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON);
return 1;
}
CMD:apu(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /apu *JUST COPS*");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "This is the BCSD Pull Your Veichle over to the side of the Road NOW!", sendername, params);
ProxDetector(30.0, playerid, string, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON);
return 1;
}
CMD:sh(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /s [shout]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s shouts: %s!", sendername, params);
ProxDetector(30.0, playerid, string,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE,COLOR_FADE1,COLOR_FADE2);
return 1;
}
CMD:w(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"/w [Quiet Talk]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string,sizeof(string), "[WHISPER] %s: %s", sendername, params);
ProxDetector(3.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
return 1;
}
CMD:txt(playerid,params[])
{
new ID;
new PMstring[128]; //the PM
new string[128]; //string used for SendClientMessage
new Iname[MAX_PLAYER_NAME], Pname[MAX_PLAYER_NAME];
if (sscanf(params, "ds[128]", ID, PMstring)) {
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[SYNTAX]: /txt ([ID] ([Message]");
return 1;
}
GetPlayerName(ID,Iname,sizeof(Iname));
GetPlayerName(playerid,Pname,sizeof(Pname));
format(string,128,"Text Message from %i[%s]: %s",playerid,Pname,PMstring);
SendClientMessage(ID,COLOR_LIGHTSKYBLUE,string);
format(string,128,"Text Message to %s: %s",Iname,PMstring);
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,string);
PlayerPlaySound(ID,1085,0.0,0.0,0.0);
return 1;
}
CMD:kick(playerid,params[])
{
new id,name1[MAX_PLAYER_NAME], reason[35],name2[MAX_PLAYER_NAME], string[128];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params,"uz",id,reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /kick [PlayerID/PartOfName] [Reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: Invalid Player ID");
else {
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
format(string, sizeof(string),"*** %s was kicked by %s, Reason: %s",name2,name1,reason);
SendClientMessageToAll(COLOR_CRIMSON,string);
Kick(id);
}
return 1;
}
CMD:ban(playerid, params[])
{
new id, reason[50], string[128], banned[MAX_PLAYER_NAME];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid,COLOR_LIGHTBLUE -1, "[SYNTAX]: /ban [PlayerID] [Reason]");
GetPlayerName(id, banned, sizeof(banned));
format(string, sizeof(string), "*** %s has been banned by %s. reason: %s", banned, GetName(playerid), reason);
SendClientMessageToAll(COLOR_CRIMSON, string);
BanEx(id, reason);
return 1;
}
CMD:acmds(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
SendClientMessage( playerid, COLOR_GOLD, " ..:Admin Command List:.. " );
SendClientMessage( playerid, COLOR_GOLD, "Moderator: /kick, /goto, /get" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Senior Moderator: /ban" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Administrator: /respawncars" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Lead Administrator:" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Community Founder: /setadmin, /veh, /addveh" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
return 1;
}
CMD:chat(playerid, params[])
{
SendClientMessage(playerid, COLOR_GOLD, "*****************************[COMMANDS:]***************************");
SendClientMessage(playerid, COLOR_WHITE, "[CHAT:] /ooc, /me, /do, /o, /pm, /w, /sh");
SendClientMessage(playerid, COLOR_GOLD, "***************************************************************************");
return true;
}
CMD:respawncars(playerid, o[], help)
{
#pragma unused o, help
for(new v = 0; v < MAX_VEHICLES; v++) {
SetVehicleToRespawn(v);
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 3) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
SendClientMessage(v, COLOR_LIGHTGREEN -1, "[SUCCESS]: All vehicles have been respawned");
}
return 1;
}
CMD:goto(playerid, params[])
{
new id, Float:Pos[3];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /goto [playerID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: That player is offline!");
GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1]+4, Pos[2]);
return 1;
}
CMD:get(playerid, params[])
{
new id, Float:Pos[3];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /get [PlayerID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: That player is offline!");
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(id, Pos[0], Pos[1]+4, Pos[2]);
return 1;
}
COMMAND:asetskin(playerid, params[])
{
new
id, skin, name[ MAX_PLAYER_NAME ], name2[ MAX_PLAYER_NAME ], str[ 128 ];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if( sscanf ( params, "ui", id, skin ) ) return SendClientMessage( playerid, COLOR_LIGHTBLUE -1,#[SYNTAX]: /asetskin [PlayerName/ID] [SkinModel]);
if( id == INVALID_PLAYER_ID ) return SendClientMessage( playerid,COLOR_CRIMSON -1, #Invalid player ID);
if(skin > 299 || skin < 1) return SendClientMessage(playerid, -1,#Wrong Skin ID! Available ID's: 1-299);
GetPlayerName( playerid, name, MAX_PLAYER_NAME ); GetPlayerName( id, name2, MAX_PLAYER_NAME );
format( str, sizeof ( str ),"[SUCCESS] You have set %s skin to model %d", name2, skin);
SendClientMessage( playerid, COLOR_LIGHTGREEN -1, str );
format( str, sizeof ( str ),"[SUCCESS] Your skin has been set to model %d by %s", skin, name);
SendClientMessage( id, COLOR_LIGHTGREEN -1, str );
SetPlayerSkin( id, skin );
return true;
}
COMMAND:enableooc(playerid, o[], help)
{
#pragma unused help
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
ooc = true;
SendClientMessageToAll(COLOR_CRIMSON -1,"[INFO]: OOC Chat has been enabled");
return 1;
}
COMMAND:disableooc(playerid, o[], help)
{
#pragma unused help
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(ooc == true) {
ooc = false;
SendClientMessageToAll(COLOR_CRIMSON -1,"[INFO]: OOC Chat has been disabled");
}
return 1;
}
CMD:addveh(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(IsPlayerInAnyVehicle(playerid)) {
new filestring[264],Float:X,Float:Y,Float:Z,Float:Rot;
GetPlayerPos(playerid,X,Y,Z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), Rot);
new vid = GetVehicleModel(GetPlayerVehicleID(playerid));
new File:pos=fopen("vehicles.txt", io_append);
format(filestring, 256, "\n%d,%f,%f,%f,%f,-1,-1 ;", vid, X, Y, Z, Rot);
fwrite(pos, filestring);
fclose(pos);
SendClientMessage(playerid,COLOR_LIGHTGREEN,"[SUCCESS]: You have successfully added a vehicle!");
}
else {
SendClientMessage(playerid,COLOR_CRIMSON,"[ERROR]: You are not in a vehicle!.");
}
return 1;
}
CMD:veh(playerid, params[])
{
new vehid;
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "i", vehid)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /veh [carid]");
else if (vehid < 400 || vehid > 611) SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: Invalid Car ID! [ Car ID's range from 400 - 611 ]");
else {
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(vehid, x + 3, y, z, 0, 0,0, -1);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[SUCCESS]: Car spawned at your location!");
}
return 1;
}
public AutoWeather()
{
new RandonWeather = random(15);
SetWeather(RandonWeather);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmd,"/createstrip",true) == 0)
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateStrip(plocx,plocy,plocz,ploca);
return 1;
}
else if (strcmp(cmd,"/removestrip",true) == 0)
{
DeleteClosestStrip(playerid);
return 1;
}
else if (strcmp(cmd,"/removeallstrip",true) == 0)
{
DeleteAllStrip();
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2341)
{
if(response)
{
if(listitem == 1)
{
GivePlayerMoney(playerid, 0);
SetPlayerArmour(playerid, 100);
}
if(listitem == 2)
{
GivePlayerMoney(playerid, 0);
GivePlayerWeapon(playerid, 24, 25000); //Desert Eagle
}
if(listitem == 3)
{
GivePlayerMoney(playerid, 0);
GivePlayerWeapon(playerid, 25, 10000); //Shotgun
}
if(listitem == 4)
{
GivePlayerMoney(playerid, 0);
GivePlayerWeapon(playerid, 29, 10000); //MP5
}
if(listitem == 5)
{
GivePlayerMoney(playerid, 0);
GivePlayerWeapon(playerid, 30, 10000); //AK-47
}
}
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",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Skin", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have successfully registered your account! Relog to save your stats! Thank you ","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]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have successfully logged in!","Ok","");
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_WHITE);
}
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;
}
//------------------------------------------ProxDetector---------------------------------------------
ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid)) {
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)) {
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) {
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) {
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) {
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) {
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) {
SendClientMessage(i, col5, string);
}
}
}
}
}
return 1;
}
//-------------------------------------STOCKS-------------------------------
stock strreplace(string[], find, replace)
{
for(new i=0; string[i]; i++) {
if(string[i] == find) {
string[i] = replace;
}
}
}
stock GetName(playerid)
{
new
pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}
stock LoadStaticVehiclesFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new var_from_line[64];
new vehicletype;
new Float:SpawnX;
new Float:SpawnY;
new Float:SpawnZ;
new Float:SpawnRot;
new Color1, Color2;
new index;
new vehicles_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr) return 0;
vehicles_loaded = 0;
while(fread(file_ptr,line,256) > 0) {
index = 0;
// Read type
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
vehicletype = strval(var_from_line);
if(vehicletype < 400 || vehicletype > 611) continue;
// Read X, Y, Z, Rotation
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnX = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnY = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnZ = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnRot = floatstr(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Color1 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
Color2 = strval(var_from_line);
//printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+vehicles_loaded+1,vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);
// respawn 30 minutes
AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ+1,SpawnRot,Color1,Color2,(30*60));
vehicles_loaded++;
}
fclose(file_ptr);
printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
return vehicles_loaded;
}
stock token_by_delim(const string[], return_str[], delim, start_index)
{
new x=0;
while(string[start_index] != EOS && string[start_index] != delim) {
return_str[x] = string[start_index];
x++;
start_index++;
}
return_str[x] = EOS;
if(string[start_index] == EOS) start_index = (-1);
return start_index;
}
stock IsRolePlayName(playerid, bool:alphaonly = true)
{
new trpn[MAX_PLAYER_NAME];
if(GetPlayerName(playerid,trpn,sizeof(trpn))) {
new strd = strfind(trpn, "_", false);
if(strfind(trpn,"_",false,strd+1) == -1) {
if(strd > 0) {
if(trpn[strd-1] && trpn[strd+1]) {
if(alphaonly) {
for(new a = 0, l = strlen(trpn); a < l; a++) {
switch(trpn[a]) {
case '0' .. '9': return 0;
case 'a' .. 'z': continue;
case 'A' .. 'Z': continue;
// easier than specifying every invalid char
case '_': continue;
default: return 0;
}
}
}
return 1;
}
}
}
}
C:\Documents and Settings\Luca\Desktop\BaseScript\gamemodes\base.pw n(1121) : error 001: expected token: "#endif", but found "-end of file-" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error. |
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#pragma tabsize 0
#if defined FILTERSCRIPT
#define WEAPONS 2341
#define PATH "/Database/%s.ini"
#define COLOR_GREY 0xAFAFAFAA
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define COLOR_FADE1 0xFFFFFFFF
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_LIGHTGREEN 0x90EE90FF
#define COLOR_MEDIUMPURPLE 0x9370DBFF
#define COLOR_GOLD 0xFFD700FF
#define COLOR_LIGHTSKYBLUE 0x87CEFAFF
#define COLOR_CRIMSON 0xDC143CFF
new bool: ooc;
forward AutoWeather();
enum pInfo
{
pPass,
pCash,
pAdminLevel,
pKills,
pDeaths,
pSkin
}
new iSpawnSet[MAX_PLAYERS];
new PlayerInfo[MAX_PLAYERS][pInfo];
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][pAdminLevel]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Skin", PlayerInfo[playerid][pSkin]);
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;
}
new ObjectFire; //global variable
/*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;
}
main()
{
print("\n----------------------------------");
print(" FCRP Gamemode by Gooday");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText("Fort Carson Roleplay");
DisableInteriorEnterExits();
ShowPlayerMarkers(0);
SetGameModeText("Fort Carson Roleplay");
SetTimer("AutoWeather", 600000, 1);
LoadStaticVehiclesFromFile("/Database/vehicles.txt");
AddPlayerClass(283, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(183, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(184, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(235, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(240, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(250, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(60, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(30, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddStaticPickup(1318, 1, 246.7839, 63.9001, 1004.1406, 0);
AddStaticPickup(1318, 1, -217.8443,979.1246,20.1040, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
AddPlayerClass(101, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(183, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(184, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(235, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(240, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(250, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(60, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(30, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
iSpawnSet[playerid] = 0;
SetupPlayerForClassSelection(playerid);
return 1;
}
forward SetupPlayerForClassSelection(playerid);
public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid, 258.4893, -41.4008, 1002.0234);
SetPlayerFacingAngle(playerid, 185.4673);
SetPlayerCameraPos(playerid, 256.0815, -43.0475, 1004.0234);
SetPlayerCameraLookAt(playerid, 258.4893, -41.4008, 1002.0234);
AddPlayerClass(101, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(170, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(183, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(184, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(235, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(240, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(250, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(60, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(30, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
CreateDynamicObject(970, -205.609650, 991.024109, 19.603674, 0.0000, 0.0000, 271.7189);
CreateDynamicObject(970, -205.678558, 995.182007, 19.648087, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -205.677200, 999.317383, 19.730896, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -205.682617, 1003.476685, 19.771322, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -207.270172, 1006.903809, 19.789442, 0.0000, 0.0000, 319.2972);
CreateDynamicObject(970, -210.938019, 1008.257202, 19.793669, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(970, -230.519119, 999.826172, 19.144413, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.519043, 995.703735, 19.128332, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.532074, 991.570923, 19.112217, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.516602, 987.408936, 19.118702, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.513962, 983.282959, 19.127382, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(970, -230.463608, 979.134949, 19.132366, 0.0000, 0.0000, 271.1688);
CreateDynamicObject(803, -226.136337, 1004.791809, 20.595205, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -223.304352, 1002.123108, 19.694927, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -206.406036, 988.999695, 19.543804, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -206.409195, 984.935669, 19.410149, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -214.281097, 1002.169006, 19.783312, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1216, -205.396805, 1002.670837, 19.406557, 0.0000, 0.0000, 90.0000);
CreateDynamicObject(1226, -229.728210, 991.873047, 22.389072, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(1226, -229.689285, 998.605774, 22.456175, 0.0000, 0.0000, 178.2812);
CreateDynamicObject(1437, -302.149200, 1040.584839, 19.979918, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(3886, -422.301697, 1168.756836, 0.071592, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(3886, -422.287476, 1158.649658, 0.071584, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(11505, -245.978912, 1217.520264, 23.140045, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -239.585754, 1212.757324, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -239.576202, 1220.454834, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -252.243210, 1212.759033, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1676, -252.305862, 1220.473145, 20.523056, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(16360, -269.659668, 1216.444824, 18.740452, 0.0000, 0.0000, 93.4377);
CreateDynamicObject(11417, -229.186646, 1209.988770, 23.616035, 0.0000, 0.0000, 135.0000);
CreateDynamicObject(1211, -246.413971, 1207.817505, 19.352993, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.490570, 1212.240601, 18.467503, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.500900, 1213.314697, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.505615, 1220.980469, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -241.510971, 1219.915405, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.806152, 1213.361572, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.776062, 1212.159058, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.873779, 1219.891968, 18.467514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(997, -253.827698, 1220.983398, 18.442514, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1226, -264.786865, 1210.297974, 22.616608, 0.0000, 0.0000, 181.7189);
CreateDynamicObject(1226, -247.575867, 1224.798584, 22.616608, 0.0000, 0.0000, 91.7189);
CreateDynamicObject(3167, -106.015465, 941.370239, 19.716732, 0.0000, 0.0000, 56.2500);
CreateDynamicObject(3168, -118.227112, 959.917969, 19.528189, 0.0000, 0.0000, 123.7499);
CreateDynamicObject(3168, -33.683365, 931.870850, 18.949020, 0.0000, 0.0000, 191.2500);
CreateDynamicObject(3169, -98.623184, 994.715454, 18.786861, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(3241, -101.528351, 1048.167236, 19.348783, 0.0000, 0.0000, 11.2500);
CreateDynamicObject(3242, -100.108063, 1028.102661, 20.666046, 0.0000, 0.0000, 191.2500);
CreateDynamicObject(3640, 45.976234, 1130.046631, 23.146557, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(3634, 29.924252, 1083.473389, 21.689949, 0.0000, 0.0000, 202.5000);
CreateDynamicObject(3639, -81.771729, 1051.507446, 23.140820, 0.0000, 0.0000, 90.0000);
CreateDynamicObject(3642, -77.740196, 1018.082092, 21.693289, 0.0000, 0.0000, 124.9871);
CreateDynamicObject(3655, -19.340351, 994.817139, 21.595230, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(3698, -155.119537, 1039.391602, 21.631117, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(3515, -297.682068, 1080.874268, 17.854595, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(869, -297.655914, 1080.949341, 19.208811, 0.0000, 0.0000, 33.7500);
CreateDynamicObject(869, -297.573517, 1080.903442, 19.208811, 0.0000, 0.0000, 326.2500);
CreateDynamicObject(869, -297.485077, 1080.860107, 19.208811, 0.0000, 0.0000, 11.2500);
CreateDynamicObject(869, -297.774139, 1080.716431, 19.208811, 0.0000, 0.0000, 326.2500);
CreateDynamicObject(869, -297.516479, 1080.543945, 19.208811, 0.0000, 0.0000, 101.2500);
CreateDynamicObject(869, -297.440887, 1080.594604, 19.208811, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(1280, -306.739929, 1081.020630, 19.143543, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1280, -306.776093, 1076.556885, 19.143543, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1280, -306.756409, 1085.285400, 19.143543, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -307.057251, 1073.529541, 19.306511, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(1215, -307.073792, 1088.203125, 19.306511, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(745, -290.232239, 1078.817749, 19.341095, 0.0000, 0.0000, 22.5000);
CreateDynamicObject(746, -289.108612, 1083.948608, 19.944870, 0.0000, 0.0000, 315.0000);
CreateDynamicObject(747, -291.517181, 1081.946289, 19.133242, 0.0000, 0.0000, 236.2501);
CreateDynamicObject(748, -291.720978, 1080.537720, 19.565540, 0.0000, 0.0000, 180.0000);
CreateDynamicObject(890, -288.950714, 1035.317261, 19.815779, 0.0000, 0.0000, 78.7500);
CreateDynamicObject(891, -287.613220, 1029.108154, 18.693661, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(892, -287.478577, 1022.784668, 18.736897, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -290.477509, 1031.934326, 19.230431, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -290.483734, 1019.135315, 19.235624, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(983, -290.509674, 1009.537659, 19.311314, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -296.971558, 1005.332581, 19.219604, 0.0000, 0.0000, 270.0000);
CreateDynamicObject(983, -305.952057, 1005.330994, 19.267479, 0.0000, 0.0000, 90.0000);
CreateDynamicObject(984, -309.168823, 1011.720703, 19.229378, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(984, -309.174988, 1024.533447, 19.249065, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(983, -309.136597, 1034.136963, 19.303673, 0.0000, 0.0000, 0.0000);
CreateDynamicObject(983, -309.174988, 1035.202881, 19.278120, 0.0000, 0.0000, 0.0000);
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"You are already registered, write your chosen password to log in! ","Login","Quit");
}
else {
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Welcome to Fort Carson Roleplay, Our database tell us your new here, chose your password to register!","Register","Quit");
}
if(!IsRolePlayName(playerid)) {
SendClientMessage(playerid, COLOR_CRIMSON, "[NORTON DEFENDER] - [KICKED]: Please come back and use a roleplay name. (Example: Jacob_Smith)");
Kick(playerid);
TogglePlayerClock(playerid, 1); // Show the clock
}
return 1;
}
{
new string[254];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s has joined the server!", playername);
SendClientMessageToAll(0xFFEE00, string);
//DONE
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][pAdminLevel]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Skin", PlayerInfo[playerid][pSkin]);
INI_Close(File);
return 1;
}
{
new string[254];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s Left the Server.", playername);
SendClientMessageToAll(0xFFEE00, string);
//DONE
return 1;
}
forward loz_SetPlayerSkin(playerid, skinid);
public loz_SetPlayerSkin(playerid, skinid) PlayerInfo[playerid][pSkin] = skinid;
#define loz_SetPlayerSkin SetPlayerSkin
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,-203.7558,1090.0508,19.7344);
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,"Welcome to Fort Carson!");
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,"You may will have a TOTAL-BLACK screen. RILOG for fix it (this happend JUST the first time).");
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
new pname[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, pname, sizeof(pname));
strreplace(pname, '_', ' ');
//This will show when player speaks FirstName_LastName says: test
format(str, sizeof(str), "%s : %s", pname, text);
ProxDetector(30.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
return 0;
}
//-----------------------COMMANDS-----------------------
CMD:ooc(playerid, params[])
{
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
strreplace(sendername, '_', ' ');
format(string, sizeof(string), "(OOC-G) %s: %s ", sendername, params);
SendClientMessageToAll(COLOR_GREY, string);
return 1;
}
CMD:setadmin(playerid, params[])
{
if(IsPlayerConnected(playerid)) {
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) {
new sendername[MAX_PLAYER_NAME];
new giveplayername[MAX_PLAYER_NAME];
new giveplayerid,level;
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
//u = username.
if (!sscanf(params, "ui", giveplayerid,level)) {
if (giveplayerid != INVALID_PLAYER_ID) {
new string[128];
format(string, sizeof(string), "[INFO]: Administrator %s has promoted you to level %d Administrator",sendername,level);
SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "[INFO]: You have promoted %s into level %d Administrator",giveplayername,level);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
PlayerInfo[giveplayerid][pAdminLevel] = level;
}
}
else SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX] :/setadmin [playerid] [level]");
}
}
return 1;
}
CMD:me(playerid, params[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
if(isnull(params))
return SendClientMessage(playerid,COLOR_LIGHTBLUE -1,"[SYNTAX]: /me [Action]");
format(str,sizeof(str),"*%s %s",name, params);
ProxDetector(30.0, playerid, str, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE, COLOR_LIGHTSKYBLUE);
return 1;
}
CMD:do(playerid, params[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
if(isnull(params))
return SendClientMessage(playerid,COLOR_LIGHTBLUE -1,"[SYNTAX]: /do [Environment]");
format(str,sizeof(str),"*%s ((%s))",params, name);
ProxDetector(30.0, playerid, str, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE, COLOR_MEDIUMPURPLE);
return 1;
}
CMD:o(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /o [local ooc chat]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "(OOC-L) %s: %s ", sendername, params);
ProxDetector(30.0, playerid, string, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY);
return 1;
}
CMD:meg(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /meg [Megaphone] *JUST COPS*");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "(MEGAPHONE) Officer %s: %s ", sendername, params);
ProxDetector(30.0, playerid, string, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON);
return 1;
}
CMD:apu(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /apu *JUST COPS*");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "This is the BCSD Pull Your Veichle over to the side of the Road NOW!", sendername, params);
ProxDetector(30.0, playerid, string, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON, COLOR_CRIMSON);
return 1;
}
CMD:sh(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /s [shout]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s shouts: %s!", sendername, params);
ProxDetector(30.0, playerid, string,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE,COLOR_LIGHTSKYBLUE,COLOR_FADE1,COLOR_FADE2);
return 1;
}
CMD:w(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"/w [Quiet Talk]");
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid,sendername,sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string,sizeof(string), "[WHISPER] %s: %s", sendername, params);
ProxDetector(3.0, playerid, string,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
return 1;
}
CMD:txt(playerid,params[])
{
new ID;
new PMstring[128]; //the PM
new string[128]; //string used for SendClientMessage
new Iname[MAX_PLAYER_NAME], Pname[MAX_PLAYER_NAME];
if (sscanf(params, "ds[128]", ID, PMstring)) {
SendClientMessage(playerid,COLOR_LIGHTBLUE,"[SYNTAX]: /txt ([ID] ([Message]");
return 1;
}
GetPlayerName(ID,Iname,sizeof(Iname));
GetPlayerName(playerid,Pname,sizeof(Pname));
format(string,128,"Text Message from %i[%s]: %s",playerid,Pname,PMstring);
SendClientMessage(ID,COLOR_LIGHTSKYBLUE,string);
format(string,128,"Text Message to %s: %s",Iname,PMstring);
SendClientMessage(playerid,COLOR_LIGHTSKYBLUE,string);
PlayerPlaySound(ID,1085,0.0,0.0,0.0);
return 1;
}
CMD:kick(playerid,params[])
{
new id,name1[MAX_PLAYER_NAME], reason[35],name2[MAX_PLAYER_NAME], string[128];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params,"uz",id,reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /kick [PlayerID/PartOfName] [Reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: Invalid Player ID");
else {
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
format(string, sizeof(string),"*** %s was kicked by %s, Reason: %s",name2,name1,reason);
SendClientMessageToAll(COLOR_CRIMSON,string);
Kick(id);
}
return 1;
}
CMD:ban(playerid, params[])
{
new id, reason[50], string[128], banned[MAX_PLAYER_NAME];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid,COLOR_LIGHTBLUE -1, "[SYNTAX]: /ban [PlayerID] [Reason]");
GetPlayerName(id, banned, sizeof(banned));
format(string, sizeof(string), "*** %s has been banned by %s. reason: %s", banned, GetName(playerid), reason);
SendClientMessageToAll(COLOR_CRIMSON, string);
BanEx(id, reason);
return 1;
}
CMD:acmds(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
SendClientMessage( playerid, COLOR_GOLD, " ..:Admin Command List:.. " );
SendClientMessage( playerid, COLOR_GOLD, "Moderator: /kick, /goto, /get" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Senior Moderator: /ban" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Administrator: /respawncars" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Lead Administrator:" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
SendClientMessage( playerid, COLOR_GOLD, "Community Founder: /setadmin, /veh, /addveh" );
SendClientMessage( playerid, COLOR_WHITE, "------------------------" );
return 1;
}
CMD:chat(playerid, params[])
{
SendClientMessage(playerid, COLOR_GOLD, "*****************************[COMMANDS:]***************************");
SendClientMessage(playerid, COLOR_WHITE, "[CHAT:] /ooc, /me, /do, /o, /pm, /w, /sh");
SendClientMessage(playerid, COLOR_GOLD, "***************************************************************************");
return true;
}
CMD:respawncars(playerid, o[], help)
{
#pragma unused o, help
for(new v = 0; v < MAX_VEHICLES; v++) {
SetVehicleToRespawn(v);
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 3) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
SendClientMessage(v, COLOR_LIGHTGREEN -1, "[SUCCESS]: All vehicles have been respawned");
}
return 1;
}
CMD:goto(playerid, params[])
{
new id, Float:Pos[3];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /goto [playerID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: That player is offline!");
GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1]+4, Pos[2]);
return 1;
}
CMD:get(playerid, params[])
{
new id, Float:Pos[3];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /get [PlayerID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: That player is offline!");
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(id, Pos[0], Pos[1]+4, Pos[2]);
return 1;
}
COMMAND:asetskin(playerid, params[])
{
new
id, skin, name[ MAX_PLAYER_NAME ], name2[ MAX_PLAYER_NAME ], str[ 128 ];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if( sscanf ( params, "ui", id, skin ) ) return SendClientMessage( playerid, COLOR_LIGHTBLUE -1,#[SYNTAX]: /asetskin [PlayerName/ID] [SkinModel]);
if( id == INVALID_PLAYER_ID ) return SendClientMessage( playerid,COLOR_CRIMSON -1, #Invalid player ID);
if(skin > 299 || skin < 1) return SendClientMessage(playerid, -1,#Wrong Skin ID! Available ID's: 1-299);
GetPlayerName( playerid, name, MAX_PLAYER_NAME ); GetPlayerName( id, name2, MAX_PLAYER_NAME );
format( str, sizeof ( str ),"[SUCCESS] You have set %s skin to model %d", name2, skin);
SendClientMessage( playerid, COLOR_LIGHTGREEN -1, str );
format( str, sizeof ( str ),"[SUCCESS] Your skin has been set to model %d by %s", skin, name);
SendClientMessage( id, COLOR_LIGHTGREEN -1, str );
SetPlayerSkin( id, skin );
return true;
}
COMMAND:enableooc(playerid, o[], help)
{
#pragma unused help
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
ooc = true;
SendClientMessageToAll(COLOR_CRIMSON -1,"[INFO]: OOC Chat has been enabled");
return 1;
}
COMMAND:disableooc(playerid, o[], help)
{
#pragma unused help
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 2) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(ooc == true) {
ooc = false;
SendClientMessageToAll(COLOR_CRIMSON -1,"[INFO]: OOC Chat has been disabled");
}
return 1;
}
CMD:addveh(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(IsPlayerInAnyVehicle(playerid)) {
new filestring[264],Float:X,Float:Y,Float:Z,Float:Rot;
GetPlayerPos(playerid,X,Y,Z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), Rot);
new vid = GetVehicleModel(GetPlayerVehicleID(playerid));
new File:pos=fopen("vehicles.txt", io_append);
format(filestring, 256, "\n%d,%f,%f,%f,%f,-1,-1 ;", vid, X, Y, Z, Rot);
fwrite(pos, filestring);
fclose(pos);
SendClientMessage(playerid,COLOR_LIGHTGREEN,"[SUCCESS]: You have successfully added a vehicle!");
}
else {
SendClientMessage(playerid,COLOR_CRIMSON,"[ERROR]: You are not in a vehicle!.");
}
return 1;
}
CMD:veh(playerid, params[])
{
new vehid;
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 5) return SendClientMessage(playerid, COLOR_CRIMSON,"[ERROR]: ACCESS DENIED");
if(sscanf(params, "i", vehid)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: /veh [carid]");
else if (vehid < 400 || vehid > 611) SendClientMessage(playerid, COLOR_CRIMSON, "[ERROR]: Invalid Car ID! [ Car ID's range from 400 - 611 ]");
else {
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(vehid, x + 3, y, z, 0, 0,0, -1);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[SUCCESS]: Car spawned at your location!");
}
return 1;
}
public AutoWeather()
{
new RandonWeather = random(15);
SetWeather(RandonWeather);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmd,"/createstrip",true) == 0) {
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateStrip(plocx,plocy,plocz,ploca);
return 1;
}
else if (strcmp(cmd,"/removestrip",true) == 0) {
DeleteClosestStrip(playerid);
return 1;
}
else if (strcmp(cmd,"/removeallstrip",true) == 0) {
DeleteAllStrip();
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2341) {
if(response) {
if(listitem == 1) {
GivePlayerMoney(playerid, 0);
SetPlayerArmour(playerid, 100);
}
if(listitem == 2) {
GivePlayerMoney(playerid, 0);
//Desert Eagle
GivePlayerWeapon(playerid, 24, 25000);
}
if(listitem == 3) {
GivePlayerMoney(playerid, 0);
//Shotgun
GivePlayerWeapon(playerid, 25, 10000);
}
if(listitem == 4) {
GivePlayerMoney(playerid, 0);
//MP5
GivePlayerWeapon(playerid, 29, 10000);
}
if(listitem == 5) {
GivePlayerMoney(playerid, 0);
//AK-47
GivePlayerWeapon(playerid, 30, 10000);
}
}
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",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Skin", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have successfully registered your account! Relog to save your stats! Thank you ","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]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have successfully logged in!","Ok","");
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_WHITE);
}
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;
}
//------------------------------------------ProxDetector---------------------------------------------
ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid)) {
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)) {
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) {
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) {
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) {
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) {
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) {
SendClientMessage(i, col5, string);
}
}
}
}
}
return 1;
}
//-------------------------------------STOCKS-------------------------------
stock strreplace(string[], find, replace)
{
for(new i=0; string[i]; i++) {
if(string[i] == find) {
string[i] = replace;
}
}
}
stock GetName(playerid)
{
new
pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}
stock LoadStaticVehiclesFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new var_from_line[64];
new vehicletype;
new Float:SpawnX;
new Float:SpawnY;
new Float:SpawnZ;
new Float:SpawnRot;
new Color1, Color2;
new index;
new vehicles_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr) return 0;
vehicles_loaded = 0;
while(fread(file_ptr,line,256) > 0) {
index = 0;
// Read type
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
vehicletype = strval(var_from_line);
if(vehicletype < 400 || vehicletype > 611) continue;
// Read X, Y, Z, Rotation
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnX = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnY = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnZ = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnRot = floatstr(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Color1 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
Color2 = strval(var_from_line);
//printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+vehicles_loaded+1,vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);
// respawn 30 minutes
AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ+1,SpawnRot,Color1,Color2,(30*60));
vehicles_loaded++;
}
fclose(file_ptr);
printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
return vehicles_loaded;
}
stock token_by_delim(const string[], return_str[], delim, start_index)
{
new x=0;
while(string[start_index] != EOS && string[start_index] != delim) {
return_str[x] = string[start_index];
x++;
start_index++;
}
return_str[x] = EOS;
if(string[start_index] == EOS) start_index = (-1);
return start_index;
}
stock IsRolePlayName(playerid, bool:alphaonly = true)
{
new trpn[MAX_PLAYER_NAME];
if(GetPlayerName(playerid,trpn,sizeof(trpn))) {
new strd = strfind(trpn, "_", false);
if(strfind(trpn,"_",false,strd+1) == -1) {
if(strd > 0) {
if(trpn[strd-1] && trpn[strd+1]) {
if(alphaonly) {
for(new a = 0, l = strlen(trpn); a < l; a++) {
switch(trpn[a]) {
case '0' .. '9': return 0;
case 'a' .. 'z': continue;
case 'A' .. 'Z': continue;
// easier than specifying every invalid char
case '_': continue;
default: return 0;
}
}
}
return 1;
}
}
}
}
#endif
#if defined SOMETHING
{
// do something
}
// you should add #endif here, to end the "if" structure.
pawn Код:
|