Ninja Administrator

Data inscrierii: 11/Iun/2008 Mesaje: 2
|
Trimis: 11/06/2008 09:42 Titlul subiectului: Useful Functions |
|
|
[quote author=Andre9977 link=topic=61574.msg408911#msg408911 date=1212682844]
PS: It's "Useful Functions", not "Usefull functions".
GivePlayerHealth(playerid, Float:health)
playerid - playerid, who we are giving health to
Float:health - amount of health we're giving
[pawn]
stock GivePlayerHealth(playerid, Float:health)
{
new Float:pHealth;
GetPlayerHealth(playerid, pHealth);
SetPlayerHealth(playerid, pHealth + health);
}[/pawn]
SetPlayerMoney(playerid, money)
playerid - playerid, who's money we're setting
money - amount of money what we're setting player's money to
[pawn]
stock SetPlayerMoney(playerid, money)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, money);
}[/pawn]
PlayerToPoint(Float:radi, playerid, X, Y, Z) (NOTE: not by me)
Float:radi - radius
playerid - player that we're checking
Float:x, Float:y, Float:z - The position we're checking player's length from
[pawn]stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}[/pawn]
StopMusic(playerid)
playerid - player that we're stopping the music for
[pawn]
stock StopMusic(playerid)
{
PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);
}[/pawn]
IsStringAName(string[]) (NOTE: Not by me)
string[] - String we're checking for name
[pawn]
stock IsStringAName(string[])
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
new testname[MAX_PLAYER_NAME];
GetPlayerName(i, testname, sizeof(testname));
if(strcmp(testname, string, true, strlen(string)) == 0)
{
return 1;
}
}
}
return 0;
}[/pawn]
GetPlayerID(string[]) (NOTE: not by me)
string[] - the string, which contains a player name, which ID we're getting
[pawn]
stock GetPlayerID(string[])
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
new testname[MAX_PLAYER_NAME];
GetPlayerName(i, testname, sizeof(testname));
if(strcmp(testname, string, true, strlen(string)) == 0)
{
return i;
}
}
}
return INVALID_PLAYER_ID;
}[/pawn]
[/quote] |
|