25.01.2014, 08:33
(
Последний раз редактировалось Yashas; 25.01.2014 в 14:32.
)
Xtended Information - Skins
IsValidSkin,IsMaleSkin,IsPublicServiceSkin,IsLawEn forcementSkin & Team Skins
Introduction:
I wrote this include for my gamemode and would like to share it with you'll.This include basically is just a copy of the information given at Wiki Skins Page and stores that information as bits.
It gives information about skin validity,male or female,or was it listed under public service skins or law enforcement skins.It also has a feature to set team number for skins and retrieve it whenever you want.
Features:
List of all the available functions and their usage.
IsValidSkin(skinid)
Description:
Tells if the given skinid is a valid skin or not.
The validity information is collected from the latest wiki and the old bad skin ids are valid because they are supported now.
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is valid
0 if the skin id is invalid
IsMaleSkin(skinid)
Description:
Tells if the skin is a male skin or not.If not then its a female skin.
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is male
0 if the skin id is female
IsPublicServiceSkin(skinid)
Description:
Tells if the given skin is a part of the public service list in SAMP Wiki Skins page.
This include Firefighters,Medics,Bouncer,MIB,Army,Cops,etc
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is listed under public service skins.
0 if the skin id is not listed under public service skins.
IsLawEnforcementSkin(skinid)
Description:
Tells if the given skin is a part of the Law Enforcement list in SAMP Wiki Skins page.
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is listed under law enforcement.
0 if the skin id is not listed under law enforcement.
SetSkinToTeam(skinid,teamid)
Description:
Sets the team id to the skin.Will be returned on GetSkinTeam.
Params:
skinid - ID of the skin
teamid - a team number of your wish ranging from 0-15(supports just 16 teams, must be enough :P )
Returns
Returns the current settings value for the given skin.
GetSkinTeam(skinid)
Description:
Returns the Skin Team number.
Params:
skinid - ID of the skin to retrieve the team number.
Returns
Returns the team number.
By default all the skins belong to team 0.
Examples:
IsValidSkin(skinid)
IsMaleSkin(skinid)
IsPublicServiceSkin(skinid)
IsLawEnforcementSkin(skinid)
SetSkinToTeam
SetSkinToTeam
Downloads:
Pastebin
Will add a dropbox link soon - Got to go :P
The Final Words:
Please let me know if you find any bug or if you have any suggestion.
If anyone knows how to implement the char keyword here, please contact me so that I can make it better.
All of the information may not be correct because I manually created the bits from the page.If you find any mistakes please tell.
Thanks
IsValidSkin,IsMaleSkin,IsPublicServiceSkin,IsLawEn forcementSkin & Team Skins
Introduction:
I wrote this include for my gamemode and would like to share it with you'll.This include basically is just a copy of the information given at Wiki Skins Page and stores that information as bits.
It gives information about skin validity,male or female,or was it listed under public service skins or law enforcement skins.It also has a feature to set team number for skins and retrieve it whenever you want.
Features:
- Provides information regard various aspects of a skin
- SetSkinTeam and GetSkinTeam for optimizing large if checks
- All the information are stored in bits to reduce the memory consumption
- Written using Bitwise Operators to make things fast.
- There are no checks to check invalid skinid.The script assumes that the user will give correct skinid.Invalid skinid will crash the server.
- Since I use just 8 bits the other 24 bits go waste.If someone knows how do I get the 'char' keyword working here.Please let me know.
List of all the available functions and their usage.
IsValidSkin(skinid)
Description:
Tells if the given skinid is a valid skin or not.
The validity information is collected from the latest wiki and the old bad skin ids are valid because they are supported now.
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is valid
0 if the skin id is invalid
IsMaleSkin(skinid)
Description:
Tells if the skin is a male skin or not.If not then its a female skin.
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is male
0 if the skin id is female
IsPublicServiceSkin(skinid)
Description:
Tells if the given skin is a part of the public service list in SAMP Wiki Skins page.
This include Firefighters,Medics,Bouncer,MIB,Army,Cops,etc
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is listed under public service skins.
0 if the skin id is not listed under public service skins.
IsLawEnforcementSkin(skinid)
Description:
Tells if the given skin is a part of the Law Enforcement list in SAMP Wiki Skins page.
Params:
skinid - ID of the skin to check
Returns
1 if the skin id is listed under law enforcement.
0 if the skin id is not listed under law enforcement.
SetSkinToTeam(skinid,teamid)
Description:
Sets the team id to the skin.Will be returned on GetSkinTeam.
Params:
skinid - ID of the skin
teamid - a team number of your wish ranging from 0-15(supports just 16 teams, must be enough :P )
Returns
Returns the current settings value for the given skin.
GetSkinTeam(skinid)
Description:
Returns the Skin Team number.
Params:
skinid - ID of the skin to retrieve the team number.
Returns
Returns the team number.
By default all the skins belong to team 0.
Examples:
IsValidSkin(skinid)
Код:
if(IsValidSkin(skinid)) SetPlayerSkin(playerid,skinid); else return SendClientMessage(playerid,0xFF0000,"Invalid Skin ID");
Код:
if(IsMaleSkin(skinid)) SendClientMessage(playerid,0x00FF00,"You have chosen a male skin"); else return SendClientMessage(playerid,0x00FF00,"You have chosen a female skin");
Код:
if(!IsPublicServiceSkin(skinid)) SetWantedLevel(playerid,3); //Sets wanted level to 3 if the player is not a public service worker.
Код:
if(!IsLawEnforcementSkin(skinid)) SendClientMessage(playerid,0xFF0000,"You are firing in the public.");
Код:
public OnGameModeInit() { #define TEAM_CIVILIANS 1 #define TEAM_COPS 2 SetSkinToTeam(0,TEAM_CIVILIANS); SetSkinToTeam(288,TEAM_COPS); //and so on... return 1; }
Код:
public OnPlayerSpawn() { switch(GetSkinTeam(GetPlayerSkin(playerid))) { case TEAM_CIVILIANS: { SendClientMessage(playerid,0xFFFFFF,"You are a civilian.You can rob banks and other buildings."); } case TEAM_COPS: { SendClientMessage(playerid,0xFFFFFF,"You are a cop.Go and arrest robbers"); } } return 1; }
Pastebin
Will add a dropbox link soon - Got to go :P
The Final Words:
Please let me know if you find any bug or if you have any suggestion.
If anyone knows how to implement the char keyword here, please contact me so that I can make it better.
All of the information may not be correct because I manually created the bits from the page.If you find any mistakes please tell.
Thanks