Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined _hfunc_included
- #endinput
- #endif
- #define _hfunc_included
- #if !defined _samp_included
- #tryinclude <a_samp>
- #if !defined _samp_included
- #error could not locate a_samp.inc file, please check your server includes
- #endif
- #endif
- #define MAX_CELLS 256
- stock bool:IsPlayerSwimming(playerid)
- {
- new animlib[1], animname[32];
- if(GetPlayerAnimationIndex(playerid))
- {
- GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,0,animname,32);
- if(!strcmp(animname, "SWIM_CRAWL") || !strcmp(animname, "SWIM_BREAST") || !strcmp(animname, "SWIM_GLIDE") || !strcmp(animname, "SWIM_DIVE_UNDER") || !strcmp(animname, "SWIM_UNDER"))
- {
- return true;
- }
- return false;
- }
- return false;
- }
- stock bool:IsPlayerFalling(playerid)
- {
- new animlib[1], animname[32];
- if(GetPlayerAnimationIndex(playerid))
- {
- GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,0,animname,32);
- if(!strcmp(animname, "FALL_FALL") || !strcmp(animname, "FALL_GLIDE"))
- {
- return true;
- }
- return false;
- }
- return false;
- }
- stock strrev(string[], len)
- {
- new str[MAX_CELLS];
- for(new i=strlen(string); i>=0; i--)
- {
- format(str, len+2, "%s%c", str, string[i]);
- }
- return str;
- }
- stock substr(string[], index, len)
- {
- new str[MAX_CELLS];
- for(new i=index; i<=index+len; i++)
- {
- format(str, len+1, "%s%c", str, string[i]);
- }
- return str;
- }
- stock RandomEx(min, max)
- {
- return random(max-min)+min;
- }
- stock Float:fRandom(Float:max)
- {
- return max*random(32768)/32768.0;
- }
- stock Float:fRandomEx(Float:min, Float:max)
- {
- return min+(max - min)*random(32768)/32768.0;
- }
- stock Float:RotationToPoint(playerid, Float:x, Float:y)
- {
- new Float:pX, Float:pY, Float:pZ;
- GetPlayerPos(playerid, pX, pY, pZ);
- return atan2((x+3000) - (pX+3000), (y+3000) - (pY+3000))*-1;
- }
- stock Float:RotationToPlayer(playerid, tplayerid)
- {
- new Float:pX, Float:pY, Float:pX1, Float:pY1, Float:Useless;
- GetPlayerPos(playerid, pX, pY, Useless);
- GetPlayerPos(tplayerid, pX1, pY1, Useless);
- return atan2((pX1+3000) - (pX+3000), (pY1+3000) - (pY+3000))*-1;
- }
- stock Float:RotationToVehicle(playerid, vehicleid)
- {
- new Float:pX, Float:pY, Float:vX, Float:vY, Float:Useless;
- GetPlayerPos(playerid, pX, pY, Useless);
- GetVehiclePos(vehicleid, vX, vY, Useless);
- return atan2((vX+3000) - (pX+3000), (vY+3000) - (pY+3000))*-1;
- }
- stock FormatInt(number, delimiter)
- {
- new num[12], count = -1, result[16];
- format(num, sizeof(num), "%i", number);
- for(new x = strlen(num)-1; x >= 0; x--) {
- if(count == 2) {
- format(result, sizeof(result), "%c%c%s", num[x], delimiter, result);
- count = 0;
- }
- else {
- format(result, sizeof(result), "%c%s", num[x], result);
- count++;
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment