Skip to content

Instantly share code, notes, and snippets.

switch (weaponid) {
// The spas shotguns shoot 8 bullets, each inflicting 4.95 damage
case WEAPON_SHOTGSPA: {
bullets = amount / 4.950000286102294921875;
if (8.0 - bullets < -0.05) {
return WC_INVALID_DAMAGE;
}
}
<?php
foreach ($amx as $k => $v) {
if (is_object($v)) {
foreach ($v as $_k => $_v) {
if (is_object($_v))
continue;
else if (is_array($_v))
$_v = "Array(" . count($_v) . ")";
$pad = str_repeat(' ', 16 - strlen($_k));
/*----------------------------------------------------------------------------*\
==========================
y_colours - X11 colours!
==========================
Description:
This holds the colour information that used to be part of the text system
but which is far more useful than just for text. This now supports the full
set of X11 colours, both by name and by definition. You can also define
your own if you so choose (up to 32 - should be enough given that this
includes the X11 colours).
diff --git a/y_dohooks.inc b/y_dohooks.inc
index 0adf841..b39ed71 100644
--- a/y_dohooks.inc
+++ b/y_dohooks.inc
@@ -62,6 +62,7 @@ Changelog:
#include <YSI\internal\y_version>
#include <a_samp>
#include <YSI\y_debug>
+#include <YSI\y_stringhash>
@oscar-broman
oscar-broman / gist:2358595
Created April 11, 2012 10:47
y_dohooks.inc
/*----------------------------------------------------------------------------*\
==============================
y_hooks - Hook any callback!
==============================
Description:
Automatically hooks any callbacks with a very simple syntax.
Legal:
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
@oscar-broman
oscar-broman / notepad++.php
Created July 14, 2012 22:30
Generate Notepad++ configuration
<?php
// Requires PAWN-Scanner
// Get it here: https://github.com/oscar-broman/PAWN-Scanner
// Include path to scan
define('INCLUDE_PATH', './', 'a_npc.inc');
// Where to save the files
define('PAWN_XML', './PAWN.xml');
define('USER_DEF_LANG', './userDefineLang.xml');

Built-in modules

PBP comes with a few modules by default. These are not mandatory in any way, you can simply remove those you don't need.

Core module 

The core module doesn't do much.. yet.

StaticGroups module 

You can declare groups as global variables with the following syntax:

@oscar-broman
oscar-broman / gist:4545758
Created January 16, 2013 09:13
Fetch MySQLi results properly typed.
<?php
function mysqli_fetch_all_typed($result, $resulttype = MYSQLI_NUM)
{
if (!$result)
return null;
$fields = $result->fetch_fields();
if (method_exists($result, 'fetch_all')) {
$rows = $result->fetch_all($resulttype);
@oscar-broman
oscar-broman / db-errors.inc
Last active December 24, 2015 21:39
db_query error reporting
#include <a_samp>
#tryinclude "amx_assembly\amx_header"
#if !defined _inc_amx_header
#error amx_assembly is required. Get it here: github.com/zeex/amx_assembly
#endif
#include "amx_assembly\dynamic_call"
#include "amx_assembly\phys_memory"
@oscar-broman
oscar-broman / .el
Last active August 18, 2016 13:17
quickly change indentation in spacemacs
;; Put inside dotspacemacs/user-config
(defun set-tab-width (n)
(dolist (var '(evil-shift-width
default-tab-width
tab-width
c-basic-offset
cmake-tab-width
coffee-tab-width
cperl-indent-level