Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testLotsOfData() { | |
new array = array_create() | |
for (int i = 0; i < 1000000; i++) { | |
array_set_int(array, 0, 1) | |
/** | |
* What? This was segfaulting after some large i, usually ~: | |
* 100000 < i < 500000 | |
*/ | |
array_delete(array, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use this in place of `array_get_int()` as the former mishandles | |
* parameters and needs to be wrapped safely. | |
*/ | |
stock array_get_int_safe(array, index) { | |
// Insert a dummy canary into the stack. | |
new dummy[32] | |
// Call a native (VM function) using the dummy variable to get | |
// rid of "unused symbol" warnings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A callback called for all ARP plugins when the ARP core is loaded. | |
public ARP_Init() { | |
new line[256] | |
new name[32], Float:origin[3], Float:angle, model[128] | |
while (read_file(NPCS_FILE, line, 255)) { | |
parse_line_to_npc(line, name, 32, origin, angle, model, 128) | |
ARP_RegisterNpc(name, origin, angle, model, "handleNpcUsed") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Registers an NPC or zone. Note that this actually creates | |
* the NPC for you and sets it up as well. | |
* | |
* @param name[] name of the NPC, ex. "Edeka Cashier" | |
* @param Float:origin[3] where to spawn the NPC | |
* @param Float:angle which direction it should face (0.0-180.0) | |
* @param model[] the model the NPC should use (if not a zone) | |
* @param handler[] function to call when a user presses "e" next to it | |
* @param property[] the internal name of the property that it belongs to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ARP_Core.sma | |
// Handler for NPC registration API call | |
public _ARP_RegisterNpc(plugin, params) { | |
new ent = create_entity("info_target") | |
entity_set_string(ent, EV_SZ_classname, NPC_CLASSNAME) // "arp_npc" | |
entity_set_string(ent, EV_SZ_model, NPC_MODEL) // "711clerk" | |
// Store the registering plugin on the NPC so we can notify it of events later | |
entity_set_int(ent, EV_INT_iuser3, plugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new amount = str_to_num(request) | |
new bank = ARP_GetUserBank(id) | |
if (amount < 1) { | |
client_print(id, print_chat, "[ARP] Invalid amount; please enter a whole number.") | |
return PLUGIN_HANDLED | |
} | |
if (amount > bank) { | |
client_print(id, print_chat, "[ARP] You do not have enough money in your bank account.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new authid[32], query[256] | |
get_user_authid(id,authid,31) | |
format( query, 255, "SELECT wallet FROM money WHERE steamid='%s'", authid) | |
result = dbi_query(dbc,query) | |
if( dbi_nextrow( result ) > 0 ) | |
{ | |
new buffer[32],wallet | |
dbi_field(result,1,buffer,31) | |
dbi_free_result(result) | |
wallet = str_to_num(buffer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# You might want to note your old MAC address here. Use this to get it: | |
# ifconfig en0 | grep ether | |
MAC_ADDRESS=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` | |
echo "Setting MAC address..." | |
sudo ifconfig en0 ether $MAC_ADDRESS | |
ifconfig en0 | grep ether |