[Include] pFUNC (30+ usefull things) (0.3d) *6/Oct/2011*
#1

Peace,

today I've decided, to publish my fourth Open Source Project. I sincerely apologize for my imperfect English. This Include provides over 30 new functions in your Gamemode/Filterscript. I would look forward to requests / ideas. This Include is only for Sa:Mp Version 0.3d RC1 or higher, because it use the RemoveBuildingForPlayerFunction.

Function's:
pawn Код:
| GetWeaponDamage(WeaponID)
|   • return: Damage from Weaponid in Healthpoints
|   • wrong Syntax: return Error Message
|   • example: printf("Weapon Damage from Weapon 31 is %d HP per Bullet",GetWeaponDamage(31));
pawn Код:
| IsKeyDown(Player,const Key)
|   • return: true
|   • wrong Syntax: return Error Message
|   • example: printf("Player Holds fire: %b",IsKeyDown(playerid,KEY_FIRE));
pawn Код:
| FreezeVehicle(vehid,time)
|   • return: true
|   • wrong Syntax: return Error Message
|   • example: FreezeVehicle(GetPlayerVehicleID(playerid),5000)
pawn Код:
| SetVehicleParams(VehicleID,Engine,Light,Alarm,Locked,Boonet,Boot,Objective)
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: SetVehicleParams(GetPlayerVehicleID(playerid),-1,-1,-1,-1,1,1,-1)
pawn Код:
| AddAction(const Name[MAX_ACTION_NAME],playerid=INVALID_ACTION_ID)
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: AddAction("Peace",INVALID_ACTION_ID)
pawn Код:
| RemAction(const Name[MAX_ACTION_NAME],playerid=INVALID_ACTION_ID)
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: RemAction("Peace",INVALID_ACTION_ID)
pawn Код:
| AddActionTime(time,const Name[MAX_ACTION_NAME],playerid=INVALID_ACTION_ID)
|   • return: true
|   • wrong Syntax: false
|   • example: AddActionTime(10,"Peace",INVALID_ACTION_ID)
pawn Код:
| RemActionTime(time,const Name[MAX_ACTION_NAME],playerid = INVALID_ACTION_ID)
|   • return: true
|   • wrong Syntax: false
|   • example: RemActionTime(5,"Peace",INVALID_ACTION_ID)
pawn Код:
| GetSecondsBetweenAction(const Name[MAX_ACTION_NAME],playerid = INVALID_ACTION_ID)
|   • return: Player: playerid, Seconds / Server: Seconds
|   • wrong Syntax: false
|   • example: printf("Action \"Peace\" is %d Seconds ago",GetSecondsBetweenAction("Peace",INVALID_ACTION_ID));
pawn Код:
| IfActionExist(const Name[MAX_ACTION_NAME],playerid=INVALID_ACTION_ID)
|   • return: true
|   • wrong Syntax: false
|   • example: printf("Action \"Peace\" exist: %d",IfActionExist("Peace",INVALID_ACTION_ID));
pawn Код:
| GetActionID(const Name[MAX_ACTION_NAME],playerid=INVALID_ACTION_ID)
|   • return: Action ID
|   • wrong Syntax:INVALID_ACTION_ID
|   • example: printf("Action \"Peace's\" ID ist : %d",GetActionID("Peace",INVALID_ACTION_ID));
pawn Код:
| GetFreeActionID()
|   • return: Free Action ID
|   • wrong Syntax: INVALID_ACTION_ID
|   • example: printf("Next free Action ID is : %d",GetFreeActionID());
pawn Код:
| ToggleCheatForPlayer(playerid,Cheat[],bool:Allowed)
|   • -UNFINISHED, dont use it!-
pawn Код:
| IsCheatAllowedForPlayer(playerid,Cheat[])
|   • -UNFINISHED, dont use it!-
pawn Код:
| SendClientCommand(playerid,Command[])
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: SendClientCommand(playerid,"/help")
pawn Код:
| GetNextFreePlayerID()
|   • return: free id/-1
|   • wrong Syntax: -impossible-
|   • example: printf("Next free Player ID is: %d",GetNextFreePlayerID());
pawn Код:
| SetServerPassword(password[])
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: SetServerPassword("Peace");
pawn Код:
| RemoveServerPassword()
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: RemoveServerPassword();
pawn Код:
| ScrollText(Text[])
|   • return: scrolled text
|   • wrong Syntax: -impossible-
|   • example: ScrollText("Peace")
pawn Код:
| RemoveCranesForPlayer(playerid)
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: RemoveCranesForPlayer(playerid);
pawn Код:
| RemoveSodaMachinesForPlayer(playerid)
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: RemoveSodaMachinesForPlayer(playerid);
pawn Код:
| GetRandomNumber(...)
|   • return: one random entered number
|   • wrong Syntax: -unknown-
|   • example: RemoveSodaMachinesForPlayer(playerid);
pawn Код:
| GetRandomColor()
|   • return: Colorcode like
|   • wrong Syntax: -unknown-
|   • example: SetPlayerColor(playerid,GetRandomColor());
pawn Код:
| IsValidVehicle(VehicleID)
|   • return: true/false
|   • wrong Syntax: false
|   • example: printf("Vehicle ID 123 exist %d on the Server!",IsValidVehicle(123));
pawn Код:
| ReverseText(const Text[])
|   • return: reversed text
|   • wrong Syntax: -impossible-
|   • example: printf("Reversed text: %s", ReverseText("!dlroW ecaeP));
pawn Код:
| GetRandomCode(Cells)
|   • return: Random Code
|   • wrong Syntax: return Error Message
|   • example: printf("Random Code with 45 Cells: %s",GetRandomCode(45));
pawn Код:
| GetPlayerIPEx(playerid)
|   • return: Player IP
|   • wrong Syntax: -imposssible-
|   • example: printf("IP from Player ID 4 is: %s",GetPlayerIPEx(4));
pawn Код:
| SendClientMessageEx(Color,Text[],...)
|   • return: true
|   • wrong Syntax: -imposssible-
|   • example: SendClientMessageEx(-1,"This Message dont go to ID 4,8,25,123 and 499!",4,8,25,123,499)
pawn Код:
| GetVehicleDriver(VehicleID)
|   • return: vehicle driver/-1
|   • wrong Syntax: -imposssible-
|   • example: printf("Driver of Vehicle ID 16 is Player ID: %d",GetVehicleDriver(16));
pawn Код:
| IsValidNosVehicle(VehicleID)
|   • return: true/false
|   • wrong Syntax: -imposssible-
|   • example: printf("Vehicle ID 12 is %d valid Nos Vehicle",IsValidNosVehicle(12));
pawn Код:
| Log(FileName[],FileType[],Text[])
|   • return: true
|   • wrong Syntax: return Error Message
|   • example: Log("Peace","wrl","This text got logged in the \"Peace.wrl\" File in the Scriptfiles directory!")
pawn Код:
| KickEx(...)
|   • return: true
|   • wrong Syntax: -imposssible-
|   • example: KickEx(4,8,25,123,499);
pawn Код:
| IsPlayerReloading(playerid)
|   • return: true/false
|   • wrong Syntax: -imposssible-
|   • example: printf("Player ID 4 reloads %d",IsPlayerReloading(4));
pawn Код:
| IsValidSkin(SkinID)
|   • return: true/false
|   • wrong Syntax: -imposssible-
|   • example: printf("Skin ID 123 is %d Valid Skin!",IsValidSkin(123));
pawn Код:
| GetVehicleMaxPassengers(VehicleID)
|   • return: vehicle seats
|   • wrong Syntax: -imposssible-
|   • example: printf("Max Passengers of Vehicle ID 16 are %d!",GetVehicleMaxPassengers(16));
Public's:
pawn Код:
| OnPlayerEnterCheat(playerid,Cheat[]);
|   • -UNFINISHED, dont use it!-
How to use it:
1.) Put the File in your Server directory ..\pawno\includes\..

2.) Put the following Line in your Script under #include a_samp:
pawn Код:
#include pFunc
and recompile it.

Downloads:
http://solidfiles.com/d/c57ba/ (Includes Readme & Picture - Recommended)
http://pastebin.com/VeH43hVu

Changelog:
pawn Код:
• 6.10.2011:
-» Initial release.
• 18.10.2011:
-» Improved ReverseText(..)
-» Improved IsValidVehicle(..)
-» Removes all #pragma unused
Rules:
Nother Mirrors: allowed
Editing Script: allowed
Removing Credits: allowed
Publish it: forbidden (Only on request)
Sell it: forbidden

Greetz!
Reply
#2

"GetWeaponDamage(WeaponID)"

Is this accurate

Epic functions, nice job.
Reply
#3

@Lorenc_: Jes, I thougt - and thanks!
Reply
#4

if I use '0' as server password, server unlocks?
Reply
#5

Quote:
Originally Posted by Pablo Borsellino
Посмотреть сообщение
@Lorenc_: Jes, I thougt - and thanks!
Shouldn't the damage be in float?
Reply
#6

Very usefull !

Quote:

if I use '0' as server password, server unlocks?

Код:
| RemoveServerPassword()
|   • return: true
|   • wrong Syntax: -impossible-
|   • example: RemoveServerPassword();
Reply
#7

@Scottas: Use only "RemoveServerPassword();" and the Server Passwort gets removed.

@wups: All Damages are a perfect Number like 2,5,7 and so on and not 4.5.. So, I thought it don't needs return a Float.

@costel_nistor96: Thanks.
Reply
#8

Use stocks rather than
pawn Код:
#pragma unused GetWeaponDamage
#pragma unused IsKeyDown
#pragma unused FreezeVehicle
#pragma unused FreezeVehicleEx
#pragma unused SetVehicleParams
#pragma unused AddAction
#pragma unused RemAction
#pragma unused AddActionTime
#pragma unused RemActionTime
#pragma unused GetSecondsBetweenAction
#pragma unused IfActionExist
#pragma unused GetActionID
#pragma unused GetFreeActionID
#pragma unused ScrollText
#pragma unused SendClientCommand
#pragma unused IsCheatAllowedForPlayer
#pragma unused ToggleCheatForPlayer
#pragma unused OnPlayerEnterCheat
#pragma unused GetNextFreePlayerID
#pragma unused SetPlayerOnPlayerUpdateDelay
#pragma unused SetOnPlayerUpdateDelay
#pragma unused RemoveServerPassword
#pragma unused SetServerPassword
#pragma unused RemoveSodaMachinesForPlayer
#pragma unused RemoveCranesForPlayer
#pragma unused GetRandomNumber
#pragma unused GetRandomColor
#pragma unused IsValidVehicle
#pragma unused ReverseText
#pragma unused GetRandomCode
#pragma unused GetVehicleMaxPassengers
#pragma unused IsValidSkin
#pragma unused IsPlayerReloading
#pragma unused KickEx
#pragma unused Log
#pragma unused SendClientMessageEx
#pragma unused GetPlayerIPEx
#pragma unused GetVehicleDriver
#pragma unused IsValidNosVehicle

Quote:
Originally Posted by wups
Посмотреть сообщение
Shouldn't the damage be in float?
That's why I asked
Reply
#9

Nice work.
Reply
#10

@Lorenc_: Had stock's before, next Update I change it.

@HyperZ: Thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)