Bibliothèque★ 1mis à jour déc. 2021MITPawnsampctl
Ouvrir sur GitHubInstaller avec sampctl
sampctl package install Se8870/bind-system
Lance ceci dans le dossier de ton projet. sampctl télécharge le paquet et ce dont il dépend.
L’essayer dans le compilateur Pawn →
Ajoute ses fichiers include, avec les bibliothèques dont il dépend, au compilateur Pawn de ton navigateur, prêts à être inclus dans un script.
Dépend de 1 paquet
- sampctl/samp-stdlibpas dans cet annuaire
README.md
bind-system
Simple bind system with several types, making it more dynamic and easy to use.
Installation
Simply install to your project:
sampctl package install Se8870/bind-system
Include in your code and begin using the library:
#include <bind_system>
Function Lists
Callbacks:
// Called when you're using `BIND_TYPE_CUSTOM`
forward Bind_OnCustomExecuted(playerid, PlayerBind:slot, const string:action[]);
// Called when you set the key press
forward Bind_OnKeyPressed(playerid, PlayerBind:slot, const string:action[]);
Functions:
// Getting all slots and store it inside an array.
forward void:Bind_GetSlots(playerid, PlayerBind:output[MAX_BIND]);
// Get & Set
forward E_BIND_TYPE:Bind_GetType(playerid, PlayerBind:slot);
forward bool:Bind_SetType(playerid, PlaerBind:slot, E_BIND_TYPE:type);
forward Bind_GetKeys(playerid, PlayerBind:slot);
forward bool:Bind_SetKeys(playerid, PlayerBind:slot, keys);
forward bool:Bind_GetAction(playerid, PlayerBind:slot, string:output[], len = sizeof(output));
forward bool:Bind_SetAction(playerid, PlayerBind:slot, const string:action[]);
// Core function
forward PlayerBind:Bind_Create(playerid, E_BIND_TYPE:type, const string:action[]);
forward bool:Bind_Execute(playerid, PlayerBind:slot);
forward bool:Bind_Remove(playerid, PlayerBind:slot);
Usage
#include <a_samp>
#include <bind_system>
CMD:createbind(playerid, params[])
{
new
E_BIND_TYPE:type, action[32];
if (sscanf(params, "is[32]", _:type, params))
{
// Usage: /createbind [type] [action]
// Type: 1 = type command | 2 = type chat | 3 = (type custom, you decided)
return 0;
}
if (type == BIND_TYPE_NONE || type > BIND_TYPE_CUSTOM)
{
// Error: invalid type.
return 0;
}
Bind_Create(playerid, type, action);
// Success creating bind (ID: 1)
return 1;
}
CMD:executebind(playerid, params[])
{
new PlayerBind:slot;
if (sscanf(params, "i", _:slot))
{
// Usage: /executebind [slot]
return 0;
}
Bind_Execute(playerid, slot);
return 1;
}
CMD:removebind(playerid, params[])
{
new PlayerBind:slot;
if (sscanf(params, "i", _:slot))
{
// Usage: /removebind [slot]
return 0;
}
Bind_Remove(playerid, slot);
return 1;
}
Testing
To test, simply run the package:
sampctl package run
Cette page est construite à partir de ce que GitHub publie sur le dépôt. samp.directory n’héberge pas le code. Signaler un problème avec cette fiche