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);
- */
- #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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement