Advertisement
GTAProgramming

CPF - Custom Player Functions

May 13th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.77 KB | None | 0 0
  1. /*
  2.  
  3.  
  4.             CPF Include - Custom Player Functions
  5.            
  6.             Uncomplicated Way To Program!
  7.            
  8.             Author: FuneraL
  9.             Release Date: 13/05/2013 (05/13/2013 MM/DD/AAAA)
  10.            
  11.             Native Functions:
  12.            
  13.             SetPlayerPosEx(playerid, PosX, PosY, PosZ, Int, World);
  14.             GetPlayerDataPos(playerid);
  15.             SetPlayerAllStats(playerid, Score, Money, Health, Armour, Name);
  16.             GetPlayerAllStats(playerid);
  17.             SetPlayerCustomHP(playerid, Health, Armour);
  18.             GiveVehicleForPlayer(playerid, Vehicleid, Angle, VehicleColor, VehicleColor2, Respawn_Delay);
  19.             RemoveVehicleForPlayer(playerid);
  20.             SetPlayerVehiclePosEx(playerid, PosX, PosY, PosZ, Int, World);
  21.             GivePlayerWeaponKit(playerid, Weapon, Weapon_Ammo, Weapon2, Weapon_Ammo2, Weapon3, Weapon_Ammo3);
  22.             SetPlayerWeatherEx(playerid, Hour, Weather);
  23.  
  24.            
  25. */
  26.  
  27.  
  28. #if defined _CPF_included
  29.     #endif
  30. #define _CPF_included
  31. #pragma library CPF
  32.  
  33. #include <a_samp>
  34.  
  35. #define CPF_Function::%0(%1) stock %0(%1)
  36.  
  37. new CPF_Vehicle[MAX_PLAYERS];
  38.  
  39. CPF_Function::SetPlayerPosEx(playerid, Float:pX, Float:pY, Float:pZ, interior = 0, world = 0) {
  40.     SetPlayerPos(playerid, pX, pY, pZ);
  41.     SetPlayerInterior(playerid, interior);
  42.     SetPlayerVirtualWorld(playerid, world);
  43.     return true;
  44. }
  45.  
  46. CPF_Function::GetPlayerDataPos(playerid) {
  47.     new Float:pX, Float:pY, Float:pZ, CPF_String[120];
  48.     GetPlayerPos(playerid, pX, pY, pZ);
  49.     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));
  50.     return CPF_String;
  51. }
  52.  
  53. CPF_Function::SetPlayerAllStats(playerid, score = 0, money = 0, Float:health, Float:armour, name[]) {
  54.     SetPlayerScore(playerid, score);
  55.     ResetPlayerMoney(playerid);
  56.     GivePlayerMoney(playerid, money);
  57.     SetPlayerHealth(playerid, health);
  58.     SetPlayerArmour(playerid, armour);
  59.     SetPlayerName(playerid, name);
  60.     return true;
  61. }
  62.  
  63. CPF_Function::GetPlayerAllStats(playerid) {
  64.     new score, money, Float:health, Float:armour, name[24], CPF_String[200];
  65.     GetPlayerHealth(playerid, health);
  66.     GetPlayerArmour(playerid, armour);
  67.     GetPlayerName(playerid, name, 24);
  68.     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);
  69.     return CPF_String;
  70. }
  71.  
  72. CPF_Function::SetPlayerCustomHP(playerid, Float:health, Float:armour) {
  73.     SetPlayerHealth(playerid, health);
  74.     SetPlayerArmour(playerid, armour);
  75.     return true;
  76. }
  77.  
  78. CPF_Function::GiveVehicleForPlayer(playerid, vehicleid, Float:vehicleangle, vehiclecolor = 0, vehiclecolor2 = 0, respawndelay) {
  79.     new Float:pX, Float:pY, Float:pZ;
  80.     GetPlayerPos(playerid, pX, pY, pZ);
  81.     GetPlayerFacingAngle(playerid, vehicleangle);
  82.     CPF_Vehicle[playerid] = CreateVehicle(vehicleid, pX, pY, pZ, vehicleangle, vehiclecolor, vehiclecolor2, respawndelay);
  83.     PutPlayerInVehicle(playerid, CPF_Vehicle[playerid], 0);
  84.     return true;
  85. }
  86.  
  87. CPF_Function::RemoveVehicleForPlayer(playerid) {
  88.     DestroyVehicle(CPF_Vehicle[playerid]);
  89.     return true;
  90. }
  91.  
  92. CPF_Function::SetPlayerVehiclePosEx(playerid, Float:pX, Float:pY, Float:pZ, interior = 0, world = 0) {
  93.     SetVehiclePos(CPF_Vehicle[playerid], pX, pY, pZ);
  94.     LinkVehicleToInterior(CPF_Vehicle[playerid], interior);
  95.     SetVehicleVirtualWorld(CPF_Vehicle[playerid], world);
  96.     return true;
  97. }
  98.  
  99. CPF_Function::GivePlayerWeaponKit(playerid, weapon1, weapon_ammo1, weapon2, weapon_ammo2, weapon3, weapon_ammo3) {
  100.     GivePlayerWeapon(playerid, weapon1, weapon_ammo1);
  101.     GivePlayerWeapon(playerid, weapon2, weapon_ammo2);
  102.     GivePlayerWeapon(playerid, weapon3, weapon_ammo3);
  103.     return true;
  104. }
  105.  
  106. CPF_Function::SetPlayerWeatherEx(playerid, hour = 0, weather = 0) {
  107.     SetPlayerTime(playerid, hour, hour);
  108.     SetPlayerWeather(playerid, weather);
  109.     return true;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement