[Include] [INC]Functions
#1

What is it
This include has fallowing functions:


Код:
IsPlayerAntiBikeFallToggled(playerid) // Will return 0 if it is not toggled, 1 if it is
IsPlayerMuted(playerid) // Will return 0 if it is not toggled, 1 if it is
IsPlayerJailed(playerid) // Will return 0 if it is not toggled, 1 if it is
IsVehicleGodModeToggled(playerid) // Will return 0 if it is not toggled, 1 if it is
IsPlayerGodModeToggled(playerid) // Will return 0 if it is not toggled, 1 if it is
TogglePlayerMuted(playerid, toggle) // Will (un)mute the given playerid
TogglePlayerJailed(playerid, toggle) // Will (un)jail the given playerid
TogglePlayerGodMode(playerid, toggle) // Will enable/disable godmdoe for the given playerid
TogglePlayerAntiBikeFall(playerid, toggle) Will enable/disable antibikefall for the given playerid >>> NOTE: NOT TESTED! IF ANYONE HAS TIME PLEASE TELL ME IF IT WORKS!
GetPlayerNameEx(playerid) // Will return the player name from the given playerid
GetPlayerIpEx(playerid) // Will return the player ip from the given playerid
GetPlayerHealthEx(playerid) // Will return the player health from the given playerid
GetPlayerArmourEx(playerid)// Will return the player armour from the given playerid
 GetPlayerPosEx(playerid)// Will return the players position from the given playerid (NOTE: It will return as a string! Examples given.)
Example for the usage:
Код:
// Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/stats", cmdtext, true) == 0)
	{
	    new string[200];
	    format(string, sizeof(string), "Welcome %s", GetPlayerNameEx(playerid));
	    SendClientMessage(playerid, 0xFFFFFFFF, string); print(string);
	    format(string, sizeof(string), "Your name is %s , your ip is %s and your position is: %s", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), GetPlayerPosEx(playerid));
	    SendClientMessage(playerid, 0xFFFFFFFF, string); print(string);
	    format(string, sizeof(string), "Your Armour: %d.0, Health: %d.0", GetPlayerArmourEx(playerid), GetPlayerHealthEx(playerid));
	    SendClientMessage(playerid, 0xFFFFFFFF, string); print(string);
	    format(string, sizeof(string), "Godmode: %d | Vehicle godmode: %d | Muted: %d | Jailed: %d", IsPlayerGodModeToggled(playerid), IsVehicleGodModeToggled(playerid), IsPlayerMuted(playerid), IsPlayerJailed(playerid)); print(string);
	    return 1;
	}
	return 1;
}

// Will output:
Welcome [TFD]Steve
Your name is [TFD]Steve , your ip is 127.0.0.1 and your position is: 2327.163574,1395.270507,42.820312
Your Armour: 0.0, Health: 100.0
Godmode: 0 | Vehicle godmode: 0 | Muted: 0 | Jailed: 0
Alot easier!


Download links:
Pastebin
Solidfiles
2Shared
Installation:

1) Download the files from a link
2) Put the file to SERVERDIRECTORY/pawno/include
3) Put "#include <Function>" without quotes after "#include <a_samp>" in your gamemode
4) Done (Check for errors, if there are any I will try to help)!
Note:

Anti Bike Fall is untested! Tell me if it works. I'm on my dad's pc which do not have GTA SA.
Reply
#2

It's quite nice, but:
pawn Код:
stock TogglePlayerMuted(playerid, toggle)
{
    if(IsPlayerConnected(playerid))
    {
        if(toggle == 0)
        {
            gmfuncs_PlayerInfo[playerid][Muted] = 0;
        }
        else if(toggle == 1)
        {
            gmfuncs_PlayerInfo[playerid][Muted] = 1;
        }
    }
    return 1;
}
This could be made like this:

pawn Код:
stock TogglePlayerMuted(playerid, toggle) //Or use bool:toggle = Change [Muted] to bool too then
    return IsPlayerConnected(playerid) ? gmfuncs_PlayerInfo[playerid][Muted] = toggle : return 0;
How does it actually work?
pawn Код:
stock TogglePlayerMuted(playerid, toggle)
{
    if(IsPlayerConnected(playerid)
    {
        gmfuncs_PlayerInfo[playerid][Muted] = toggle;
    }
    else
    {
        return 0;
    }
    return 1; //Not sure about this one here.
}
Reply
#3

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
It's quite nice, but:...
I'm not that good, but thanks for telling it, i will edit it!
Reply
#4

Download links updated!

Pastebin
Solidfiles
2Shared
Reply
#5

this could be very handy thank you!
Reply
#6

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
It's quite nice, but:
pawn Код:
stock TogglePlayerMuted(playerid, toggle)
{
    if(IsPlayerConnected(playerid))
    {
        if(toggle == 0)
        {
            gmfuncs_PlayerInfo[playerid][Muted] = 0;
        }
        else if(toggle == 1)
        {
            gmfuncs_PlayerInfo[playerid][Muted] = 1;
        }
    }
    return 1;
}
This could be made like this:

pawn Код:
stock TogglePlayerMuted(playerid, toggle) //Or use bool:toggle = Change [Muted] to bool too then
    return IsPlayerConnected(playerid) ? gmfuncs_PlayerInfo[playerid][Muted] = toggle : return 0;
How does it actually work?
pawn Код:
stock TogglePlayerMuted(playerid, toggle)
{
    if(IsPlayerConnected(playerid)
    {
        gmfuncs_PlayerInfo[playerid][Muted] = toggle;
    }
    else
    {
        return 0;
    }
    return 1; //Not sure about this one here.
}
What's the reason for the check if he is connected?
Reply
#7

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
What's the reason for the check if he is connected?
I didn't know neither.
This would be by the way the best function (I think)
pawn Код:
stock TogglePlayerMuted(playerid, bool:toggle)
    return toggle ? gmfuncs_PlayerInfo[playerid][Muted] = 1 : gmfuncs_PlayerInfo[playerid][Muted] = 0;
However, I won't need this I guess
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)