[Include] Usefull Functions and Stocks [xNatives][All that you need!]
#1



Natives:
NativeEffect
GiveHealth(playerid,Float:Health) To Give Player Health !
TakeHealth(playerid, Float:Health)To Take Health From the Player!
GivePlayerArmour(playerid,Float:Armour)Give Player Armour!
Slap(playerid)To Slap the player!
Explode(playerid)Explode the player!
TakeArmour(playerid, Float:Armour)rTake Armour from the player!
GivePlayerScore(playerid,Float:Score)Give Score to the player!
IsPlayerInAreaGet if the player is in the area!
GetVehicleSpeed(vehicleid)Get Vehicle Speed!
GetPlayerSpeed(playerid)Get Player Speed on Foot!
IsPlayerInWater(playerid)To Get that if the player is in the water!
IsPlayerSkydiving(playerid)To get that if the player is Sky diving!
IsPlayerUsingParachute(playerid)To get that if the player is using the parachute!
IsPlayerAiming(playerid)rTo get if the player is Aiming!
GetWeather(weatherid)Simply Get the weather's name!
HealAll()Heal all the players online!
ArmourAll()Armour all the players online!
GiveAllCash(cash)Give all players cash!
GiveAllScore(score)Giving everyone Score!
GetName(playerid)Get Player's Name.
FreezeAll()Freeze everyone online!
DisarmAll()Disarm all players online!
UnfreezeAll()Unfreeze everyone online!
GetAmmo(playerid)Get Player's weapon's Ammo!
SendMessageToAdminsSending message to the Rcon admins online!

Usage:
Usage of everything is really very simple and its really useful also!

Example Usage of GiveHealth

pawn Код:
CMD:buyhealth(playerid,params[])
{
SendClientMessage(playerid,-1,"You bought +10 Health!");
GiveHealth(playerid,10);
return 1;
}
Example Usage of TakeHealth
pawn Код:
CMD:donatehealth(playerid,params[])
{
SendClientMessage(playerid,-1,"You just Donated 10 Percent of your health!");
TakeHealth(playerid,10);
return 1;
}
Example Usage of GivePlayerArmour
pawn Код:
CMD:buyarmour(playerid,params[])
{
SendClientMessage(playerid,-1,"You just bought +10 armour!");
GivePlayerArmour(playerid,+10);
return 1;
}
Example usage of slap!
pawn Код:
CMD:slapme(playerid,params[])
{
Slap(playerid);
SendClientMessage(playerid,-1,"You Slapped your self!");
return 1;
}
Example Usage of Explode
pawn Код:
CMD:killme(playerid,params[])
{
SendClientMessage(playerid,-1,"You just Exploded your self!");
Explode(playerid);
return 1;
}
and so on, you can even use stuff to make anti cheat and stuff like that
Example:
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerSpeed => 20)
{
SendClientMessage(playerid,"You have been banned for on foot speed hacks!");
Ban(playerid);
}
if(GetVehicleSpeed => 800)
{
SendClientMessage(playerid,"You have been banned for Vehicle speed hacks!");
Ban(playerid);
}
return 1;
}
You can make commands that player can use only when he/she is out of water
Example:
pawn Код:
CMD:teleme(playerid,params[])
{
if (IsPlayerInWater(playerid) return SendClientMessage(playerid,-1,"You cant use this Command in water!");)
SetPlayerPos(playerid,0,0,0);
return 1;
}
Same Goes for IsPlayerSkydiving and IsPlayerUsingParachute

You can use IsPlayerAiming for alot of stuff, and its really useful!
Example:
pawn Код:
CMD:teleme(playerid,params[])
{
IsPlayerInWater(playerid) return SendClientMessage(playerid,-1,"You cant use this Command in water!");
SetPlayerPos(playerid,0,0,0);
return 1;
}
You can use SendMessageToAdmins with alot of stuff! and its not that hard to use, like in reporting or stuff
Example:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '@' && IsPlayerAdmin(playerd))
   {
        new string[128];
        GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]);
        SendMessageToAdmins(red,string);
        return 0;
}
HealAll, (Un)FreezeAll, ArmourAll, DisarmAll and ETC these are some simple but very useful functions!
Example:
pawn Код:
CMD:healall(playerid,params[])
{
HealAll();
SendClientMessageToAll(-1,"Administrator Healed everyone!");
return 1;
}
pawn Код:
CMD:armourall(playerid,params[])
{
ArmourAll();
SendClientMessageToAll(-1,"Administrator gave everyone Armour!");
return 1;
}
pawn Код:
CMD:freezeall(playerid,params[])
{
FreezeAll();
SendClientMessageToAll(-1,"Administrator Freezed everyone!");
return 1;
}
pawn Код:
CMD:unfreezeall(playerid,params[])
{
UnFreezeAll();
SendClientMessageToAll(-1,"Administrator UnFreezed everyone!");
return 1;
}
And so on...

Usage of GetWeather:
pawn Код:
public OnPlayerConnect(playerid)
{
new string[64];
format(string,sizeof(string),"Welcome back, Today the weather is %d",GetWeather(weatherid));
SendClientMessage(playerid,0xFFFFFFAA,string);
return 1;
}
And for more Try them your self.

Installation:
To install it, simply download it by the link below, then copy the include and take it to your Server Folder >> Pawno >> Include >> paste it there, then after that, open your script and at the top, write:
pawn Код:
#include <xStocks>
And you are done!

Other:
Was just thinking what to release, because I left servers I used to play one, so here goes an other release. As always if you find any bugs PM me or post it at my Website, or use Skype or ********. Thanks..


Download:
Click Me to Download!
Reply
#2

Useful! There are some nice functions here, thanks.
Reply
#3

useful...thanks
Reply
#4

Could be better if there is custom callbacks..
Reply
#5

Are you sure you don't forgot if() there?
Quote:
pawn Код:
CMD:teleme(playerid,params[])
{
IsPlayerInWater(playerid) return SendClientMessage(playerid,-1,"You cant use this Command in water!");
SetPlayerPos(playerid,0,0,0);
return 1;
}
Reply
#6

Think about it, its like this xD its a stock IsPlayerInWater, why we need If there?
Reply
#7

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
Think about it, its like this xD its a stock IsPlayerInWater, why we need If there?
If you didn't understand that, you shouldn't be coding.
Reply
#8

never mind, saw the code, edited thanks to MouseBreaker ..
Reply
#9

pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerSpeed =< 20)
{
SendClientMessage(playerid,"You have been banned for on foot speed hacks!");
Ban(playerid);
}
if(GetVehicleSpeed =< 800)
{
SendClientMessage(playerid,"You have been banned for Vehicle speed hacks!");
Ban(playerid);
}
return 1;
}
I lol'd at this example )

If player's speed is less than 20 or vehicle's speed is less than 800, he'll be banned.

Be careful, you did a second mistake :

This -
pawn Код:
if(x=< y)
Should be -

pawn Код:
if(x<= y)
In your code.
Reply
#10

Not bad though "IsPlayerInWater" is found in many releases. You could try something different with that function. Also, what do you mean by "IsPlayerSkyDiving" here? It means that the player is falling?
PS:I'm not able to download the file now, so that's why I'm asking you about the IsPlayerSkyDiving stuff.

Also, IsPlayerHavingParachute, could be more better if you've done:
pawn Код:
IsPlayerHavingWeapon(playerid, weapon name/id)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)