13.10.2012, 18:19
(
Последний раз редактировалось CreativityLacker; 14.11.2012 в 08:49.
)
CreativityLacker's custom miscellaneous functions
Just a lot of useful functions which might come in handy. Don't bitch about it, It's meant to be a personal tool but I'm releasing it.
Quote:
native GetPlayersName(playerid)
native SetPlayerPositionEx(playerid, Float, Float:y, Float:z, Float:angle, vworld, interior) native TeleportPlayerToPlayer(playerid, targetid) native TeleportCarToPlayer(vehicleid, playerid) native TeleportPlayerToCar(playerid, vehicleid) native GetPlayerIPAddress(playerid) native HealPlayer(playerid) native KillPlayer(playerid) native CrashPlayer(playerid) native GivePlayerHealth(playerid, Float:health) native TakePlayerHealth(playerid, Float:health) native GivePlayerArmour(playerid, Float:armour) native TakePlayerArmour(playerid, Float:armour) native GivePlayerScore(playerid, score) native TakePlayerScore(playerid, score) native GiveScoreFromPlayerToPlayer(playerid, targetid, score) native GiveCashFromPlayerToPlayer(playerid, targetid, amount) native BankruptPlayer(playerid) native SetPlayerCash(playerid) native SlapPlayer(playerid) native IsPlayerSwimming(playerid) native IsPlayerFalling(playerid) native IsPlayerInModdingShop(playerid) native GetVehicleType(modelid) stock GetPlayerVehicleSpeed(playerid) native ExplodePlayer(playerid) native IsPlayerAiming(playerid) native GetWeaponNameByID(weaponid) native GetWeaponIDByName(weaponname[]) native GetWeaponSlotByID(weaponid) native GetPlayerArmedWeaponAmmo(playerid) native GetVehicleNameByModel(model) native GetWeatherName(weatherid) native LoadObjectsFromFile(const filename[]) native LoadVehiclesFromFile(const filename[]) native CreateLogEntry(log[], text[]) native HealAll() native ArmourAll() native FreezeAll() native DisarmAll() native GiveWeaponToAll(weaponid, ammo) native GiveCashToAll(cash) native GiveScoreToAll(score) native UnfreezeAll() native GetOnlinePlayersCount() native GetValidVehiclesCount() |
Explanations
Well, most of the functions are self-explanatory but some functions require explanations so -
LoadObjectsFromFile(const filename[])
This is a simple function to load CreateObject lines from a file.
const filename[] should be like "Objects.txt" or "Maps/Objects.txt" since it's the FOLDER PATH INSIDE THE SCRIPTFILES FOLDER.
NOTE: DO NOT use this function twice with a timer, else it'll result in the server creating double of the same objects. I suggest if you're gonna use this for a stunt, then you load all the objects on game mode in it ORRRRRRRR if you're going for a map-chaning-tdm-thing, Then I suggest you make custom functions - StartMap(mapid) and EndMap() and load and destroy objects whenever they're called to avoid extra-useless objects
LoadVehiclesFromFile
Same as LoadObjectsFromFile, except it loads vehicles
GetVehicleType
const filename[] should be like "Objects.txt" or "Maps/Objects.txt" since it's the FOLDER PATH INSIDE THE SCRIPTFILES FOLDER.
NOTE: DO NOT use this function twice with a timer, else it'll result in the server creating double of the same objects. I suggest if you're gonna use this for a stunt, then you load all the objects on game mode in it ORRRRRRRR if you're going for a map-chaning-tdm-thing, Then I suggest you make custom functions - StartMap(mapid) and EndMap() and load and destroy objects whenever they're called to avoid extra-useless objects
LoadVehiclesFromFile
Same as LoadObjectsFromFile, except it loads vehicles
GetVehicleType
pawn Код:
#define TYPE_INVALID -1
#define TYPE_AIRPLANE 0
#define TYPE_HELICOPTER 1
#define TYPE_BIKE 2
#define TYPE_CONVERTIBLE 3
#define TYPE_INDUSTRIAL 4
#define TYPE_LOWRIDER 5
#define TYPE_OFFROAD 6
#define TYPE_PUBLIC 7
#define TYPE_SALOON 8
#define TYPE_SPORT 9
#define TYPE_STATION 10
#define TYPE_BOAT 11
#define TYPE_TRAILER 12
#define TYPE_UNIQUE 13
#define TYPE_RC 14
Changelogs
10/14/2012 - Added pastebin link and explanation on request and advise
10/16/2012 - Added many new functions, V2 released
09/11/2012 - Added many new functions, V2.25 released
09/11/2012 - Fixed some minor bugs, Functions will work correctly now.
14/11/2012 - Fixed some major bugs, Added new functions, Fixed previous functions too.
10/16/2012 - Added many new functions, V2 released
09/11/2012 - Added many new functions, V2.25 released
09/11/2012 - Fixed some minor bugs, Functions will work correctly now.
14/11/2012 - Fixed some major bugs, Added new functions, Fixed previous functions too.