[Include] DZ_Functions
#1

Hello, today I wanna show you my first include DZ_Functions, that can make scripting easier for everyone!



* * * How can this Include help me to script?
This Include has some different functions, which short-up the actually functions by SA-MP and some different functions which are easier to remember. Among other some functions got together. So you don't have to write so much.

Example 1: Some functions in one!
Imagine you wanna create a teleport command, and you have to use functions like SetPlayerPos, SetPlayerFacingAngle or/and SetCameraBehindPlayer. Somewhere it is absurd three or more functions (Maybe SetPlayerInterior or something like that) to write, so why not everything in only one line? And here can DZ_Functions help you, because these funcions are already in one:
SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:A)! ("SetPlayerPosEx" is using SetCameraBehindPlayer and SetPlayerInterior, too)

Example 2: Hard to remember Features in Focus!
Imagine you wanna freeze a player per command, how would you script that? Right, with TogglePlayerControllable. For some new scripters is this function too hard to remember, so I changed TogglePlayerControllable to FreezePlayer, because I think everyone can remember that easier than TogglePlayerControllable. So DZ_Functions helps here too with the Function (Un)FreezePlayer!


* * * How can I install this include?

Download the Include (Look at the end of this post) and put in the DZ_Functions.inc in the pawno\include folder. Have you done it, open your script and write there at the first lines where your other includes are: #include <dz_functions>! If you done it, should the Include normally work(Insofar you use the Functions in your script too). Should there be problems with the Include or with installing, post it here.


* * * Which functions use this Include?

pawn Code:
native SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:A);
native SetPlayerInteriorEx(playerid, InteriorID, Float:X, Float:Y, Float:Z, Float:A);
native SetPlayerWorld(playerid, Virtualworld, Float:X, Float:Y, Float:Z, Float:A); //
native SetPlayerInteriorWorld(playerid, Virtualworld, InteriorID, Float:X, Float:Y, Float:Z, Float:A);
native SetVehiclePosEx(playerid, Float:X, Float:Y, Float:Z, Float:A);
native SetVehicleWorld(playerid, Virtualworld, Float:X, Float:Y, Float:Z, Float:A);
native GetPlayerIpEx(playerid);
native GetPlayerNameEx(playerid);
native FreezePlayer(playerid);
native UnfreezePlayer(playerid);
native HealPlayer(playerid);
native KillPlayer(playerid);

* * * Downloads:

Pastebin: http://pastebin.com/dykHJXjU
Solidfiles: http://www.solidfiles.com/d/0cc6326556/

Please post bugs or suggestions here!


Greezz, DarkZero
Reply
#2

These have been released several times.
Reply
#3

Oh another?... please stop.
Reply
#4

Hey! Can you post a example command for each of the functions? Just as a example! I'll be grateful enough, as this can maybe help my PAWNO practice!
Reply
#5

Quote:
Originally Posted by MyNinja
View Post
Hey! Can you post a example command for each of the functions? Just as a example! I'll be grateful enough, as this can maybe help my PAWNO practice!
Sure

pawn Code:
//SetPlayerPosEx(playerid, Float:X, Float:Y, Float:Z, Float:A);
if(strcmp(cmdtext, "/ls", true) == 0)
{
    SetPlayerPosEx(playerid,2491.8691,-1667.6528,13.0249,92.7956);
    return 1;
}

//SetPlayerInteriorEx(playerid, InteriorID, Float:X, Float:Y, Float:Z, Float:A);
if(strcmp(cmdtext, "/int6", true) == 0)
{
    SetPlayerInteriorEx(playerid, 6, 748.1832,1439.2191,1102.9531,251.1978);
    return 1;
}

//SetPlayerWorld(playerid, Virtualworld, Float:X, Float:Y, Float:Z, Float:A);
if(strcmp(cmdtext, "/world2", true) == 0)
{
    SetPlayerWorld(playerid, 2, 748.1832,1439.2191,1102.9531,251.1978);
    return 1;
}

//SetPlayerInteriorWorld(playerid, Virtualworld, InteriorID, Float:X, Float:Y, Float:Z, Float:A);
if(strcmp(cmdtext, "/world2int6", true) == 0)
{
    SetPlayerInteriorWorld(playerid, 2, 6, 748.1832,1439.2191,1102.9531,251.1978);
    return 1;
}

//SetVehiclePosEx(playerid, Float:X, Float:Y, Float:Z, Float:A);
if(strcmp(cmdtext, "/lswithcar", true) == 0)
{
    SetVehiclePosEx(playerid, 748.1832,1439.2191,1102.9531,251.1978);
    return 1;
}

//SetVehicleWorld(playerid, Virtualworld, Float:X, Float:Y, Float:Z, Float:A);
if(strcmp(cmdtext, "/carworld2", true) == 0)
{
    SetVehicleWorld(playerid, 2, 748.1832,1439.2191,1102.9531,251.1978);
    return 1;
}

//GetPlayerNameEx(playerid) & GetPlayerIpEx(playerid);
public OnPlayerConnect(playerid)
{
    format(string,sizeof(string), "[INFO] %s joined the server!", GetPlayerNameEx(playerid));
    SendClientMessageToAll(0x00FFFFFF, string);
    format(string, sizeof(string), "[INFO] IP: %s", GetPlayerIpEx(playerid));
    SendClientMessageToAll(0x00FFFFFF, string);
    return 1;
}

//FreezePlayer(playerid);
if(strcmp(cmdtext, "/freezeme", true) == 0)
{
    FreezePlayer(playerid);
    return 1;
}

//UnfreezePlayer(playerid);
if(strcmp(cmdtext, "/unfreezeme", true) == 0)
{
    UnfreezePlayer(playerid);
    return 1;
}

//HealPlayer(playerid);
if(strcmp(cmdtext, "/heal", true) == 0)
{
    HealPlayer(playerid);
    return 1;
}

//KillPlayer(playerid);
if(strcmp(cmdtext, "/kill", true) == 0)
{
    KillPlayer(playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)