Skip to content

Instantly share code, notes, and snippets.

Avatar

Code al Dente CodeAlDente

  • Europe
View GitHub Profile
@CodeAlDente
CodeAlDente / helper.php
Last active May 29, 2020
FlightPHP - Maps - helper functions
View helper.php
<?php
// helper functions
Flight::map("stringStartsWith", function($haystack, $string) {
return (substr($haystack, 0, strlen($string)) === $string);
});
Flight::map("stringEndsWith", function($haystack, $string) {
return (substr($haystack, -strlen($string)) === $string);
@CodeAlDente
CodeAlDente / stats.pwn
Last active Jan 21, 2018
Adjust this command to see other player's stats as well
View stats.pwn
// Displays the statictics of the player
COMMAND:stats(playerid, params[])
{
// Setup local variables
new StatsMsg[1000], TitleMsg[128], StatsPlayer;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/stats", params);
// Check if the player has logged in
@CodeAlDente
CodeAlDente / PPC_Toll.inc
Last active Jan 24, 2018
Open toll gate if player is in range, keep it open while player is still in range (with trailer), close it only if player leaves the range (e.g. drives away, died, left server)
View PPC_Toll.inc
// This file holds all functions for the toll-system
forward Toll();
public Toll()
{
// Loop through all players
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
// If the player isn't connected, skip to the next player
if (APlayerData[playerid][LoggedIn] == false)
@CodeAlDente
CodeAlDente / PPC_Toll.inc
Created Jan 14, 2018
PPC Trucking - Close toll gate if player is no longer in range
View PPC_Toll.inc
// This file holds all functions for the toll-system
forward Toll();
public Toll()
{
// Loop through all players
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
// If the player isn't connected, skip to the next player
if(APlayerData[playerid][LoggedIn] == false) continue;
@CodeAlDente
CodeAlDente / snippet.pwn
Last active Feb 16, 2019
PPC Trucking: AdminLevel in external filterscripts; Updates admin level automatically if it has been changed
View snippet.pwn
// place this somewhere in ~/pawno/include/PPC_Speedometer.inc
// i recommend at line 340, right after the money and score check
if (GetPVarInt(playerid, "AdminLevel") != APlayerData[playerid][PlayerLevel])
SetPVarInt(playerid, "AdminLevel", APlayerData[playerid][PlayerLevel]);
@CodeAlDente
CodeAlDente / Trucking ranks (PPC Trucking GM)
Last active Feb 16, 2019
Returns the name of the rank of a trucker (PPC Trucking GM)
View Trucking ranks (PPC Trucking GM)
// PPC_Defines.inc
// Define trucker ranks
enum TTruckerRanks
{
RankStats, // Holds the required stats to get this rank
RankName[50] // Holds the name of the rank
}
new ATruckerRanks[][TTruckerRanks] =
{
You can’t perform that action at this time.