Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////
- //bLibrary v0.1a
- //Author : Ballu Miaa aka Char.C
- //Facebook : MCeeCharC
- // Twitter: IndianGz
- // Youtube Channel: IndianGz
- // SAMP Forums : Ballu Miaa
- // Site: www.excaliburgaming.net
- // CREDITS:
- //Ballu Miaa for developing this include.
- //Y_Less for telling me how to make params optional of a stock.
- //SA:MP Team for SA:MP
- //CHANGELOGS:
- // Updated include to v1.1 adding minor indentation and optimization!
- // NOTE:
- // 1. You are not allowed to remove/edit the credits.
- // 2. You are not allowed to make any changes to this include and re-release it.
- // 3. You are not allowed to sell this include.
- // 4. You are not allowed to call this include of you own.
- /*
- native SetPlayerCash(playerid, cash);
- native RemovePlayerCash(playerid, cash);
- native GivePlayerScore(playerid, score);
- native RemovePlayerScore(playerid, score);
- native GetVehicleIDByName(name[]);
- native getWeaponIDByName(name[]);
- native GetVehicleNameByModel(model);
- native GetWeaponNameByID(id);
- native GetPlayerNameEx(playerid);
- native TeleportPlayerToPlayer(playerid, targetid);
- native SetPlayerPosEx(playerid, Float:x ,Float:y,Float:z,Angle,interior,VirtualWorld);
- native KickAll();
- native BanAll();
- native FreezeAll();
- native UnfreezeAll();
- native Freeze(playerid);
- native Unfreeze(playerid);
- native GetPlayerIPEx(playerid);
- native TransferScoreFromPlayerToPlayer(playerid, targetid, ammount);
- native ExplodePlayer(playerid);
- native ExplodeAll();
- native Kill(playerid);
- native KillAll();
- native ShowMessage(playerid, caption[], info[]);
- */
- #include <a_samp>
- #include <a_players>
- #define COLOR_RED 0xFF1400FF
- #define COLOR_GREEN 0x00FF00FF
- #define COLOR_BLUE 0x00AFFFFF
- #define COLOR_YELLOW 0xFFFF00FF
- #define MSG_DLG 3232
- forward WaterChecking();
- static max_players;
- new bool:AlreadyInWater[MAX_PLAYERS];
- new WeaponNames[][32] = {
- {"Unarmed (Fist)"},
- {"Brass Knuckles"},
- {"Golf Club"},
- {"Night Stick"},
- {"Knife"},
- {"Baseball Bat"},
- {"Shovel"},
- {"Pool Cue"},
- {"Katana"},
- {"Chainsaw"},
- {"Purple Dildo"},
- {"Big White Vibrator"},
- {"Medium White Vibrator"},
- {"Small White Vibrator"},
- {"Flowers"},
- {"Cane"},
- {"Grenade"},
- {"Teargas"},
- {"Molotov"},
- {" "},
- {" "},
- {" "},
- {"Colt 45"},
- {"Colt 45 (Silenced)"},
- {"Desert Eagle"},
- {"Normal Shotgun"},
- {"Sawnoff Shotgun"},
- {"Combat Shotgun"},
- {"Micro Uzi (Mac 10)"},
- {"MP5"},
- {"AK47"},
- {"M4"},
- {"Tec9"},
- {"CountryRifle"},
- {"Sniper"},
- {"RocketLauncher"},
- {"Heat-Seeking Rocket Launcher"},
- {"Flamethrower"},
- {"Minigun"},
- {"Satchel Charge"},
- {"Detonator"},
- {"Spray Can"},
- {"Fire Extinguisher"},
- {"Camera"},
- {"Night Vision Goggles"},
- {"Infrared Vision Goggles"},
- {"Parachute"},
- {"Fake Pistol"}
- };
- new VehicleNames[212][] = {
- {"Landstalker"},
- {"Bravura"},
- {"Buffalo"},
- {"Linerunner"},
- {"Perrenial"},
- {"Sentinel"},
- {"Dumper"},
- {"Firetruck"},
- {"Trashmaster"},
- {"Stretch"},
- {"Manana"},
- {"Infernus"},
- {"Voodoo"},
- {"Pony"},
- {"Mule"},
- {"Cheetah"},
- {"Ambulance"},
- {"Leviathan"},
- {"Moonbeam"},
- {"Esperanto"},
- {"Taxi"},
- {"Washington"},
- {"Bobcat"},
- {"Mr Whoopee"},
- {"BF Injection"},
- {"Hunter"},
- {"Premier"},
- {"Enforcer"},
- {"Securicar"},
- {"Banshee"},
- {"Predator"},
- {"Bus"},
- {"Rhino"},
- {"Barracks"},
- {"Hotknife"},
- {"Trailer 1"},
- {"Previon"},
- {"Coach"},
- {"Cabbie"},
- {"Stallion"},
- {"Rumpo"},
- {"RC Bandit"},
- {"Romero"},
- {"Packer"},
- {"Monster"},
- {"Admiral"},
- {"Squalo"},
- {"Seasparrow"},
- {"Pizzaboy"},
- {"Tram"},
- {"Trailer 2"},
- {"Turismo"},
- {"Speeder"},
- {"Reefer"},
- {"Tropic"},
- {"Flatbed"},
- {"Yankee"},
- {"Caddy"},
- {"Solair"},
- {"Berkley's RC Van"},
- {"Skimmer"},
- {"PCJ-600"},
- {"Faggio"},
- {"Freeway"},
- {"RC Baron"},
- {"RC Raider"},
- {"Glendale"},
- {"Oceanic"},
- {"Sanchez"},
- {"Sparrow"},
- {"Patriot"},
- {"Quad"},
- {"Coastguard"},
- {"Dinghy"},
- {"Hermes"},
- {"Sabre"},
- {"Rustler"},
- {"ZR-350"},
- {"Walton"},
- {"Regina"},
- {"Comet"},
- {"BMX"},
- {"Burrito"},
- {"Camper"},
- {"Marquis"},
- {"Baggage"},
- {"Dozer"},
- {"Maverick"},
- {"News Chopper"},
- {"Rancher"},
- {"FBI Rancher"},
- {"Virgo"},
- {"Greenwood"},
- {"Jetmax"},
- {"Hotring"},
- {"Sandking"},
- {"Blista Compact"},
- {"Police Maverick"},
- {"Boxville"},
- {"Benson"},
- {"Mesa"},
- {"RC Goblin"},
- {"Hotring Racer A"},
- {"Hotring Racer B"},
- {"Bloodring Banger"},
- {"Rancher"},
- {"Super GT"},
- {"Elegant"},
- {"Journey"},
- {"Bike"},
- {"Mountain Bike"},
- {"Beagle"},
- {"Cropdust"},
- {"Stunt"},
- {"Tanker"},
- {"Roadtrain"},
- {"Nebula"},
- {"Majestic"},
- {"Buccaneer"},
- {"Shamal"},
- {"Hydra"},
- {"FCR-900"},
- {"NRG-500"},
- {"HPV1000"},
- {"Cement Truck"},
- {"Tow Truck"},
- {"Fortune"},
- {"Cadrona"},
- {"FBI Truck"},
- {"Willard"},
- {"Forklift"},
- {"Tractor"},
- {"Combine"},
- {"Feltzer"},
- {"Remington"},
- {"Slamvan"},
- {"Blade"},
- {"Freight"},
- {"Streak"},
- {"Vortex"},
- {"Vincent"},
- {"Bullet"},
- {"Clover"},
- {"Sadler"},
- {"Firetruck LA"},
- {"Hustler"},
- {"Intruder"},
- {"Primo"},
- {"Cargobob"},
- {"Tampa"},
- {"Sunrise"},
- {"Merit"},
- {"Utility"},
- {"Nevada"},
- {"Yosemite"},
- {"Windsor"},
- {"Monster A"},
- {"Monster B"},
- {"Uranus"},
- {"Jester"},
- {"Sultan"},
- {"Stratum"},
- {"Elegy"},
- {"Raindance"},
- {"RC Tiger"},
- {"Flash"},
- {"Tahoma"},
- {"Savanna"},
- {"Bandito"},
- {"Freight Flat"},
- {"Streak Carriage"},
- {"Kart"},
- {"Mower"},
- {"Duneride"},
- {"Sweeper"},
- {"Broadway"},
- {"Tornado"},
- {"AT-400"},
- {"DFT-30"},
- {"Huntley"},
- {"Stafford"},
- {"BF-400"},
- {"Newsvan"},
- {"Tug"},
- {"Trailer 3"},
- {"Emperor"},
- {"Wayfarer"},
- {"Euros"},
- {"Hotdog"},
- {"Club"},
- {"Freight Carriage"},
- {"Trailer 3"},
- {"Andromada"},
- {"Dodo"},
- {"RC Cam"},
- {"Launch"},
- {"Police Car (LSPD)"},
- {"Police Car (SFPD)"},
- {"Police Car (LVPD)"},
- {"Police Ranger"},
- {"Picador"},
- {"S.W.A.T. Van"},
- {"Alpha"},
- {"Phoenix"},
- {"Glendale"},
- {"Sadler"},
- {"Luggage Trailer A"},
- {"Luggage Trailer B"},
- {"Stair Trailer"},
- {"Boxville"},
- {"Farm Plow"},
- {"Utility Trailer"}
- };
- stock SetPlayerCash(playerid, cash)
- {
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, cash);
- }
- stock RemovePlayerCash(playerid, cash)
- {
- GivePlayerMoney(playerid, -cash);
- }
- stock GivePlayerScore(playerid, score)
- {
- SetplayerScore(playerid, GetPlayerScore(playerid) + score);
- }
- stock RemovePlayerScore(playerid, score)
- {
- SetPlayerScore(playerid, GetPlayerScore(playerid) - score);
- }
- stock GetVehicleIDByName(name[])
- {
- for(new i = 0;i<sizeof(VehicleNames);i++)
- {
- if(!strcmp(VehicleNames[i],name,true))
- {
- return i +400;
- }
- }
- return -1;
- }
- stock GetWeaponIDByName(name[])
- {
- for(new i = 0;i<sizeof(WeaponNames);i++)
- {
- if(!strcmp(WeaponNames[i],name,true))
- {
- return i;
- }
- }
- return -1;
- }
- stock GetVehicleNameByModel(model)
- {
- new string[32];
- format(string,sizeof string,"%s",VehicleNames[model -400]);
- return string;
- }
- stock GetWeaponNameByID(id)
- {
- new string[32];
- format(string,sizeof string,"%s",WeaponNames[id]);
- return string;
- }
- stock GetPlayerNameEx(playerid)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- return pName;
- }
- stock SetPlayerPosEx(playerid, Float:x ,Float:y,Float:z,Float:a,interior = 0,vw = 0)
- {
- SetPlayerPos(playerid , x , y ,z);
- SetPlayerFacingAngle(playerid, a);
- SetPlayerInterior(playerid, interior);
- SetPlayerVirtualWorld(playerid, vw);
- return 1;
- }
- stock KickAll()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(admins == 0 && !IsPlayerAdmin(i)) continue;
- Kick(i);
- }
- }
- stock BanAll()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(admins == 0 && !IsPlayerAdmin(i)) continue;
- Ban(i);
- }
- }
- stock FreezeAll()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(admins == 0 && !IsPlayerAdmin(i)) continue;
- TogglePlayerControllable(i, 0);
- }
- }
- stock UnfreezeAll()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(admins == 0 && !IsPlayerAdmin(i)) continue;
- TogglePlayerControllable(i, 1);
- }
- }
- stock Freeze(playerid)
- {
- TogglePlayerControllable(playerid, 0);
- }
- stock Unfreeze(playerid)
- {
- TogglePlayerControllable(playerid, 1);
- }
- stock GetPlayerIPEx(playerid)
- {
- new pIP[32];
- GetPlayerIp(playerid,ip,sizeof ip);
- return pIP;
- }
- stock Explode(playerid)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- CreateExplosion(X, Y, Z, 7, 100.0);
- }
- stock ExplodeAll()
- {
- new Float:X, Float:Y, Float:Z;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- GetPlayerPos(i, X, Y, Z);
- CreateExplosion(X, Y, Z, 7, 100.0);
- }
- }
- stock Kill(playerid)
- {
- SetPlayerHealth(playerid, 0);
- }
- stock KillAll()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- SetPlayerHealth(i, 0);
- }
- }
- stock ShowMessage(playerid, caption[], info[])
- {
- ShowPlayerDialog(playerid, MSG_DLG, DIALOG_STYLE_MSGBOX, caption, info, "OK", "OK");
- }
- public OnGameModeInit()
- {
- max_players = GetMaxPlayers();
- SetTimer("WaterChecking", 1000, true);
- return CallLocalFunction("H_OnGameModeInit","");
- }
- public WaterChecking()
- {
- for(new i = 0; i < max_players; i++)
- {
- if(IsPlayerConnected(i) && !IsPlayerNPC(i))
- {
- if(PlayerInWater(i))
- {
- if(!AlreadyInWater[i])
- {
- CallLocalFunction("OnPlayerEnterWater", "d", "playerid");
- AlreadyInWater[i] = true;
- }
- }
- else
- {
- AlreadyInWater[i] = false;
- }
- }
- }
- return 1;
- }
- PlayerInWater(playerid)
- {
- new animlib[32],tmp[32];
- GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
- if(!strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid)) return true;
- return false;
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit H_OnGameModeInit
- forward H_OnGameModeInit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement