SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 22/03/2019, 06:32 PM   #1
antixgaming
Big Clucker
 
antixgaming's Avatar
 
Join Date: Apr 2018
Location: Knowhere
Posts: 103
Reputation: 13
Default Little Unneeded Functions

'Little Unneeded Functions'

version 1.1 - by qRighT


This is remaded version from my fallen project that has been more tested and experimented.
If you think that why I haven't just used macros and redefinitions, it is because it's function reliability.
Some of mathematical stuff has been tested with other people who agree that functions are reliable and safe.
Any of founded mistakes and complaints should be written via private message to me.


Functions:

IsCoordNearCoord(Float: x1, Float:y1, Float:z1, Float: x2, Float:y2, Float:z2, Float:radius);
SetPlayerMainStats(playerid, Float:health, Float:armour, money);
GetPlayerMainStats(playerid, &Float:health, &Float:armour, &money);
Kill(playerid);
KillAllPlayers();
KickPlayer(playerid);
BanPlayer(playerid);
KickPlayerEx(playerid, color, const reason[]);
BanPlayerEx(playerid, color, const reason[]);
GiveMoneyToAll(money);
IsPlayerNearPlayer(playerid, targetid, Float:radius);
SetHealthToAll(Float:health);


Explanations:

IsCoordNearCoord - checks if coordinate if close enough to another coordinate with specific radius
SetPlayerMainStats - sets health, armour, and money at once.
Kill - kills player
KillAllPlayers - kills all players
KickPlayer - kicks a player (with fixed using; able to send message and kick at once for example)
BanPlayer - bans a player (with fixed using)
KickPlayerEx - kicks player where you can send message with specific color (with fixed using)
BanPlayerEx - bans player where you can send message with specific color (with fixed using)
GiveMoneyToAll - gives money to all players who are connected
IsPlayerNearPlayer - if player is near other connected player in specific given radius
SetHealthToAll - gives specific health to all connected players


Download:

Click Here

END

If you have questions, feel free to reply! But complaints and reports should be sended via private messages!
More things will come later...

Last edited by antixgaming; 22/03/2019 at 11:02 PM.
antixgaming is offline   Reply With Quote
Old 22/03/2019, 10:09 PM   #2
antixgaming
Big Clucker
 
antixgaming's Avatar
 
Join Date: Apr 2018
Location: Knowhere
Posts: 103
Reputation: 13
Default Re: Little Unneeded Functions

Your code for checking coordinate is wrong, use the math, somewhere you will end up with negative value. Of mistakes I have created in rush. I have fixed them. Kill is not callback. It is a function that will kill player if needed. I have deleted my last topic and created new one, so that foesn't count as two topics. And what I meant with timers, is that server quickly operates last functions within a second, so I can use timer with 100ms interval length. I have deleted my topic for a reason, and I am pretty much sure that you aren't right every time, ******.
antixgaming is offline   Reply With Quote
Old 22/03/2019, 10:42 PM   #3
antixgaming
Big Clucker
 
antixgaming's Avatar
 
Join Date: Apr 2018
Location: Knowhere
Posts: 103
Reputation: 13
Default Re: Little Unneeded Functions

But what if you have negative x, y, or z axis?
antixgaming is offline   Reply With Quote
Old 22/03/2019, 10:45 PM   #4
antixgaming
Big Clucker
 
antixgaming's Avatar
 
Join Date: Apr 2018
Location: Knowhere
Posts: 103
Reputation: 13
Default Re: Little Unneeded Functions

Well that's kind of true what you are saying. (For complex maths)
antixgaming is offline   Reply With Quote
Old 22/03/2019, 11:01 PM   #5
antixgaming
Big Clucker
 
antixgaming's Avatar
 
Join Date: Apr 2018
Location: Knowhere
Posts: 103
Reputation: 13
Default Re: Little Unneeded Functions

Those floatabs make sure that those complex maths don't get through. As I said I have tested with some people that I trust and who are good at maths.
antixgaming is offline   Reply With Quote
Old 22/03/2019, 11:21 PM   #6
antixgaming
Big Clucker
 
antixgaming's Avatar
 
Join Date: Apr 2018
Location: Knowhere
Posts: 103
Reputation: 13
Default Re: Little Unneeded Functions

I didn't say that I don't get it. I agree with you. Why are you attacking me now? I just said that those little problems with math cannot occur with absolute value, that was just explanation why I use floatabs.
antixgaming is offline   Reply With Quote
Old 22/03/2019, 11:24 PM   #7
antixgaming
Big Clucker
 
antixgaming's Avatar
 
Join Date: Apr 2018
Location: Knowhere
Posts: 103
Reputation: 13
Default Re: Little Unneeded Functions

I just had to make sure nothing goes wrong with coordinates since they can sometime get really messy.
antixgaming is offline   Reply With Quote
Old 23/03/2019, 12:04 AM   #8
iLearner
Gangsta
 
iLearner's Avatar
 
Join Date: Apr 2017
Posts: 578
Reputation: 134
Default Re: Little Unneeded Functions

the only useful function I could see is IsCoordNearCoord, the rest is pretty much basic stuff and I wouldn't use an include for those personally.

good job for the effort anyway.
iLearner is offline   Reply With Quote
Old 23/03/2019, 12:24 AM   #9
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,065
Reputation: 151
Default Re: Little Unneeded Functions

There is even a function you could use, that would be even faster and simpler xD

PHP Code:
stock bool:IsCoordNearCoord(Float:x1Float:y1Float:z1Float:x2Float:y2Float:z2Float:radius)
{
    return 
VectorSize(x1-x2y1-y2z1-z2) <= radius;

//Edit: Y, forgot that
__________________
Kaliber is offline   Reply With Quote
Old 23/03/2019, 12:29 AM   #10
kristo
Banned
 
Join Date: Jun 2012
Location: Estonia
Posts: 352
Reputation: 179
Default Re: Little Unneeded Functions

Quote:
Originally Posted by Kaliber View Post
There is even a function you could use, that would be even faster and simpler xD

PHP Code:
stock bool:IsCoordNearCoord(Float:x1Float:y1Float:z1Float:x2Float:y2Float:z2Float:radius)
{
    return 
VectorSize(x1-x2y1-y2z1-z2) <= radius*radius;

VectorSize takes the root of the distance so radius shouldn't be multiplied.
kristo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dini creates an unneeded file austin070 Scripting Help 4 28/09/2014 12:50 PM


All times are GMT. The time now is 12:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.