Posts: 596
Threads: 75
Joined: Nov 2015
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
Posts: 596
Threads: 75
Joined: Nov 2015
Quote:
Originally Posted by Sreyas
nice one bro
|
Thanks
Posts: 1,208
Threads: 36
Joined: Apr 2015
PHP код:
stock KickAll()
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
Kick(i);
}
return 1;
}
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
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.
Posts: 1,275
Threads: 121
Joined: Jul 2011
Reputation:
0
Health, Armor & Kill are quite useless as the original natives are one-liners & natives are called faster than functions.
Posts: 3,324
Threads: 96
Joined: Sep 2013
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)
Posts: 596
Threads: 75
Joined: Nov 2015
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 ^