Coder Social home page Coder Social logo

pawn-lang / samp-stdlib Goto Github PK

View Code? Open in Web Editor NEW
48.0 7.0 30.0 871 KB

The San Andreas Multiplayer Pawn Standard Library Package - designed for the sampctl package management system.

Home Page: http://sampctl.com

Pawn 100.00%
pawn-package sampctl sa-mp standard-library pawn sa-mp-development

samp-stdlib's People

Contributors

daniel-cortez avatar dentis-t avatar fedemahf avatar mergevos avatar omcho420 avatar pushline avatar rsetiawan7 avatar southclaws avatar y-less avatar yugecin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

samp-stdlib's Issues

More INVALID constants

Add commonly used INVALID constants, taken from here:

#define INVALID_SKIN_ID					-1
#define INVALID_MODEL_ID				-1
#define INVALID_CHECKPOINT_ID				-1
#define INVALID_MAPICON_ID				-1
#define INVALID_PICKUP_ID				-1
#define INVALID_AREA_ID					-1
#define INVALID_TIMER_ID				-1
#define INVALID_VIRTUAL_WORLD_ID			-1
#define INVALID_INTERIOR_ID				-1
#define INVALID_CLASS_ID				-1
#define INVALID_PAINTJOB_ID				-1
#define INVALID_VEHICLE_COLOR_ID			-2
#define INVALID_WEAPON_ID				-1

There might be others I haven't thought of.

Solve the versioning issue.

In a recent issue, #28, it was pointed out that the 0.3.DL version of the library has not received the same treatment as the main version.

This is because the 0.3.DL tag points to an older commit.

I propose we scrap tags, scrap branches and just go for a master branch that holds the latest version, gated maybe with preprocessor definitions.

Move from tag based versioning to branch based versioning

Currently, sampctl users use tags to specify versions:

sampctl/samp-stdlib:0.3.7-R2-1-1

Which works for linear changes. However, a lot of the team want to start experimenting with minor improvements such as missing functions and fixes to certain definitions. This would be easier if split onto a separate branch but doing this with 0.3.DL support is difficult.

So I propose moving from tags to branches, so 0.3.7 could be specified with:

sampctl/[email protected]

While keeping master branch the "latest stable" (0.3.7) and maybe opening up "experimental" branches from these base branches for new things like adding native IsValidVehicle(vehicleid); etc.

Another reason for this would be to avoid breaking scripts that already include things such as the IsValidVehicle declaration etc.

I'd like to have some feedback from the sampctl community regarding this as changes to this repository will basically ripple to every project.

SetPlayerAmmo syntax

Seems like stdlib has syntax defined as SetPlayerAmmo(playerid, weaponslot, ammo) . Instead of weaponslot, it should be weaponid like SetPlayerAmmo(playerid, weaponid, ammo)

a_http

Add a_http to a_samp, because for some mysterious reason it's missing by default.

#include <a_http>

Generally better includes

Since most of these natives were written, the vast majority of the community has settled on a fairly consistent naming scheme, of the form Library_FunctionName. The default functions don't use this, but could do:

#pragma deprecated Use `PlayerText_Create`.
native PlayerText:CreatePlayerTextDraw(...);
native PlayerText:PlayerText_Create(...) = CreatePlayerTextDraw;

This works well with #15 and pawn-lang/compiler#234 (should that ever be done, though the macros in there can be used even now).

Since this is (IMHO) "better a_samp", it could be "b_samp" for compatibility.

Const-correctness

As in fixes.inc. Some SA:MP natives could use const more, which would allow custom functions to use const more as well. However, they don't.

I don't know if this is a comprehensive list, but:

native ApplyActorAnimation(actorid, const animlib[], const animname[], Float:fDelta, loop, lockx, locky, freeze, time);
native HTTP(index, type, const url[], const data[], const callback[]);
native SetObjectMaterial(objectid, materialindex, modelid, const txdname[], const texturename[], materialcolor = 0);
native SetPlayerObjectMaterial(playerid, objectid, materialindex, modelid, const txdname[], const texturename[], materialcolor = 0);
native SetObjectMaterialText(objectid, const text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, const fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0);
native SetPlayerObjectMaterialText(playerid, objectid, const text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, const fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0);
native PlayAudioStreamForPlayer(playerid, const url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0);
native SetPlayerShopName(playerid, const shopname[]);
native PlayerText:CreatePlayerTextDraw(playerid, Float:x, Float:y, const text[]);
native PlayerText:BAD_CreatePlayerTextDraw(playerid, Float:x, Float:y, text[]);
native PlayerTextDrawSetString(playerid, PlayerText:text, const string[]);
native SetPVarInt(playerid, const varname[], int_value);
native GetPVarInt(playerid, const varname[]);
native SetPVarString(playerid, const varname[], const string_value[]);
native GetPVarString(playerid, const varname[], string_return[], len);
native SetPVarFloat(playerid, const varname[], Float:float_value);
native Float:GetPVarFloat(playerid, const varname[]);
native DeletePVar(playerid, const varname[]);
native GetPVarType(playerid, const varname[]);
native SetPlayerChatBubble(playerid, const text[], color, Float:drawdistance, expiretime);
native ApplyAnimation(playerid, const animlib[], const animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 0);
native StartRecordingPlayerData(playerid, recordtype, const recordname[]);
native SetTimer(const funcname[], interval, repeating);
native SetTimerEx(const funcname[], interval, repeating, const format[], {Float,_}:...);
native SHA256_PassHash(const password[], const salt[], ret_hash[], ret_hash_len);
native SetSVarInt(const varname[], int_value);
native GetSVarInt(const varname[]);
native SetSVarString(const varname[], const string_value[]);
native GetSVarString(const varname[], string_return[], len);
native SetSVarFloat(const varname[], Float:float_value);
native Float:GetSVarFloat(const varname[]);
native DeleteSVar(const varname[]);
native GetSVarType(const varname[]);
native ConnectNPC(const name[], const script[]);
native SendRconCommand(const command[]);
native GetPlayerVersion(playerid, version[], len);
native BlockIpAddress(const ip_address[], timems);
native UnBlockIpAddress(const ip_address[]);
native Text:TextDrawCreate(Float:x, Float:y, const text[]);
native Text:BAD_TextDrawCreate(Float:x, Float:y, text[]);
native TextDrawSetString(Text:text, const string[]);
native Text3D:Create3DTextLabel(const text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, virtualworld, testLOS = 0);
native Update3DTextLabelText(Text3D:id, color, const text[]);
native PlayerText3D:CreatePlayer3DTextLabel(playerid, const text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testLOS = 0);
native UpdatePlayer3DTextLabelText(playerid, PlayerText3D:id, color, const text[]);
native ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[]);
native DB:db_open(const name[]);
native DBResult:db_query(DB:db, const query[]);
native SetVehicleNumberPlate(vehicleid, const numberplate[]);

I just ripped that from here:

https://github.com/Open-GTO/sa-mp-fixes/blob/a2d209fe0882d18def20c7c7563135e386b056e5/fixes.inc#L4373-L4711

So it isn't sorted by library I'm afraid.

missing natives and callbacks

There are few natives and callbacks which are missing in the includes of SAMP server package. Here are few (if not all) of the missing natives and callbacks:

Missing Natives:

  • IsValidVehicle(vehicleid)
  • SendClientCheck
  • gpci

Missing Callbacks:

  • OnClientCheckResponse
  • OnScriptCash

I am not sure if it is safe to include some of these natives and callbacks. They could have been intentionally omitted from the includes so that people don't get to see them. They could be deprecated in a future version or even completely removed as it was not a part of the official SAMP includes set. Moreover, there's a lot of rumors about some of those natives and callbacks.

Type safety

I think we need WAY more tags everywhere. Not for master, but definately as an option. Like Pickup:, Object:, Vehicle: etc. Even tags for things that are often confused, like ColourRGBA: vs. ColourARGB: etc.

Separate PAWN and SA:MP standard libraries.

core, float, file, datagram (do you really need to keep that one - it doesn't work), string, and time, are original parts of the PAWN library. Some libraries (read: amx_assembly*) might not need all the SA:MP parts if they are quite pure PAWN libraries.

* That's not quite true. I've modified the code to only use PAWN libraries and not include a_samp anywhere (except tests), but they still need printf and format in some functions for outputting data. Newer versions of PAWN also have console.inc with printf, but still no format (annoyingly it is only used in one place, I even debated removing it and doing that string manually).

Fix line endings

This should be simple, however the linearity of the repository versioning makes this difficult to fix for all versions.

Waiting on #7 to be resolved.

(error) symbol already defined: "printf"

when trying to install the package sampctl/samp-stdlib:0.3.
and by including it I'm throwing out the error

C:\Sampctl\dependencies\samp-stdlib\a_samp.inc:57 (error) symbol already defined: "print"
C:\Sampctl\dependencies\samp-stdlib\a_samp.inc:58 (error) symbol already defined: "printf"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.