Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- [Include] Func - Simple functions
- by SmiT
- */
- #if defined _FUNC_included
- #endinput
- #endif
- #define _FUNC_included
- #include <a_samp>
- #include <foreach>
- #if !defined MAX_VEHICLES
- #define MAX_VEHICLES (2000)
- #endif
- /*
- native GivePlayerHealth(playerid, Float:health);
- native GivePlayerArmour(playerid, Float:armour);
- native GivePlayerWantedLevel(playerid, level);
- native GivePlayerDrunkLevel(playerid, level);
- native GivePlayerAmmo(playerid, weaponslot, ammo);
- native GivePlayerScore(playerid, score);
- native GiveVehicleHealth(vehicleid, Float:health);
- native SetPlayerMoney(playerid, money);
- native GiveAllHealth(Float:health);
- native GiveAllArmour(Float:armour);
- native GiveAllWantedLevel(level);
- native GiveAllDrunkLevel(level);
- native GiveAllAmmo(weaponslot, ammo);
- native GiveAllScore(score);
- native GiveAllWeapon(weaponid, ammo);
- native GiveAllMoney(money);
- native SetAllHealth(Float:health);
- native SetAllArmour(Float:armour);
- native SetAllWantedLevel(level);
- native SetAllDrunkLevel(level);
- native SetAllAmmo(weaponslot, ammo);
- native SetAllScore(score);
- native SetAllMoney(money);
- native SetAllInterior(interiorid);
- native SetAllVirtualWorld(virtualworld);
- native SetAllTime(hour, minute);
- native SetAllCheckpoint(Float:x, Float:y, Float:z, Float:size);
- native SetAllFightingStyle(style);
- native SetAllSkillLevel(skill, level);
- native SetAllSkin(skinid);
- native SetAllColor(color);
- native SetAllPos(Float:x, Float:y, Float:z);
- native SpawnAllVehicles();
- native ResetAllMoney();
- native SpawnAllPlayers();
- native SetMapName(string[]);
- native Freeze(playerid);
- native Unfreeze(playerid);
- */
- /*----------------------------------------------------------------------------*-
- Function:
- SetMapName
- Parameters:
- string - The mapname.
- Action:
- - Changes the server mapname.
- -*----------------------------------------------------------------------------*/
- stock SetMapName(string[])
- {
- new
- str[ 32 ];
- format( str, 32, "mapname %s", string );
- SendRconCommand( str );
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SpawnAllPlayers
- Parameters:
- -
- Action:
- - Spawns all players.
- -*----------------------------------------------------------------------------*/
- stock SpawnAllPlayers()
- {
- foreach(Player, i) SpawnPlayer( i );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SpawnAllVehicles
- Parameters:
- -
- Action:
- - Spawns all vehicles.
- -*----------------------------------------------------------------------------*/
- stock SpawnAllVehicles()
- {
- for ( new v = 0; v < MAX_VEHICLES; v ++) SetVehicleToRespawn( v );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveVehicleHealth
- Parameters:
- vehicleid - The vehicleid to give health.
- Float: health - The health to give.
- Action:
- - Increase a vehicle health.
- -*----------------------------------------------------------------------------*/
- stock GiveVehicleHealth(vehicleid, Float:health)
- {
- new
- Float: hp
- ;
- SetVehicleHealth(vehicleid, GetVehicleHealth( vehicleid, hp ) + Float:health );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllPos
- Parameters:
- Float:x - coordinates x.
- Float:y - coordinates y.
- Float:z - coordinates z.
- Action:
- - Sets all players position.
- -*----------------------------------------------------------------------------*/
- stock SetAllPos(Float:x, Float:y, Float:z)
- {
- foreach(Player, i) SetPlayerPos( i, Float:x, Float:y, Float:z );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllColor
- Parameters:
- color - color to set.
- Action:
- - Sets all players color.
- -*----------------------------------------------------------------------------*/
- stock SetAllColor(color)
- {
- foreach(Player, i) SetPlayerColor( i, color );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllSkin
- Parameters:
- skinid - skin id to set.
- Action:
- - Sets all players skin.
- -*----------------------------------------------------------------------------*/
- stock SetAllSkin(skinid)
- {
- foreach(Player, i) SetPlayerSkin( i, skinid );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllSkillLevel
- Parameters:
- skill - skill to set.
- level - level to set.
- Action:
- - Sets all players skill level.
- -*----------------------------------------------------------------------------*/
- stock SetAllSkillLevel(skill, level)
- {
- foreach(Player, i) SetPlayerSkillLevel( i, skill, level );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllFightingStyle
- Parameters:
- style - fighting style to set.
- Action:
- - Sets all players fighting style.
- -*----------------------------------------------------------------------------*/
- stock SetAllFightingStyle(style)
- {
- foreach(Player, i) SetPlayerFightingStyle( i, style );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllCheckpoint
- Parameters:
- Float:x - coordinates x.
- Float:y - coordinates y.
- Float:z - coodinates z.
- Float:size - size of the checkpoint
- Action:
- - Sets a checkpoint to all players.
- -*----------------------------------------------------------------------------*/
- stock SetAllCheckpoint(Float:x, Float:y, Float:z, Float:size)
- {
- foreach(Player, i) SetPlayerCheckpoint( i, Float:x, Float:y, Float:z, Float:size );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllTime
- Parameters:
- hour - hour to set.
- minute - minute to set.
- Action:
- - Sets all players time.
- -*----------------------------------------------------------------------------*/
- stock SetAllTime(hour, minute)
- {
- foreach(Player, i) SetPlayerTime( i, hour, minute );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllInterior
- Parameters:
- interiorid - interior id to set.
- Action:
- - Sets all players interior id.
- -*----------------------------------------------------------------------------*/
- stock SetAllInterior(interiorid)
- {
- foreach(Player, i) SetPlayerInterior( i, interiorid );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllVirtualWorld
- Parameters:
- virtualworld - virtualworld to set.
- Action:
- - Sets all players virtualworld.
- -*----------------------------------------------------------------------------*/
- stock SetAllVirtualWorld(virtualworld)
- {
- foreach(Player, i) SetPlayerVirtualWorld( i, virtualworld );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- ResetAllMoney
- Parameters:
- -
- Action:
- - Resets all players money.
- -*----------------------------------------------------------------------------*/
- stock ResetAllMoney()
- {
- foreach(Player, i) ResetPlayerMoney( i );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetPlayerMoney
- Parameters:
- playerid - the player who receive the money.
- money - money to set.
- Action:
- - Sets a player money.
- -*----------------------------------------------------------------------------*/
- stock SetPlayerMoney(playerid, money)
- {
- ResetPlayerMoney( playerid );
- GivePlayerMoney( playerid, money );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllMoney
- Parameters:
- money - money to set.
- Action:
- - Sets all players money.
- -*----------------------------------------------------------------------------*/
- stock SetAllMoney(money)
- {
- foreach(Player, i)
- {
- ResetPlayerMoney( i );
- GivePlayerMoney( i, money );
- }
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllMoney
- Parameters:
- money - money to give.
- Action:
- - Gives all players money.
- -*----------------------------------------------------------------------------*/
- stock GiveAllMoney(money)
- {
- foreach(Player, i) GivePlayerMoney( i, money );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllWeapon
- Parameters:
- weaponid - weaponid to give.
- ammo - ammo to give.
- Action:
- - Gives all players a weapon.
- -*----------------------------------------------------------------------------*/
- stock GiveAllWeapon(weaponid, ammo)
- {
- foreach(Player, i) GivePlayerWeapon( i, weaponid, ammo );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllScore
- Parameters:
- score - score to set.
- Action:
- - Sets all players score.
- -*----------------------------------------------------------------------------*/
- stock SetAllScore(score)
- {
- foreach(Player, i) SetPlayerScore( i, score );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllAmmo
- Parameters:
- weaponslot - weaponslot to set ammo.
- ammo - ammo to set.
- Action:
- - Sets all players ammo.
- -*----------------------------------------------------------------------------*/
- stock SetAllAmmo(weaponslot, ammo)
- {
- foreach(Player, i) SetPlayerAmmo( i, weaponslot, ammo );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllDrunkLevel
- Parameters:
- level - drunk level to set.
- Action:
- - Sets all players drunk level.
- -*----------------------------------------------------------------------------*/
- stock SetAllDrunkLevel(level)
- {
- foreach(Player, i) SetPlayerDrunkLevel( i, level );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllWantedLevel
- Parameters:
- level - wanted level to set.
- Action:
- - Sets all players wanted level.
- -*----------------------------------------------------------------------------*/
- stock SetAllWantedLevel(level)
- {
- foreach(Player, i) SetPlayerWantedLevel( i, level );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllArmour
- Parameters:
- Float:armor - armour to set.
- Action:
- - Sets all players armour.
- -*----------------------------------------------------------------------------*/
- stock SetAllArmour(Float:armor)
- {
- foreach(Player, i) SetPlayerArmour( i, Float: armor);
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- SetAllHealth
- Parameters:
- Float:health - health to set.
- Action:
- - Sets all players health.
- -*----------------------------------------------------------------------------*/
- stock SetAllHealth(Float:health)
- {
- foreach(Player, i) SetPlayerHealth( i, Float: health );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllScore
- Parameters:
- score - score to increase.
- Action:
- - Increase a player score.
- -*----------------------------------------------------------------------------*/
- stock GiveAllScore(score)
- {
- foreach(Player, i) SetPlayerScore( i, GetPlayerScore( i ) + score );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllAmmo
- Parameters:
- weaponslot - weaponslot to give ammo.
- ammo - ammo to give.
- Action:
- - Gives all players ammo.
- -*----------------------------------------------------------------------------*/
- stock GiveAllAmmo(weaponslot, ammo)
- {
- foreach(Player, i) SetPlayerAmmo( i, weaponslot, GetPlayerAmmo( i ) + ammo );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllDrunkLevel
- Parameters:
- level - drunk level to increase.
- Action:
- - Increase all players drunk level.
- -*----------------------------------------------------------------------------*/
- stock GiveAllDrunkLevel(level)
- {
- foreach(Player, i) SetPlayerDrunkLevel( i, GetPlayerDrunkLevel( i ) + level );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllWantedLevel
- Parameters:
- level - wanted level to increase.
- Action:
- - Increase all players wanted level.
- -*----------------------------------------------------------------------------*/
- stock GiveAllWantedLevel(level)
- {
- foreach(Player, i) SetPlayerWantedLevel( i, GetPlayerWantedLevel( i ) + level );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllHealth
- Parameters:
- Float:health - health to increase.
- Action:
- - Increase all players health.
- -*----------------------------------------------------------------------------*/
- stock GiveAllHealth(Float:health)
- {
- new
- Float: hp
- ;
- foreach(Player, i)
- {
- SetPlayerHealth( i, GetPlayerHealth( i, hp ) + Float: health );
- }
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GiveAllArmour
- Parameters:
- Float:armour - armour to increase.
- Action:
- - Increase all players armour.
- -*----------------------------------------------------------------------------*/
- stock GiveAllArmour(Float:armour)
- {
- new
- Float: arm
- ;
- foreach(Player, i)
- {
- SetPlayerArmour( i, GetPlayerArmour( i, arm ) + Float: armour );
- }
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GivePlayerHealth
- Parameters:
- playerid - playerid who receive the health.
- Float:health - health to give.
- Action:
- - Increase a player health.
- -*----------------------------------------------------------------------------*/
- stock GivePlayerHealth(playerid, Float:health)
- {
- new
- Float: hp
- ;
- SetPlayerHealth( playerid, GetPlayerHealth( playerid, hp ) + Float: health);
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GivePlayerArmour
- Parameters:
- playerid - player who receive the armour.
- Float:armour - armour to give.
- Action:
- - Increase a player armour.
- -*----------------------------------------------------------------------------*/
- stock GivePlayerArmour(playerid, Float:armour)
- {
- new
- Float: arm
- ;
- SetPlayerArmour( playerid, GetPlayerArmour( playerid, arm ) + Float: armour);
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GivePlayerDrunkLevel
- Parameters:
- playerid - player who receive the drunk level.
- level - drunk level to increase.
- Action:
- - Increase a player drunk level.
- -*----------------------------------------------------------------------------*/
- stock GivePlayerDrunkLevel(playerid, level)
- {
- SetPlayerDrunkLevel( playerid, GetPlayerDrunkLevel( playerid ) + level );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GivePlayerWantedLevel
- Parameters:
- playerid - player who receive the wanted level.
- level - wanted level to give.
- Action:
- - Increase a player wanted level.
- -*----------------------------------------------------------------------------*/
- stock GivePlayerWantedLevel(playerid, level)
- {
- SetPlayerWantedLevel( playerid, GetPlayerWantedLevel( playerid ) + level );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GivePlayerAmmo
- Parameters:
- playerid - player who receive the ammo.
- weaponslot - weaponslot to give the ammo.
- ammo - ammo to give.
- Action:
- - Increase a player ammo.
- -*----------------------------------------------------------------------------*/
- stock GivePlayerAmmo(playerid, weaponslot, ammo)
- {
- SetPlayerAmmo( playerid, weaponslot, GetPlayerAmmo( playerid ) + ammo );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- GivePlayerScore
- Parameters:
- playerid - player who receive the score.
- score - score to increase.
- Action:
- - Increase a player score.
- -*----------------------------------------------------------------------------*/
- stock GivePlayerScore(playerid, score)
- {
- SetPlayerScore( playerid, GetPlayerScore( playerid ) + score );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- Freeze
- Parameters:
- playerid - player who gets freezed.
- Action:
- - Freeze a player.
- -*----------------------------------------------------------------------------*/
- stock Freeze( playerid )
- {
- TogglePlayerControllable( playerid, 0 );
- return true;
- }
- /*----------------------------------------------------------------------------*-
- Function:
- Unfreeze
- Parameters:
- playerid - player who gets unfreezed.
- Action:
- - Unfreeze a player.
- -*----------------------------------------------------------------------------*/
- stock Unfreeze( playerid )
- {
- TogglePlayerControllable( playerid, 1 );
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment