Skip to content

Instantly share code, notes, and snippets.

View PatrickGTR's full-sized avatar
👋
hey there!

PatrickGTR PatrickGTR

👋
hey there!
View GitHub Profile
@PatrickGTR
PatrickGTR / account_login.inc
Created April 7, 2020 16:08
Make your query and code neat.
#include <YSI_Visual\y_dialog>
#include <YSI_Coding\y_hooks>
#include <formatex>
#include <logger>
#include <mysql_prepared>
static
Statement:stmt_loadPlayerData,
gPlayerPasswordHash[MAX_PLAYERS][250];
#include <YSI_Data\y_bit>
#include <YSI_Data\y_iterate>
#include <YSI_Coding\y_timers>
#include <YSI_Coding\y_hooks>
#include <formatex>
static
PlayerText:dmg_Reciever[MAX_PLAYERS],
PlayerText:dmg_Giver[MAX_PLAYERS];
@PatrickGTR
PatrickGTR / useGlobalState.js
Created August 3, 2019 07:41
useGlobalState
import { useState, useEffect } from "react";
import Router from "next/router";
const useGlobalState = () => {
const [state, setState] = useState({
isLoggedIn: false,
username: null,
accountData: {}
});
main() {
sql = mysql_connect("localhost", "root", "", "cnr");
mysql_log(ALL);
// Prepares the statement
new Statement: stmt_insert = stmt_prepare (sql, "INSERT INTO accounts(username, password, salt, money, kills, deaths) VALUES (?,?,?,?,?,?) " );
// Arrow values in questions (first 0, second is 1, etc ...)
#include <YSI\y_hooks>
#define MAX_ZONE_NAME 28
enum E_ZONE_DATA
{
zone_Name[MAX_ZONE_NAME],
Float:zone_minX,
@PatrickGTR
PatrickGTR / OnPlayerVirtualWorldChange.pwn
Last active August 29, 2015 14:02
OnPlayerVirtualWorldChange callback
stock pref_SetPlayerVirtualWorld(playerid, worldid)
{
CallLocalFunction("OnPlayerVirtualWorldChange", "iii", playerid, GetPlayerVirtualWorld(playerid), worldid);
SetPlayerVirtualWorld(playerid, worldid);
return 1;
}
#if defined _ALS_SetPlayerVirtualWorld
#undef SetPlayerVirtualWorld
#else
@PatrickGTR
PatrickGTR / progressbar.sublime-completions
Created June 8, 2014 17:27
progress.inc and playerprogress.inc auto completion for Sublime Text 2/3
{
"scope": "source.pawn - variable.other.pawn",
"completions":
[
//Global Progress Bar (progress.inc)
{ "trigger": "CreateProgressBar", "contents": "CreateProgressBar(${1:Float: X}, ${2:Float: Y}, ${3:width}, ${4:height}, ${5:color}, ${6:max = 100})" },
{ "trigger": "DestroyProgressBar", "contents": "DestroyProgressBar(${1:barid})"},
{ "trigger": "ShowProgressBarForPlayer", "contents": "ShowProgressBarForPlayer(${1:playerid}, ${2:barid})"},
{ "trigger": "HideProgressBarForPlayer", "contents": "HideProgressBarForPlayer(${1:playerid}, ${2:barid})"},
{ "trigger": "ShowProgressBarForAll", "contents": "ShowProgressBarForAll(${1:barid})"},
@PatrickGTR
PatrickGTR / db_parse.sublime-completions
Last active August 29, 2015 14:01
db_parse auto-completion for Sublime Text
{
"scope": "source.pawn - variable.other.pawn",
"completions":
[
{ "trigger": "db_parse", "contents": "db_parse(${1:DB:dbHandle}, ${2:db_table[]}, ${3:string[]}, ${4:{Float,_}:...})" },
{ "trigger": "db_update_int", "contents": "db_update_int(${1:const field[]}, ${2:value})" },
{ "trigger": "db_update_float", "contents": "db_update_float(${1:const field[]}, ${2:Float:value})" },
{ "trigger": "db_update_str", "contents": "db_update_str(${1:const field[]}, ${2:str[]})" },
{ "trigger": "db_update", "contents": "db_update(${1:DB:dbHandle}, ${2:const db_table[]}, ${3:const str[]}, ${4:{Float,_}:...})" },
{ "trigger": "db_insert", "contents": "db_insert(${1:DB:dbHandle}, ${2:const db_table[]}, ${3:const fields[]}, ${4:const values[]}, ${5:{Float,_}:...})" },
@PatrickGTR
PatrickGTR / db-errors.inc
Created May 11, 2014 19:17
Just a little fix for db-errors who does still use this include.
// Problem : warning 235: public function lacks forward declaration (symbol "THE_OnSQLiteQueryError")
#include <a_samp>
#tryinclude "amx\amx_header"
#if !defined _inc_amx_header
#error amx_assembly is required. Get it here: github.com/zeex/amx_assembly
#endif
@PatrickGTR
PatrickGTR / speedtest.pwn
Created February 8, 2014 20:27
speed test between two command processor in PAWN (SA-MP)
/* Test Results
[20:25:01] ZCMD took 3 ms to execute 10000 commands
[20:25:01] STRCMP took 76 ms to execute 10000 commands
[20:25:04] ZCMD took 3 ms to execute 10000 commands
[20:25:04] STRCMP took 76 ms to execute 10000 commands
[20:25:04] ZCMD took 3 ms to execute 10000 commands
[20:25:04] STRCMP took 76 ms to execute 10000 commands