SA-MP Forums Archive
[Include] k_functions.inc - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] k_functions.inc (/showthread.php?tid=600376)



k_functions.inc - K0P - 07.02.2016

k_functions.inc
This is my first include with some functions,i took the Teleport(...) function from the include "m_teleport.inc".
Ill keep updating this include,ill be addmin more functions,callbacks...etc



Functions
Код:
stock RemovePlayerWeapon(playerid, weaponid)
stock ChatLog(playerid, text[])
stock GetIp(playerid)
stock GetName(playerid)
stock LineContainsIp(string[])
stock SetPlayerPosEx(playerid, Float:x, Float:y, Float:z, Float:angle)
stock Heal(playerid)
stock Armour(playerid)
stock Kill(playerid)
stock GodMode(playerid, toggle)
stock Crash(playerid)
stock Drop(playerid)
stock KickAll(playerid)
stock Freeze(playerid, toggle)
stock Slap(playerid)
stock Explode(playerid)
stock Disarm(playerid)
stock RestartServer()
stock GMX()
stock LockServer(password[])
stock VehicleEngine(vehicleid, toggle)
stock VehicleDoors(vehicleid, toggle)
stock Teleport(playerid, Float:x, Float:y, Float:z, Float:FacingAngle, world, interior, showmessage, message[], style, sound, camreset, telemessage, telename[], telecommand[])
stock ClearChat(playerid, lines)
Credits
SA-MP Team for <a_samp>
Fancy for m_teleport.inc function



Bugs
N/A

Download



Re: k_functions.inc - SyS - 07.02.2016

nice one bro


Re: k_functions.inc - K0P - 07.02.2016

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
nice one bro
Thanks


Re: k_functions.inc - JasperM - 08.02.2016

Код:
stock KickAll(playerid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		Kick(playerid);
	}
	return 1;
}
That is not going to do the job. Change it to something like this:

Код:
stock KickAll()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		Kick(i);
	}
	return 1;
}



Re: k_functions.inc - AbyssMorgan - 08.02.2016

PHP код:
stock KickAll()
{
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        
Kick(i);
    }
    return 
1;




Re: k_functions.inc - Vince - 08.02.2016

Just a tip: a function does something and should therefore always have a verb in its name. Get, set, add, remove, toggle, ... You know what I mean.


Re: k_functions.inc - -CaRRoT - 09.02.2016

Health, Armor & Kill are quite useless as the original natives are one-liners & natives are called faster than functions.


Re: k_functions.inc - Crayder - 09.02.2016

I feel like rewriting everthing in this include, just to show you all of the things you did bad...

I'm not downing you, but it could be better. A LOT better.

Two examples:
pawn Код:
#define FreezePlayer(%0, %1)\// originally stock Freeze
    TogglePlayerControllable(%0, !%1)
pawn Код:
static __T_NAME[MAX_PLAYER_NAME];
#define ReturnPlayerName(%0)\// originally stock GetName(playerid)
    (GetPlayerName(%0,__T_NAME,MAX_PLAYER_NAME),__T_NAME)



Re: k_functions.inc - K0P - 09.02.2016

Quote:
Originally Posted by JasperM
Посмотреть сообщение
Код:
stock KickAll(playerid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		Kick(playerid);
	}
	return 1;
}
That is not going to do the job. Change it to something like this:

Код:
stock KickAll()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		Kick(i);
	}
	return 1;
}
Oh sorry i didnt noticed lol

Quote:
Originally Posted by Crayder
Посмотреть сообщение
I feel like rewriting everthing in this include, just to show you all of the things you did bad...

I'm not downing you, but it could be better. A LOT better.

Two examples:
pawn Код:
#define FreezePlayer(%0, %1)\// originally stock Freeze
    TogglePlayerControllable(%0, !%1)
pawn Код:
static __T_NAME[MAX_PLAYER_NAME];
#define ReturnPlayerName(%0)\// originally stock GetName(playerid)
    (GetPlayerName(%0,__T_NAME,MAX_PLAYER_NAME),__T_NAME)
Thanks for info

Quote:
Originally Posted by Vince
Посмотреть сообщение
Just a tip: a function does something and should therefore always have a verb in its name. Get, set, add, remove, toggle, ... You know what I mean.
And thanks to you too for this tip ^


Re: k_functions.inc - Roozevelt - 09.02.2016

Good Job Mate .