Skip to content

Instantly share code, notes, and snippets.

@TheDutchDev
TheDutchDev / Teleports.inc
Last active August 29, 2015 14:21
Teleports.inc
#if !defined S_MAX_TELEPORTS
#define S_MAX_TELEPORTS (50)
#endif
#if !defined S_MAX_TEL_NAME
#define S_MAX_TEL_NAME (24)
#endif
#if !defined S_MAX_CMD_NAME
#define S_MAX_CMD_NAME (32)
@TheDutchDev
TheDutchDev / Beach Elevator
Last active August 30, 2015 16:50
Beach Elevator
// By Niels Visbeek :: 30.08.2015
#include <a_samp>
#include <streamer>
#define ELEVATOR_SPEED (5.0)
#define DOORS_SPEED (5.0)
#define ELEVATOR_WAIT_TIME (5000)
#define DIALOG_ID (9100)
@TheDutchDev
TheDutchDev / PHP Database OOP
Created February 19, 2016 13:05
PHP Database OOP
class Database
{
private
$database,
$dbhost = '', // usually localhost
$dbname = '',
$dbuser = '',
$dbpass = ''
;
@TheDutchDev
TheDutchDev / JSON AJAX
Last active February 22, 2016 09:04
JSON AJAX
function getSomething(somevalue) {
$.ajax({
type: "GET",
url: "somedomain.com/someurl.php?somevar=1",
dataType: 'json'
}).done(function (data) {
console.log( data );
}).fail(function (data) {
console.log( data );
});
@TheDutchDev
TheDutchDev / JSON AJAX POST
Created February 22, 2016 12:51
JSON AJAX POST
$.ajax({
type: "POST",
url: hostURL + "index.php",
data: { action: "something" }
}).done(function (data) {
console.log( data );
}).fail(function (data) {
console.log(data);
});
@TheDutchDev
TheDutchDev / Example.cs
Last active November 5, 2019 21:39
Rage RPC in C#, server-side only for now.
// Small example, fetches the getInvincible from the client to see if the client is invincible or not.
// SERVER-SIDE
var response = await client.RequestDataFromClient( "IsPlayerInvincible" );
if( response == null )
Console.WriteLine( "Couldnt fetch" );
else
Console.WriteLine( $"Player invincible: { response[ 0 ] }" );
@TheDutchDev
TheDutchDev / 1-AltVWsSharp.cs
Last active October 11, 2021 12:12
ALTV WebsocketSharp with LetsEncrypt SSL (https://github.com/sta/websocket-sharp)
using AltV.Net.Data;
using System;
using System.Collections.Generic;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using WebSocketSharp;
using WebSocketSharp.Server;
@TheDutchDev
TheDutchDev / 1-async-models.ts
Last active October 15, 2021 03:50
alt:V MP Async model loading with cancellation and clearing of previously loaded models that are no longer being used.
import * as alt from 'alt-client';
import * as natives from 'natives';
class AsyncModel {
constructor() {
this.loadingModels = new Set();
this.loadedModels = new Map();
}
cancel(model) {
this.loadingModels.delete(model);
this.removeLoadedModel(model);