Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Useful Functions 0.3x
- Created by: dEcooR
- Simply use #include <dfunc>
- Version: 1.0
- Functions:
- PlayerName(playerid)
- GivePlayerHealth(playerid,health)
- GivePlayerArmour(playerid,armour)
- GivePlayerScore(playerid,score)
- GetPlayerHP(playerid)
- GetPlayerARM(playerid)
- IsVehicleBike(vehicleid)
- GetVehSpeed(vehicleid)
- GetPlayerSpeed(playerid)
- Fuck(playerid)
- IsPlayerAiming(playerid)
- IsPlayerInZone(playerid,x_min,y_min,x_max,y_max)
- SendMessageToAdmins(color,message)
- GetWeaponSlot(weaponid)
- PlayAudioStreamForAll(url)
- GetPlayerIP(playerid)
- IsPlayerInWater(playerid)
- */
- #define MPH_KMH 1.609344
- #define BIEBER 0xFF00FFFF
- stock PlayerName(playerid) // Get Player Name
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
- stock GivePlayerHealth(playerid,Float:HP) // Give player health
- {
- if(HP > 99.0) HP = 99.0;
- if(HP < 0.0) HP = 0.0;
- new Float:Health;
- GetPlayerHealth(playerid,Health);
- SetPlayerHealth(playerid,Health + HP);
- if(Health + HP > 99.0) SetPlayerHealth(playerid,99.0);
- }
- stock GivePlayerArmour(playerid,Float:AR) // Give player armour
- {
- if(AR > 99.0) AR = 99.0;
- if(AR < 0.0) AR = 0.0;
- new Float:Armour;
- GetPlayerArmour(playerid,Armour);
- SetPlayerArmour(playerid,Armour + AR);
- if(Armour + AR > 99.0) SetPlayerArmour(playerid,99.0);
- }
- stock GivePlayerScore(playerid,score) //Give Player score eazyli
- {
- SetPlayerScore(playerid,GetPlayerScore(playerid)+Score);
- }
- stock GetPlayerHP(playerid) //Get player health eazy
- {
- new Float:hp;
- return GetPlayerHealth(playerid,hp);
- }
- stock GetPlayerARM(playerid) // Get player armour eazy
- {
- new Float:armour;
- return GetPlayerArmour(playerid,armour);
- }
- stock IsVehicleBike(vehicleid) // checks if is vehicle bike
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- switch(GetVehicleModel(vehicleid))
- case 509,481,510: return 1;
- return 0;
- }
- stock GetVehSpeed(vehicleid) // Use GetVehSpeed(vehicleid)
- {
- new Float:x,Float:y,Float:z,vel;
- GetVehicleVelocity(vehicleid, x, y, z);
- vel = floatround(floatsqroot( x*x + y*y + z*z ) * 180); // KM/H
- //vel = floatround(floatsqroot( x*x + y*y + z*z ) * 180 / MPH_KMH); // You can use also MPH
- return vel;
- }
- stock GetPlayerSpeed(playerid) // Use GetPlayerSpeed(playerid)
- {
- new Float:ST[4];
- if(IsPlayerInAnyVehicle(playerid))
- GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
- else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
- ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
- return floatround(ST[3]);
- }
- stock Fuck(playerid)
- {
- new Float:Pos[3];
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- SetPlayerName(playerid,"BiebersMom");
- SetPlayerColor(playerid,BIEBER);
- SetPlayerPos(playerid, Pos[0]+8, Pos[1]+5, Pos[2]+50);
- CreateExplosion(Pos[0], Pos[1], Pos[2], 8, 2.0);
- SetPlayerHealth(playerid,5.0);
- }
- stock IsPlayerAiming(playerid) // checking if is player aiming
- {
- new a = GetPlayerAnimationIndex(playerid);
- if (((a>= 1160) && (a<= 1163)) || (a== 1167) || (a== 1365) || (a== 1643) || (a== 1453) || (a== 220)) return 1;
- return 0;
- }
- IsPlayerInZone(playerid,Float:x_min,Float:y_min,Float:x_max,Float:y_max) // this function checks if is player in some zone/area
- {
- new Float:xx,Float:yy,Float:zz;
- GetPlayerPos(playerid,xx,yy,zz);
- #pragma unused z_isia
- if(xx> x_min && xx < x_max && yy > y_min && yy< y_max) return 1;
- return 0;
- }
- stock SendMessageToAdmins(color,const string[]) // Send message to online admins
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(ISP(i))
- {
- if(/*your admin*/ || IsPlayerAdmin(i)) SendClientMessage(i, color, string);
- }
- }
- }
- stock GetWeaponSlot(weaponid) // this get the weapon slot
- {
- switch(weaponid)
- {
- case 0,1: return 0;
- case 2..9: return 1;
- case 10..15: return 10;
- case 16..18,39: return 8;
- case 22..24: return 2;
- case 25..27: return 3;
- case 28,29,32: return 4;
- case 30,31: return 5;
- case 33,34: return 6;
- case 35..38: return 7;
- case 41..43: return 9;
- case 44..46: return 11;
- default: return 12;
- }
- return 12;
- }
- stock PlayAudioStreamForAll(url[])
- {
- for(new i = 0;i < MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i))
- {
- PlayAudioStreamForPlayer(i,url);
- }
- }
- }
- stock GetPlayerIP(playerid) // Getting player ip
- {
- new IP[16];
- GetPlayerIp(playerid, IP,16);
- return IP;
- }
- stock IsPlayerInWater(playerid) // checks if is player swimming/in water
- {
- new a = GetPlayerAnimationIndex(playerid);
- if (((a>= 1538) && (a<= 1542)) || (a== 1544) || (a== 1250) || (a== 1062)) return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment