Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_vcmp>
- #include <core>
- #include <float>
- static szGameModeName[128] = "fs 1.0"; //fag script
- static szGameModeAuthorName[128] = "[EAF]SpiralRock";
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define INACTIVE_PLAYER_ID 255
- #define MAX_WEAPONS 61
- new wep_init = 0;
- new gWeapons[MAX_WEAPONS][64];
- new gPlayers[MAX_PLAYERS][MAX_PLAYER_NAME+1];
- #define PI 3.1415926535897932384626433832795
- public Float:findDistance (Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2);
- //------------------------------------------------------------------------------------------------------
- main()
- {
- print("\n ----------------------------------\n");
- printf(" %s\n",szGameModeName);
- printf(" \tby %s\n",szGameModeAuthorName);
- print(" ----------------------------------\n");
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerConnect(playerid)
- {
- SetWaterLevel(6.0);
- SetGamespeed(100);
- SetGravity(100);
- GetPlayerName(playerid,gPlayers[playerid],MAX_PLAYER_NAME);
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
- {
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new tmp[256];
- new szMsg[256];
- new idx, newvar;
- new Float:x, Float:y, Float:z;
- cmd = strtok(cmdtext, idx);
- if (strcmp(cmd, "hp", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) {
- GetPlayerHealth(playerid,x);
- GetPlayerArmour(playerid,y);
- if (IsPlayerInAnyVehicle(playerid))
- {
- GetVehicleHealth(GetPlayerVehicleID(playerid),z);
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.0f - Armour %.0 Vehicle Health %.0f",playerid,gPlayers[playerid],x,y,z);
- } else {
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.1f - Armour %.1f",playerid,gPlayers[playerid],x,y);
- }
- SendClientMessageToAll(COLOR_GREEN, szMsg);
- } else {
- newvar = FindPlayerIDFromString(tmp);
- if (newvar != INACTIVE_PLAYER_ID) {
- GetPlayerHealth(newvar,x);
- GetPlayerArmour(newvar,y);
- if (IsPlayerInAnyVehicle(newvar))
- {
- GetVehicleHealth(GetPlayerVehicleID(newvar),z);
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.0f - Armour %.0 Vehicle Health %.0f",newvar,gPlayers[newvar],x,y,z);
- } else {
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.0f - Armour %.0f",newvar,gPlayers[newvar],x,y); }
- SendClientMessageToAll(COLOR_GREEN, szMsg);
- }
- }
- return 1;
- }
- if (strcmp(cmd, "driveonwater", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- SetPlayerDriveOnWater(1);
- format(szMsg,sizeof(szMsg),"Drive On Water SET ON");
- } else {
- format(szMsg,sizeof(szMsg),"Drive On Water SET OFF");
- SetPlayerDriveOnWater(0);
- }
- SendClientMessage(playerid, COLOR_GREEN, szMsg);
- return 1;
- }
- else if (strcmp(cmd, "shootinair", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- EnableShootInAir(255,1);
- format(szMsg,sizeof(szMsg),"Shoot In Air Enabled");
- } else {
- format(szMsg,sizeof(szMsg),"Shoot In Air Disabled");
- EnableShootInAir(255,0);
- }
- SendClientMessage(playerid, COLOR_GREEN, szMsg);
- return 1;
- }
- else if (strcmp(cmd, "stuntbike", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- EnableStuntBike(255,1);
- format(szMsg,sizeof(szMsg),"Stuntbike Enabled");
- } else {
- format(szMsg,sizeof(szMsg),"Stuntbike Disabled");
- EnableStuntBike(255,0);
- }
- SendClientMessage(playerid, COLOR_GREEN, szMsg);
- return 1;
- }
- else if (strcmp(cmd, "flycar", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- Flyingcars(1);
- } else {
- Flyingcars(0);
- }
- return 1;
- }
- else if (strcmp(cmd, "taxi", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- format(szMsg,sizeof(szMsg),"TaxiBoost Enabled");
- Taxiboostjump(1);
- } else {
- format(szMsg,sizeof(szMsg),"TaxiBoost Disabled");
- Taxiboostjump(0);
- }
- SendClientMessage(playerid, COLOR_GREEN, szMsg);
- return 1;
- }
- else if (strcmp(cmd, "fastswitch", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- FastSwitch(1);
- } else {
- FastSwitch(0);
- }
- return 1;
- }
- else if (strcmp(cmd, "jumpswitch", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- Jumpswitch(1);
- } else {
- Jumpswitch(0);
- }
- return 1;
- }
- else if (strcmp(cmd, "heal", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) { newvar = playerid; }
- else { newvar = FindPlayerIDFromString(tmp); }
- if (newvar == INACTIVE_PLAYER_ID) { return 1; }
- if (IsPlayerInAnyVehicle(newvar)) {
- SetVehicleHealth(GetPlayerVehicleID(newvar),1000.0);
- SetVehicleTyre(GetPlayerVehicleID(newvar),1);
- SetPlayerHealth(newvar,100.0);
- } else {
- SetPlayerHealth(newvar,100.0);
- }
- return 1;
- }
- else if (strcmp(cmd, "armour", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) { newvar = playerid; }
- else { newvar = FindPlayerIDFromString(tmp); }
- if (newvar == INACTIVE_PLAYER_ID) { return 1; }
- SetPlayerArmour(newvar,100.0);
- return 1;
- }
- else if (strcmp(cmd, "wep", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- new len = strlen(tmp);
- if (!len) { format(szMsg,sizeof(szMsg),"Usage: !wep <name/id>",tmp);SendClientMessage(playerid, COLOR_GREY, szMsg);return 1;}
- newvar = FindWepIDFromString(tmp);
- if (newvar != 0) { SetPlayerWeapon(playerid,newvar,10000); }
- return 1;
- }
- return 0;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerText(playerid, cmdtext[])
- {
- new cmd[256];
- new tmp[256];
- new szMsg[256];
- new idx, newvar;
- new Float:x, Float:y, Float:z;
- cmd = strtok(cmdtext, idx);
- if (strcmp(cmd, "!goto", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- new len = strlen(tmp);
- if (!len) { format(szMsg,sizeof(szMsg),"Usage: !goto <name/id>",tmp);
- SendClientMessage(playerid, COLOR_GREY, szMsg);return 1;}
- newvar = FindPlayerIDFromString(tmp);
- if (newvar != INACTIVE_PLAYER_ID) {
- GetPlayerPos(newvar,x,y,z);
- SetPlayerPos(playerid,x,y + 1.0,z,0,0);
- format(szMsg,sizeof(szMsg),"Taking [%i] %s to [%i] %s.",playerid,gPlayers[playerid],newvar,gPlayers[newvar]);
- SendClientMessageToAll(COLOR_GREEN, szMsg);
- }
- return 1;
- }
- else if (strcmp(cmd, "!hp", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) {
- GetPlayerHealth(playerid,x);
- GetPlayerArmour(playerid,y);
- if (IsPlayerInAnyVehicle(playerid))
- {
- GetVehicleHealth(GetPlayerVehicleID(playerid),z);
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.0f - Armour %.0 Vehicle Health %.0f",playerid,gPlayers[playerid],x,y,z);
- } else {
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.1f - Armour %.1f",playerid,gPlayers[playerid],x,y);
- }
- SendClientMessageToAll(COLOR_GREEN, szMsg);
- } else {
- newvar = FindPlayerIDFromString(tmp);
- if (newvar != INACTIVE_PLAYER_ID) {
- GetPlayerHealth(newvar,x);
- GetPlayerArmour(newvar,y);
- if (IsPlayerInAnyVehicle(newvar))
- {
- GetVehicleHealth(GetPlayerVehicleID(newvar),z);
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.0f - Armour %.0 Vehicle Health %.0f",newvar,gPlayers[newvar],x,y,z);
- } else {
- format(szMsg,sizeof(szMsg),"[%i] %s - Health %.0f - Armour %.0f",newvar,gPlayers[newvar],x,y); }
- SendClientMessageToAll(COLOR_GREEN, szMsg);
- }
- }
- return 1;
- }
- else if (strcmp(cmd, "!heal", true) == 0)
- {
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) { newvar = playerid; }
- else { newvar = FindPlayerIDFromString(tmp); }
- if (newvar == INACTIVE_PLAYER_ID) { return 1; }
- if (IsPlayerInAnyVehicle(newvar)) {
- SetVehicleHealth(GetPlayerVehicleID(newvar),1000.0);
- SetVehicleTyre(GetPlayerVehicleID(newvar),1);
- format(szMsg,sizeof(szMsg),"You are now healed",tmp);
- SendClientMessage(playerid,COLOR_GREEN, szMsg);
- } else {
- SetPlayerHealth(newvar,100.0);
- format(szMsg,sizeof(szMsg),"You are now healed",tmp);
- SendClientMessage(playerid,COLOR_GREEN, szMsg);
- }
- return 1;
- }
- else if (strcmp(cmd, "!buy", true) == 0) {
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp))
- return SendClientMessage(playerid, COLOR_RED, "!buy <wep-name>");
- else
- if (strcmp(tmp, "m60", true) == 0) {
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerSpawn(playerid,classid,teamid)
- {
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerRequestClass(playerid, classid, skinid)
- {
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPickedUp(pickupid, playerid)
- { if ((pickupid==1) || pickupid==2)
- SendClientMessage(playerid,COLOR_YELLOW,"Hey, you can buy guns here");
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnGameModeInit()
- {
- SetGameModeText(szGameModeName);
- ShowPlayerMarkers(1);
- // Player Classes
- AddPlayerClassEx(1, 149, -500.0569, -465.1577, 11.4867, 0.7182, 17, 500, 24, 500, 21, 500); // 149 green
- AddPlayerClassEx(0, 141, -374.1536, -223.0066, 9.1213, 183.0354, 17, 500, 24, 500, 21, 500); //141 blue
- SetPlayerFriendlyFire(false);
- Jumpswitch(1);
- // Vehicles
- //Police
- AddStaticVehicle(156, -715.1685, -482.2235, 10.8822, 0.9519, 3, 1);
- AddStaticVehicle(156, -714.9229, -497.0534, 10.8654, 0.9236, 3, 1);
- AddStaticVehicle(156, -183.8194, -465.4719, 10.8446, 10.8470, 3, 1);
- AddStaticVehicle(156, -181.0072, -480.6185, 10.8508, 9.8620, 3, 1);
- //Enforcers
- AddStaticVehicle(157, -715.0520, -489.2520, 10.8733, 0.9514, 3, 1);
- AddStaticVehicle(157, -182.3127, -473.3688, 10.8385, 10.8059, 3, 1);
- //Team green vehicles
- AddStaticVehicle(133, -539.4441, -474.2635, 11.1189, 270.2599, 44, 1);
- AddStaticVehicle(143, -520.8994, -474.1699, 11.1477, 272.4575, 44, 1);
- AddStaticVehicle(149, -497.1541, -473.3339, 11.1770, 272.5067, 44, 1);
- AddStaticVehicle(154, -470.2748, -472.9805, 11.0522, 273.4655, 44, 1);
- AddStaticVehicle(152, -457.6939, -464.3488, 11.0436, 359.1348, 44, 1);
- AddStaticVehicle(198, -475.5645, -434.3491, 11.4980, 180.2597, 44, 1);
- AddStaticVehicle(198, -469.9465, -432.6784, 11.4211, 186.8397, 44, 1);
- //Team Blue vehicles
- AddStaticVehicle(133, -467.0890, -244.5312, 10.3687, 268.6380, 2, 1);
- AddStaticVehicle(143, -439.0008, -241.7432, 10.3688, 267.9733, 2, 1);
- AddStaticVehicle(149, -430.7938, -253.1322, 10.5549, 182.3609, 2, 1);
- AddStaticVehicle(154, -415.0505, -245.8516, 10.5152, 91.1488, 2, 1);
- AddStaticVehicle(152, -414.5432, -259.7456, 10.9684, 90.4392, 2, 1);
- AddStaticVehicle(198, -405.4318, -311.1410, 11.0946, 185.1944, 2, 1);
- AddStaticVehicle(198, -411.9401, -312.0182, 11.2288, 185.1944, 2, 1);
- /*
- AddStaticPickup(id, type, Float:x, Float:y, Float:z, ammo, respawnseconds);
- -for cash pickups use type 501
- -use -1 for respawnseconds to select default respawn 4 minutes
- * may ditch the manual id arg and have it auto id instead *
- */
- new sp=1;
- //Team Green pickups
- AddStaticPickup(sp++, 405, -488.4050, -421.6337, 11.4306); //gunbox
- //Team Blue pickups
- AddStaticPickup(sp++, 405, -392.9321,-279.0997,10.6587); //gunbox
- SetWorldBounds(5000.0,-5000.0,5000.0,-5000.0);
- SetCameraPos(-231.4, -440.0, 32.1);
- SetCameraLookAt(-232.0314, -442.6181, 33.1);
- SetPlayerStartPos(-232.0314, -442.6181, 32.7944);
- new q,c=0;
- for (q=0;q < MAX_PLAYERS; q++) {
- if (IsPlayerConnected(q)) {
- new pname[MAX_PLAYER_NAME+1];
- GetPlayerName(q,pname,MAX_PLAYER_NAME);
- gPlayers[q] = pname;
- c++;
- } else { gPlayers[q] = ""; }
- }
- InitWepList();
- printf("\n\n**\tscript init loaded\t**\n**\t%d players\t**\n",c);
- new szMessage[256];
- format(szMessage,256,"Game Mode %s loaded.",szGameModeName);
- SendClientMessageToAll(COLOR_GREY, szMessage);
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public findDistance (x1,y1,z1,x2,y2,z2) {
- new Float:distance;
- distance = floatsqroot(floatpower(x1-x2, 2) + floatpower(y1-y2, 2) + floatpower(z1-z2, 2));
- return distance;
- }
- public FindPlayerIDFromString(string[])
- {// for determining player id from a string -bakasan
- new szMsg[256];
- new player = INACTIVE_PLAYER_ID;
- new p = 0;
- while (p < MAX_PLAYERS) { if (strfind(gPlayers[p],string,true) != -1) { player=p;break; } p++; }
- if (player == INACTIVE_PLAYER_ID) {// string didnt match so check if it can be an id
- if ((strlen(string) > 2) || (isnumeric(string) == 0)) {
- format(szMsg,sizeof(szMsg),"Unable to find %s.",string);
- SendClientMessageToAll(COLOR_GREY, szMsg);
- return INACTIVE_PLAYER_ID;
- }
- player = strval(string);// string is numeric and not more than 2 digits
- }
- if (!IsPlayerConnected(player)) {
- format(szMsg,sizeof(szMsg),"Invalid ID %d.",player);
- SendClientMessageToAll(COLOR_GREY, szMsg);
- return INACTIVE_PLAYER_ID;
- }
- return player;// valid id found
- }
- //------------------------------------------------------------------------------------------------------
- public InitWepList()
- {
- if (wep_init == 1) { return 1; }
- gWeapons[0] = "Fist";
- gWeapons[1] = "BrassKnuckle";
- gWeapons[2] = "ScrewDriver";
- gWeapons[3] = "GolfClub";
- gWeapons[4] = "NightStick";
- gWeapons[5] = "Knife";
- gWeapons[6] = "BaseballBat";
- gWeapons[7] = "Hammer";
- gWeapons[8] = "Cleaver";
- gWeapons[9] = "Machete";
- gWeapons[10] = "Katana";
- gWeapons[11] = "Chainsaw";
- gWeapons[12] = "Grenade";
- gWeapons[13] = "RemoteGrenade";
- gWeapons[14] = "TearGas";
- gWeapons[15] = "Molotov";
- gWeapons[16] = "Missile";//called "Rocket" in weapon.dat
- gWeapons[17] = "Colt45";
- gWeapons[18] = "Python";
- gWeapons[19] = "Shotgun";
- gWeapons[20] = "Spaz";//Spas12Shotgun
- gWeapons[21] = "Stubby";//StubbyShotgun
- gWeapons[22] = "Tec9";
- gWeapons[23] = "Uzi";
- gWeapons[24] = "Ingrams";
- gWeapons[25] = "MP5";
- gWeapons[26] = "M4";
- gWeapons[27] = "Ruger";
- gWeapons[28] = "SniperRifle";
- gWeapons[29] = "LaserScope";
- gWeapons[30] = "RocketLauncher";
- gWeapons[31] = "FlameThrower";
- gWeapons[32] = "M60";
- gWeapons[33] = "Minigun";
- gWeapons[34] = "none34";
- gWeapons[35] = "Heli-Cannon";
- gWeapons[36] = "none36";
- gWeapons[37] = "none37";
- gWeapons[38] = "none38";
- gWeapons[39] = "Vehicle";
- gWeapons[40] = "none40";
- gWeapons[41] = "41";
- gWeapons[42] = "none42";
- gWeapons[43] = "Drowned";
- gWeapons[44] = "Impact";
- gWeapons[45] = "none45";
- gWeapons[46] = "none46";
- gWeapons[47] = "none47";
- gWeapons[48] = "none48";
- gWeapons[49] = "none49";
- gWeapons[50] = "none50";
- gWeapons[51] = "none51";
- gWeapons[52] = "none52";
- gWeapons[53] = "none53";
- gWeapons[54] = "none54";
- gWeapons[55] = "none55";
- gWeapons[56] = "none56";
- gWeapons[57] = "none57";
- gWeapons[58] = "none58";
- gWeapons[59] = "none59";
- gWeapons[60] = "Heli-Blades";
- wep_init = 1;
- return 1;
- }
- public FindWepIDFromString(string[])
- {// for determining weapon id from a string -bakasan
- if (wep_init == 0) { InitWepList(); }
- new szMsg[256];
- new match = 0;
- new p = 0;
- while (p < MAX_WEAPONS) { if (strfind(gWeapons[p],string,true) != -1) { match=p;break; } p++; }
- if (match == 0) {// string didnt match so check if it can be an id
- if ((strlen(string) > 2) || (isnumeric(string) == 0)) {
- format(szMsg,sizeof(szMsg),"Unable to find weapon %s.",string);
- SendClientMessageToAll(COLOR_GREY, szMsg);
- return 0;
- }
- match = strval(string);// string is numeric and not more than 2 digits
- }
- if ((match < 1) || (match > 33)) {
- format(szMsg,sizeof(szMsg),"Invalid Weapon ID %d.",match);
- SendClientMessageToAll(COLOR_GREY, szMsg);
- return 0;
- }
- return match;// valid id found
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' ')){ index++; }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- isnumeric(const string[])
- {// mike's function
- for (new i = 0, j = strlen(string); i < j; i++) { if (string[i] > '9' || string[i] < '0') return 0; }
- return 1;
- }
Add Comment
Please, Sign In to add comment