Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- CPF Include - Custom Player Functions
- Uncomplicated Way To Program!
- Author: FuneraL
- Release Date: 13/05/2013 (05/13/2013 MM/DD/AAAA)
- Native Functions:
- SetPlayerPosEx(playerid, PosX, PosY, PosZ, Int, World);
- GetPlayerDataPos(playerid);
- SetPlayerAllStats(playerid, Score, Money, Health, Armour, Name);
- GetPlayerAllStats(playerid);
- SetPlayerCustomHP(playerid, Health, Armour);
- GiveVehicleForPlayer(playerid, Vehicleid, Angle, VehicleColor, VehicleColor2, Respawn_Delay);
- RemoveVehicleForPlayer(playerid);
- SetPlayerVehiclePosEx(playerid, PosX, PosY, PosZ, Int, World);
- GivePlayerWeaponKit(playerid, Weapon, Weapon_Ammo, Weapon2, Weapon_Ammo2, Weapon3, Weapon_Ammo3);
- SetPlayerWeatherEx(playerid, Hour, Weather);
- GetGunName(gunid);
- GetPlayerGunName(playerid);
- */
- #if defined _CPF_included
- #endif
- #define _CPF_included
- #pragma library CPF
- #include <a_samp>
- #define CPF_Function::%0(%1) stock %0(%1)
- new CPF_Vehicle[MAX_PLAYERS];
- CPF_Function::SetPlayerPosEx(playerid, Float:pX, Float:pY, Float:pZ, interior = 0, world = 0) {
- SetPlayerPos(playerid, pX, pY, pZ);
- SetPlayerInterior(playerid, interior);
- SetPlayerVirtualWorld(playerid, world);
- return true;
- }
- CPF_Function::GetPlayerDataPos(playerid) {
- new Float:pX, Float:pY, Float:pZ, CPF_String[120];
- GetPlayerPos(playerid, pX, pY, pZ);
- format(CPF_String, sizeof(CPF_String), "Information Database ->\nPosition: X: %.0f, Y: %.0f, Z: %.0f\nInterior: %d\nWorld: %d", pX, pY, pZ, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
- return CPF_String;
- }
- CPF_Function::SetPlayerAllStats(playerid, score = 0, money = 0, Float:health, Float:armour, name[]) {
- SetPlayerScore(playerid, score);
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, money);
- SetPlayerHealth(playerid, health);
- SetPlayerArmour(playerid, armour);
- SetPlayerName(playerid, name);
- return true;
- }
- CPF_Function::GetPlayerAllStats(playerid) {
- new score, money, Float:health, Float:armour, name[24], CPF_String[200];
- GetPlayerHealth(playerid, health);
- GetPlayerArmour(playerid, armour);
- GetPlayerName(playerid, name, 24);
- format(CPF_String, sizeof(CPF_String), "Information Database ->\nPlayer Score: %d\nPlayer Money: %d\nPlayer Health: %.0f\nPlayer Armour: %.0f\nPlayer Name: %s", score, money, health, armour, name);
- return CPF_String;
- }
- CPF_Function::SetPlayerCustomHP(playerid, Float:health, Float:armour) {
- SetPlayerHealth(playerid, health);
- SetPlayerArmour(playerid, armour);
- return true;
- }
- CPF_Function::GiveVehicleForPlayer(playerid, vehicleid, Float:vehicleangle, vehiclecolor = 0, vehiclecolor2 = 0, respawndelay) {
- new Float:pX, Float:pY, Float:pZ;
- GetPlayerPos(playerid, pX, pY, pZ);
- GetPlayerFacingAngle(playerid, vehicleangle);
- CPF_Vehicle[playerid] = CreateVehicle(vehicleid, pX, pY, pZ, vehicleangle, vehiclecolor, vehiclecolor2, respawndelay);
- PutPlayerInVehicle(playerid, CPF_Vehicle[playerid], 0);
- return true;
- }
- CPF_Function::RemoveVehicleForPlayer(playerid) {
- DestroyVehicle(CPF_Vehicle[playerid]);
- return true;
- }
- CPF_Function::SetPlayerVehiclePosEx(playerid, Float:pX, Float:pY, Float:pZ, interior = 0, world = 0) {
- SetVehiclePos(CPF_Vehicle[playerid], pX, pY, pZ);
- LinkVehicleToInterior(CPF_Vehicle[playerid], interior);
- SetVehicleVirtualWorld(CPF_Vehicle[playerid], world);
- return true;
- }
- CPF_Function::GivePlayerWeaponKit(playerid, weapon1, weapon_ammo1, weapon2, weapon_ammo2, weapon3, weapon_ammo3) {
- GivePlayerWeapon(playerid, weapon1, weapon_ammo1);
- GivePlayerWeapon(playerid, weapon2, weapon_ammo2);
- GivePlayerWeapon(playerid, weapon3, weapon_ammo3);
- return true;
- }
- CPF_Function::SetPlayerWeatherEx(playerid, hour = 0, weather = 0) {
- SetPlayerTime(playerid, hour, hour);
- SetPlayerWeather(playerid, weather);
- return true;
- }
- CPF_Function::GetGunName(gunid) {
- new CPF_GunName[50];
- switch(gunid) {
- case 0: CPF_GunName = "INVALID_WEAPON_ID";
- case 1: CPF_GunName = "Brass Knuckles";
- case 2: CPF_GunName = "Golf Club";
- case 3: CPF_GunName = "Nightstick";
- case 4: CPF_GunName = "Knife";
- case 5: CPF_GunName = "Baseball Bat";
- case 6: CPF_GunName = "Shovel";
- case 7: CPF_GunName = "Pool Cue";
- case 8: CPF_GunName = "Katana";
- case 9: CPF_GunName = "Chainsaw";
- case 10: CPF_GunName = "Double-ended Dildo";
- case 11: CPF_GunName = "Dildo";
- case 12: CPF_GunName = "Vibrator";
- case 13: CPF_GunName = "Silver Vibrator";
- case 14: CPF_GunName = "Flowers";
- case 15: CPF_GunName = "Cane";
- case 16: CPF_GunName = "Grenade";
- case 17: CPF_GunName = "Tear Gas";
- case 18: CPF_GunName = "Molotov Cocktail";
- case 19: CPF_GunName = "INVALID_WEAPON_ID";
- case 20: CPF_GunName = "INVALID_WEAPON_ID";
- case 21: CPF_GunName = "INVALID_WEAPON_ID";
- case 22: CPF_GunName = "9mm";
- case 23: CPF_GunName = "Silenced 9mm";
- case 24: CPF_GunName = "Shotgun";
- case 25: CPF_GunName = "INVALID_WEAPON_ID";
- case 26: CPF_GunName = "Sawnoff-Shotgun";
- case 27: CPF_GunName = "Combat Shotgun";
- case 28: CPF_GunName = "Micro-Uzi";
- case 29: CPF_GunName = "MP5";
- case 30: CPF_GunName = "AK-47";
- case 31: CPF_GunName = "M4";
- case 32: CPF_GunName = "Tec-9";
- case 33: CPF_GunName = "Country Rifle";
- case 34: CPF_GunName = "Sniper Rifle";
- case 35: CPF_GunName = "RPG";
- case 36: CPF_GunName = "HS Rocket";
- case 37: CPF_GunName = "Flamethrower";
- case 38: CPF_GunName = "Minigun";
- case 39: CPF_GunName = "Satchel Charge";
- case 40: CPF_GunName = "Detonator";
- case 41: CPF_GunName = "Spraycan";
- case 42: CPF_GunName = "Fire Extinguisher";
- case 43: CPF_GunName = "Camera";
- case 44: CPF_GunName = "Night Vision Goggles";
- case 45: CPF_GunName = "Thermal Goggles";
- case 46: CPF_GunName = "Parachute";
- }
- return CPF_GunName;
- }
- CPF_Function::GetPlayerGunName(playerid) {
- new CPF_GunName[50];
- new gunid = GetPlayerWeapon(playerid);
- switch(gunid) {
- case 0: CPF_GunName = "INVALID_WEAPON_ID";
- case 1: CPF_GunName = "Brass Knuckles";
- case 2: CPF_GunName = "Golf Club";
- case 3: CPF_GunName = "Nightstick";
- case 4: CPF_GunName = "Knife";
- case 5: CPF_GunName = "Baseball Bat";
- case 6: CPF_GunName = "Shovel";
- case 7: CPF_GunName = "Pool Cue";
- case 8: CPF_GunName = "Katana";
- case 9: CPF_GunName = "Chainsaw";
- case 10: CPF_GunName = "Double-ended Dildo";
- case 11: CPF_GunName = "Dildo";
- case 12: CPF_GunName = "Vibrator";
- case 13: CPF_GunName = "Silver Vibrator";
- case 14: CPF_GunName = "Flowers";
- case 15: CPF_GunName = "Cane";
- case 16: CPF_GunName = "Grenade";
- case 17: CPF_GunName = "Tear Gas";
- case 18: CPF_GunName = "Molotov Cocktail";
- case 19: CPF_GunName = "INVALID_WEAPON_ID";
- case 20: CPF_GunName = "INVALID_WEAPON_ID";
- case 21: CPF_GunName = "INVALID_WEAPON_ID";
- case 22: CPF_GunName = "9mm";
- case 23: CPF_GunName = "Silenced 9mm";
- case 24: CPF_GunName = "Shotgun";
- case 25: CPF_GunName = "INVALID_WEAPON_ID";
- case 26: CPF_GunName = "Sawnoff-Shotgun";
- case 27: CPF_GunName = "Combat Shotgun";
- case 28: CPF_GunName = "Micro-Uzi";
- case 29: CPF_GunName = "MP5";
- case 30: CPF_GunName = "AK-47";
- case 31: CPF_GunName = "M4";
- case 32: CPF_GunName = "Tec-9";
- case 33: CPF_GunName = "Country Rifle";
- case 34: CPF_GunName = "Sniper Rifle";
- case 35: CPF_GunName = "RPG";
- case 36: CPF_GunName = "HS Rocket";
- case 37: CPF_GunName = "Flamethrower";
- case 38: CPF_GunName = "Minigun";
- case 39: CPF_GunName = "Satchel Charge";
- case 40: CPF_GunName = "Detonator";
- case 41: CPF_GunName = "Spraycan";
- case 42: CPF_GunName = "Fire Extinguisher";
- case 43: CPF_GunName = "Camera";
- case 44: CPF_GunName = "Night Vision Goggles";
- case 45: CPF_GunName = "Thermal Goggles";
- case 46: CPF_GunName = "Parachute";
- }
- return CPF_GunName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement