├── includes ├── YSI_Coding │ ├── y_timers │ │ ├── v1.inc │ │ └── tests.inc │ ├── y_inline │ │ └── jit.inc │ ├── y_va │ │ └── tests.inc │ ├── y_va.inc │ ├── y_hooks.inc │ ├── y_inline.inc │ └── y_timers.inc ├── YSI_Core │ ├── y_master │ │ ├── tests.inc │ │ ├── _cleanup.inc │ │ ├── _push_master.inc │ │ └── _pop_master.inc │ ├── y_functional.inc │ ├── y_als.inc │ └── y_functional │ │ └── tests.inc ├── YSI_Storage │ ├── y_bitmap │ │ ├── load.inc │ │ ├── subpixel.inc │ │ └── blending.inc │ ├── y_svar │ │ └── tests.inc │ ├── y_bitmap.inc │ └── y_svar.inc ├── YSI_Visual │ ├── y_classes │ │ └── tests.inc │ ├── y_commands │ │ └── card.h │ └── y_races │ │ └── groups.inc ├── amx │ ├── .gitignore │ ├── test │ │ ├── jit-test.pwn │ │ ├── amx-test.pwn │ │ ├── disasm-test.pwn │ │ ├── windows │ │ │ ├── Makefile │ │ │ └── ShellExecute-test.pwn │ │ ├── stack_trace-test.pwn │ │ ├── phys_memory-test.pwn │ │ ├── dynamic_call-test.pwn │ │ ├── asm-test.pwn │ │ └── Makefile │ ├── shellcode.inc │ ├── os.inc │ ├── heap_alloc.inc │ ├── amx_memory.inc │ ├── amx_base.inc │ ├── stack_trace.inc │ ├── amx.inc │ ├── stack_dump.inc │ └── phys_memory.inc ├── YSI_Data │ ├── y_foreach.inc │ ├── y_foreach │ │ └── warning.inc │ ├── y_bintree │ │ └── tests.inc │ └── y_hashmap.inc ├── YSI_Players │ ├── y_text │ │ ├── textid.inc │ │ └── renderer3.inc │ └── y_users │ │ ├── ini.inc │ │ ├── Dan10.inc │ │ ├── blueg7.inc │ │ └── tests.inc ├── YSI_Server │ ├── y_punycode │ │ └── tests.inc │ └── y_colors.inc ├── YSI │ ├── y_als.inc │ ├── y_bit.inc │ ├── y_td.inc │ ├── y_va.inc │ ├── y_amx.inc │ ├── y_cell.inc │ ├── y_debug.inc │ ├── y_ini.inc │ ├── y_lock.inc │ ├── y_php.inc │ ├── y_svar.inc │ ├── y_text.inc │ ├── y_utils.inc │ ├── y_uvar.inc │ ├── y_xml.inc │ ├── y_areas.inc │ ├── y_colors.inc │ ├── y_dialog.inc │ ├── y_extra.inc │ ├── y_files.inc │ ├── y_hooks.inc │ ├── y_inline.inc │ ├── y_malloc.inc │ ├── y_master.inc │ ├── y_races.inc │ ├── y_remote.inc │ ├── y_timers.inc │ ├── y_users.inc │ ├── y_bintree.inc │ ├── y_bitmap.inc │ ├── y_classes.inc │ ├── y_colours.inc │ ├── y_groups.inc │ ├── y_iterate.inc │ ├── y_testing.inc │ ├── y_commands.inc │ ├── y_flooding.inc │ ├── y_languages.inc │ ├── y_playerset.inc │ ├── y_punycode.inc │ ├── y_writemem.inc │ ├── y_zonenames.inc │ ├── y_zonepulse.inc │ ├── y_jaggedarray.inc │ ├── y_playerarray.inc │ ├── y_properties.inc │ ├── y_scriptinit.inc │ └── y_stringhash.inc ├── YSI_AC │ ├── y_ac@do_compiler_long_fix │ │ ├── hooks │ │ │ ├── callbacks │ │ │ │ ├── OnPlayerDeath.pwn │ │ │ │ ├── OnPlayerCommandText.pwn │ │ │ │ ├── OnPlayerConnect.pwn │ │ │ │ ├── OnPlayerUpdate.pwn │ │ │ │ ├── OnPlayerText.pwn │ │ │ │ ├── OnScriptExit.pwn │ │ │ │ ├── OnScriptInit.pwn │ │ │ │ └── OnPlayerSpawn.pwn │ │ │ └── natives │ │ │ │ ├── ResetPlayerMoney.pwn │ │ │ │ ├── GivePlayerMoney.pwn │ │ │ │ ├── GetPlayerSpecialAction.pwn │ │ │ │ ├── GetPlayerMoney.pwn │ │ │ │ ├── SetPlayerArmour.pwn │ │ │ │ ├── SetPlayerHealth.pwn │ │ │ │ ├── SetPlayerSpecialAction.pwn │ │ │ │ ├── TogglePlayerSpectating.pwn │ │ │ │ └── TogglePlayerControllable.pwn │ │ ├── watchguard │ │ │ ├── impl │ │ │ │ ├── Watchguard_Ping.pwn │ │ │ │ ├── Watchguard_Freeze.pwn │ │ │ │ ├── Watchguard_Money.pwn │ │ │ │ ├── Watchguard_Joypad.pwn │ │ │ │ ├── Watchguard_Jetpack.pwn │ │ │ │ ├── Watchguard_Armour.pwn │ │ │ │ └── Watchguard_Health.pwn │ │ │ └── Watchguard.pwn │ │ ├── utils │ │ │ ├── IsPlayerAFK.pwn │ │ │ ├── IsPlayerSpawned.pwn │ │ │ ├── sync │ │ │ │ ├── IsPlayerSynced.pwn │ │ │ │ └── SetPlayerSync.pwn │ │ │ ├── GetSpeed.pwn │ │ │ ├── IsPlayerAtVendingMachine.pwn │ │ │ └── CheatDetected.pwn │ │ ├── constants │ │ │ ├── player.pwn │ │ │ └── game.pwn │ │ └── variables.pwn │ ├── .gitignore │ ├── NOTES.md │ ├── README.md │ └── LICENSE ├── time.inc ├── datagram.inc ├── YSI_Extra │ ├── y_extra.inc │ ├── y_extra_other.inc │ ├── y_extra_languages.inc │ └── y_files.inc ├── a_sampdb.inc ├── a_http.inc ├── core.inc ├── a_actor.inc ├── string.inc ├── file.inc ├── YSI_Internal │ ├── y_unqid.inc │ ├── y_renative.inc │ ├── y_globaltags.inc │ ├── y_funcinc.inc │ ├── y_gamerzps.inc │ ├── y_classgroups.inc │ ├── y_cgen.inc │ ├── y_compilerpass.inc │ └── y_stripnumbers.inc └── util.inc ├── libmysql.dll ├── .gitattributes ├── plugins ├── mysql.dll ├── streamer.so └── streamer.dll ├── .gitignore ├── modules ├── def │ ├── dialog.pwn │ ├── missions.pwn │ └── ftime.pwn ├── player │ └── animpreload.pwn ├── visual │ ├── cutscene.pwn │ ├── info.pwn │ └── subtitles.pwn ├── game │ ├── clock.pwn │ └── hospital.pwn └── missions │ └── sweetcall.pwn ├── server.cfg ├── README.md ├── tables └── players.sql ├── server-readme.txt └── gamemodes └── main.pwn /includes/YSI_Coding/y_timers/v1.inc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/YSI_Core/y_master/tests.inc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/YSI_Storage/y_bitmap/load.inc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/YSI_Visual/y_classes/tests.inc: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /includes/amx/.gitignore: -------------------------------------------------------------------------------- 1 | *.amx 2 | *.lst 3 | *.asm 4 | -------------------------------------------------------------------------------- /includes/YSI_Data/y_foreach.inc: -------------------------------------------------------------------------------- 1 | #include "y_iterate" 2 | 3 | -------------------------------------------------------------------------------- /libmysql.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/libmysql.dll -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pwn linguist-language=Pawn 2 | *.inc linguist-language=Pawn 3 | -------------------------------------------------------------------------------- /plugins/mysql.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/plugins/mysql.dll -------------------------------------------------------------------------------- /includes/YSI_Players/y_text/textid.inc: -------------------------------------------------------------------------------- 1 | // y_textid 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/streamer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/plugins/streamer.so -------------------------------------------------------------------------------- /plugins/streamer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/plugins/streamer.dll -------------------------------------------------------------------------------- /includes/YSI_Players/y_users/ini.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/includes/YSI_Players/y_users/ini.inc -------------------------------------------------------------------------------- /includes/YSI_Players/y_users/Dan10.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/includes/YSI_Players/y_users/Dan10.inc -------------------------------------------------------------------------------- /includes/YSI_Players/y_users/blueg7.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/includes/YSI_Players/y_users/blueg7.inc -------------------------------------------------------------------------------- /includes/YSI_Server/y_punycode/tests.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuzi/samp-missions/HEAD/includes/YSI_Server/y_punycode/tests.inc -------------------------------------------------------------------------------- /includes/YSI/y_als.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_als 4 | #endif 5 | 6 | #include "..\YSI_Core\y_als" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_bit.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_bit 4 | #endif 5 | 6 | #include "..\YSI_Data\y_bit" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_td.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_td 4 | #endif 5 | 6 | #include "..\YSI_Server\y_td" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_va.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_va 4 | #endif 5 | 6 | #include "..\YSI_Coding\y_va" 7 | -------------------------------------------------------------------------------- /includes/amx/test/jit-test.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "jit" 4 | 5 | main() { 6 | printf("JIT is %spresent", IsJITPresent() ? ("") : ("not ")); 7 | } 8 | -------------------------------------------------------------------------------- /includes/YSI/y_amx.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_amx 4 | #endif 5 | 6 | #include "..\YSI_Storage\y_amx" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_cell.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_cell 4 | #endif 5 | 6 | #include "..\YSI_Core\y_cell" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_debug.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_debug 4 | #endif 5 | 6 | #include "..\YSI_Core\y_debug" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_ini.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_ini 4 | #endif 5 | 6 | #include "..\YSI_Storage\y_ini" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_lock.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_lock 4 | #endif 5 | 6 | #include "..\YSI_Server\y_lock" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_php.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_php 4 | #endif 5 | 6 | #include "..\YSI_Storage\y_php" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_svar.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_svar 4 | #endif 5 | 6 | #include "..\YSI_Storage\y_svar" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_text.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_text 4 | #endif 5 | 6 | #include "..\YSI_Players\y_text" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_utils.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_utils 4 | #endif 5 | 6 | #include "..\YSI_Core\y_utils" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_uvar.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_uvar 4 | #endif 5 | 6 | #include "..\YSI_Storage\y_uvar" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_xml.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_xml 4 | #endif 5 | 6 | #include "..\YSI_Storage\y_xml" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_areas.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_areas 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_areas" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_colors.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_colors 4 | #endif 5 | 6 | #include "..\YSI_Server\y_colors" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_dialog.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_dialog 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_dialog" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_extra.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_extra 4 | #endif 5 | 6 | #include "..\YSI_Extra\y_extra" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_files.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_files 4 | #endif 5 | 6 | #include "..\YSI_Extra\y_files" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_hooks.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_hooks 4 | #endif 5 | 6 | #include "..\YSI_Coding\y_hooks" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_inline.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_inline 4 | #endif 5 | 6 | #include "..\YSI_Coding\y_inline" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_malloc.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_malloc 4 | #endif 5 | 6 | #include "..\YSI_Coding\y_malloc" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_master.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_master 4 | #endif 5 | 6 | #include "..\YSI_Core\y_master" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_races.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_races 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_races" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_remote.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_remote 4 | #endif 5 | 6 | #include "..\YSI_Coding\y_remote" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_timers.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_timers 4 | #endif 5 | 6 | #include "..\YSI_Coding\y_timers" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_users.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_users 4 | #endif 5 | 6 | #include "..\YSI_Players\y_users" 7 | -------------------------------------------------------------------------------- /includes/amx/test/amx-test.pwn: -------------------------------------------------------------------------------- 1 | #include "amx" 2 | 3 | main() { 4 | // This must output "1". 5 | printf("%d", ReadAmxCell(AMX_OFFSET_BASE) == GetAmxBaseAddress()); 6 | } 7 | -------------------------------------------------------------------------------- /includes/YSI/y_bintree.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_bintree 4 | #endif 5 | 6 | #include "..\YSI_Data\y_bintree" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_bitmap.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_bitmap 4 | #endif 5 | 6 | #include "..\YSI_Storage\y_bitmap" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_classes.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_classes 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_classes" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_colours.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_colours 4 | #endif 5 | 6 | #include "..\YSI_Server\y_colours" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_groups.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_groups 4 | #endif 5 | 6 | #include "..\YSI_Players\y_groups" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_iterate.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_iterate 4 | #endif 5 | 6 | #include "..\YSI_Data\y_iterate" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_testing.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_testing 4 | #endif 5 | 6 | #include "..\YSI_Core\y_testing" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_commands.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_commands 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_commands" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_flooding.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_flooding 4 | #endif 5 | 6 | #include "..\YSI_Server\y_flooding" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_languages.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_languages 4 | #endif 5 | 6 | #include "..\YSI_Players\y_languages" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_playerset.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_playerset 4 | #endif 5 | 6 | #include "..\YSI_Data\y_playerset" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_punycode.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_punycode 4 | #endif 5 | 6 | #include "..\YSI_Server\y_punycode" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_writemem.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_writemem 4 | #endif 5 | 6 | #include "..\YSI_Internal\y_writemem" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_zonenames.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_zonenames 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_zonenames" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_zonepulse.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_zonepulse 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_zonepulse" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_jaggedarray.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_jaggedarray 4 | #endif 5 | 6 | #include "..\YSI_Data\y_jaggedarray" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_playerarray.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_playerarray 4 | #endif 5 | 6 | #include "..\YSI_Data\y_playerarray" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_properties.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_properties 4 | #endif 5 | 6 | #include "..\YSI_Visual\y_properties" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_scriptinit.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_scriptinit 4 | #endif 5 | 6 | #include "..\YSI_Server\y_scriptinit" 7 | -------------------------------------------------------------------------------- /includes/YSI/y_stringhash.inc: -------------------------------------------------------------------------------- 1 | #include "..\YSI_Internal\y_compilerpass" 2 | #if AUTO_INCLUDE_GUARD 3 | #undef _inc_y_stringhash 4 | #endif 5 | 6 | #include "..\YSI_Coding\y_stringhash" 7 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerDeath.pwn: -------------------------------------------------------------------------------- 1 | // OnPlayerDeath mhook. 2 | mhook OnPlayerDeath(playerid) { 3 | AC_players[playerid][AC_pState] &= ~AC_psSpawn; 4 | return 1; 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled sources # 2 | ################### 3 | *.amx 4 | *.exe 5 | *.pdb 6 | 7 | # Other files # 8 | ################### 9 | *.atom-build.json 10 | *.log 11 | *_log.txt 12 | server_log.txt 13 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerCommandText.pwn: -------------------------------------------------------------------------------- 1 | mhook OnPlayerCommandText(playerid, cmdtext[]) { 2 | AC_players[playerid][AC_pLastUpdate] = GetTickCount(); 3 | return 0; 4 | } 5 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerConnect.pwn: -------------------------------------------------------------------------------- 1 | // OnPlayerConnect mhook. 2 | mhook OnPlayerConnect(playerid) { 3 | AC_memset(AC_players[playerid], 0, AC_ePlayer); 4 | return 1; 5 | } 6 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerUpdate.pwn: -------------------------------------------------------------------------------- 1 | // OnPlayerUpdate mhook. 2 | mhook OnPlayerUpdate(playerid) { 3 | AC_players[playerid][AC_pLastUpdate] = GetTickCount(); 4 | return 1; 5 | } 6 | -------------------------------------------------------------------------------- /includes/YSI_Data/y_foreach/warning.inc: -------------------------------------------------------------------------------- 1 | #if defined NO_CUSTOM_WARNINGS 2 | #endinput 3 | #endif 4 | 5 | #if WARNING == 1 6 | #warning Falling back on VERY old "foreach" version - delete "foreach.inc"! 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerText.pwn: -------------------------------------------------------------------------------- 1 | // OnPlayerText mhook. 2 | mhook OnPlayerText(playerid, text[]) { 3 | AC_players[playerid][AC_pLastUpdate] = GetTickCount(); 4 | return 1; 5 | } 6 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnScriptExit.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Called when the anticheat's core is being destroyed. 3 | */ 4 | /*mhook OnScriptExit() { 5 | KillTimer(AC_watchguardTimer); 6 | return 1; 7 | }*/ 8 | -------------------------------------------------------------------------------- /includes/amx/test/disasm-test.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "disasm" 4 | 5 | forward funny_public(); 6 | 7 | main() { 8 | DisasmDump("disasm.lst"); 9 | funny_public(); 10 | } 11 | 12 | public funny_public() { 13 | } 14 | 15 | public OnGameModeInit() { 16 | printf("Hello!"); 17 | return 1; 18 | } 19 | -------------------------------------------------------------------------------- /modules/def/dialog.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/def/dialog.pwn 3 | * 4 | * DESCRIPTION : 5 | * Organize dialogs IDs. 6 | * 7 | * NOTES : 8 | * - 9 | */ 10 | 11 | enum 12 | { 13 | DIALOG_LOGIN, 14 | DIALOG_REGISTER 15 | } 16 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnScriptInit.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Called when the anticheat's core is being initialized. 3 | */ 4 | /*mhook OnScriptInit() { 5 | P:1("[anticheat] Anticheat's timer succesfully injected!"); 6 | AC_watchguardTimer = SetTimer(#AC_Watchguard, AC_WATCHGUARD_INTERVAL, true); 7 | return 1; 8 | }*/ 9 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Ping.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is using armour hack. 3 | * Player's ID. 4 | */ 5 | AC_STOCK AC_Watchguard_Ping(playerid) { 6 | if (GetPlayerPing(playerid) > AC_MAX_PING) { 7 | AC_CheatDetected(playerid, AC_cPing); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /includes/amx/test/windows/Makefile: -------------------------------------------------------------------------------- 1 | ifndef PAWNCC 2 | PAWNCC=pawncc 3 | endif 4 | 5 | INCLUDE = -i$(SAMP_SERVER_ROOT)/pawno/include -i../../ -i../../windows 6 | 7 | AMX = ShellExecute-test.amx 8 | 9 | all: clean $(AMX) 10 | 11 | ShellExecute-test.amx: ShellExecute-test.pwn 12 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 13 | 14 | clean: 15 | rm -rf $(AMX) 16 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Freeze.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is freezed and make sure it stays so. 3 | * Player's ID. 4 | */ 5 | AC_STOCK AC_Watchguard_Freeze(playerid) { 6 | if (AC_players[playerid][AC_pState] & AC_psFreeze) { 7 | TogglePlayerControllable(playerid, false); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /includes/time.inc: -------------------------------------------------------------------------------- 1 | /* Date/time functions 2 | * 3 | * (c) Copyright 2001-2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _time_included 7 | #endinput 8 | #endif 9 | #define _time_included 10 | #pragma library Time 11 | 12 | native gettime(&hour=0, &minute=0, &second=0); 13 | native getdate(&year=0, &month=0, &day=0); 14 | native tickcount(&granularity=0); 15 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Money.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is using money hack. 3 | * Player's ID. 4 | */ 5 | AC_STOCK AC_Watchguard_Money(playerid) { 6 | new bad_money = U_GetPlayerMoney(playerid), money = GetPlayerMoney(playerid); 7 | if (bad_money > money) { 8 | AC_CheatDetected(playerid, AC_cMoney); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /includes/amx/test/stack_trace-test.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../amx_header" 4 | #include "../stack_trace" 5 | 6 | forward f1(); 7 | forward f3(); 8 | 9 | main() { 10 | f1(); 11 | } 12 | 13 | public f1() { 14 | f2(); 15 | } 16 | 17 | f2() { 18 | f3(); 19 | } 20 | 21 | public f3() { 22 | new stack_trace[10]; 23 | new length = GetStackTrace(stack_trace); 24 | PrintStackTrace(stack_trace, length); 25 | #emit halt 1 26 | } 27 | -------------------------------------------------------------------------------- /server.cfg: -------------------------------------------------------------------------------- 1 | echo Executing Server Config... 2 | lanmode 0 3 | rcon_password changed 4 | maxplayers 1000 5 | port 7777 6 | hostname GTA SinglePlayer Missions 7 | gamemode0 main 1 8 | filterscripts 9 | plugins mysql streamer 10 | announce 1 11 | query 1 12 | chatlogging 0 13 | weburl www.sa-mp.com 14 | onfoot_rate 40 15 | incar_rate 40 16 | weapon_rate 40 17 | stream_distance 300.0 18 | stream_rate 1000 19 | maxnpc 500 20 | logtimeformat [%H:%M:%S] 21 | language English -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/utils/IsPlayerAFK.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is AFK. 3 | * Player's ID. 4 | * True if player is AFK, false if not. 5 | */ 6 | foreign AC_IsPlayerAFK(playerid); 7 | global AC_IsPlayerAFK(playerid) { 8 | if (IsPlayerConnected(playerid)) { 9 | return (GetTickCount() - AC_players[playerid][AC_pLastUpdate]) > AC_AFK_TIME; 10 | } 11 | return false; 12 | } 13 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Joypad.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is using a joypad. 3 | * Player's ID. 4 | */ 5 | AC_STOCK AC_Watchguard_Joypad(playerid) { 6 | new keys, ud, lr; 7 | GetPlayerKeys(playerid, keys, ud, lr); 8 | if (((ud != 128) && (ud != 0) && (ud != -128)) || ((lr != 128) && (lr != 0) && (lr != -128))) { 9 | AC_CheatDetected(playerid, AC_cJoypad); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/utils/IsPlayerSpawned.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is spawned. 3 | * Player's ID. 4 | * True if player is spawned, false if not. 5 | */ 6 | foreign AC_IsPlayerSpawned(playerid); 7 | global AC_IsPlayerSpawned(playerid) { 8 | if (IsPlayerConnected(playerid)) { 9 | return AC_players[playerid][AC_pState] & AC_psSpawn ? true : false; 10 | } 11 | return false; 12 | } 13 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/ResetPlayerMoney.pwn: -------------------------------------------------------------------------------- 1 | // ResetPlayerMoney hook. 2 | foreign AC_ResetPlayerMoney(playerid); 3 | global AC_ResetPlayerMoney(playerid) { 4 | if (IsPlayerConnected(playerid)) { 5 | AC_players[playerid][AC_pMoney] = 0; 6 | } 7 | return ResetPlayerMoney(playerid); 8 | } 9 | #if defined _ALS_ResetPlayerMoney 10 | #undef ResetPlayerMoney 11 | #else 12 | #define _ALS_ResetPlayerMoney 13 | #endif 14 | #define ResetPlayerMoney AC_ResetPlayerMoney 15 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/utils/sync/IsPlayerSynced.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks a player's sync status. 3 | * Player's ID. 4 | * Sync's ID. 5 | * True if player is synced, false if not. 6 | */ 7 | AC_STOCK AC_IsPlayerSynced(playerid, sync) { 8 | if (IsPlayerConnected(playerid)) { 9 | return (AC_players[playerid][AC_pSync] & (1 << sync)) ? true : false; 10 | } 11 | return false; 12 | } 13 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/GivePlayerMoney.pwn: -------------------------------------------------------------------------------- 1 | // GivePlayerMoney hook. 2 | foreign AC_GivePlayerMoney(playerid, money); 3 | global AC_GivePlayerMoney(playerid, money) { 4 | if (IsPlayerConnected(playerid)) { 5 | AC_players[playerid][AC_pMoney] += money; 6 | } 7 | return GivePlayerMoney(playerid, money); 8 | } 9 | #if defined _ALS_GivePlayerMoney 10 | #undef GivePlayerMoney 11 | #else 12 | #define _ALS_GivePlayerMoney 13 | #endif 14 | #define GivePlayerMoney AC_GivePlayerMoney 15 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/GetPlayerSpecialAction.pwn: -------------------------------------------------------------------------------- 1 | // GetPlayerSpecialAction hook. 2 | foreign AC_GetPlayerSpecialAction(playerid); 3 | global AC_GetPlayerSpecialAction(playerid) { 4 | if (IsPlayerConnected(playerid)) { 5 | return AC_players[playerid][AC_pSpecialAction]; 6 | } 7 | return SPECIAL_ACTION_NONE; 8 | } 9 | #if defined _ALS_GetPlayerSpecialAction 10 | #undef GetPlayerSpecialAction 11 | #else 12 | #define _ALS_GetPlayerSpecialAction 13 | #endif 14 | #define GetPlayerSpecialAction AC_GetPlayerSpecialAction 15 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/utils/GetSpeed.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Calculates the speed of an object using an Euclidean vector. 3 | * X-axis of the vector. 4 | * Y-axis of the vector. 5 | * Z-axis of the vector. 6 | * The speed. 7 | */ 8 | AC_STOCK Float:GetSpeed(Float:vx, Float:vy, Float:vz) { 9 | return floatsqroot(vx * vx + vy * vy + vz * vz) 10 | // Forward declaration is required because of the retrun value (float). 11 | } 12 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/GetPlayerMoney.pwn: -------------------------------------------------------------------------------- 1 | // GetPlayerMoney hook. 2 | foreign AC_GetPlayerMoney(playerid); 3 | global AC_GetPlayerMoney(playerid) { 4 | if (IsPlayerConnected(playerid)) { 5 | new bad_money = U_GetPlayerMoney(playerid); 6 | return bad_money < AC_players[playerid][AC_pMoney] ? bad_money : AC_players[playerid][AC_pMoney]; 7 | } 8 | return 0; 9 | } 10 | #if defined _ALS_GetPlayerMoney 11 | #undef GetPlayerMoney 12 | #else 13 | #define _ALS_GetPlayerMoney 14 | #endif 15 | #define GetPlayerMoney AC_GetPlayerMoney 16 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Jetpack.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is using jetpack hack. 3 | * Player's ID. 4 | */ 5 | AC_STOCK AC_Watchguard_Jetpack(playerid) { 6 | new bad_action = U_GetPlayerSpecialAction(playerid), action = GetPlayerSpecialAction(playerid); 7 | if ((bad_action == SPECIAL_ACTION_USEJETPACK) && (action != SPECIAL_ACTION_USEJETPACK)) { 8 | // TODO: Check if the player is near a jetpack pickup. 9 | AC_CheatDetected(playerid, AC_cJetpack); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /includes/amx/test/windows/ShellExecute-test.pwn: -------------------------------------------------------------------------------- 1 | #include "windows/ShellExecute" 2 | 3 | static stock ToCharString(s[], size = sizeof(s)) { 4 | for (new i = 0; i < size; i++) { 5 | s[i] = swapchars(s[i]); 6 | } 7 | } 8 | 9 | main() { 10 | new File[] = !"notepad.exe"; 11 | new Operation[] = !"open"; 12 | new Parameters[] = !"server.cfg"; 13 | 14 | ToCharString(File); 15 | ToCharString(Operation); 16 | ToCharString(Parameters); 17 | 18 | new result = ShellExecute(Operation, File, Parameters, SW_SHOW); 19 | printf("ShellExecute() returned %d", result); 20 | } 21 | -------------------------------------------------------------------------------- /includes/YSI_Core/y_functional.inc: -------------------------------------------------------------------------------- 1 | // Pretty much all we need. 2 | 3 | #if defined _INC_y_functional 4 | #endinput 5 | #endif 6 | #define _INC_y_functional 7 | 8 | #include "y_utils" 9 | #include y_debug 10 | #include "..\YSI_Storage\y_amx" 11 | #include "..\YSI_Coding\y_inline" 12 | 13 | #include "..\amx\disasm" 14 | #include "..\amx\asm" 15 | #include "..\amx\frame_info" 16 | 17 | #include "y_functional/impl" 18 | #include "y_functional/rewrite" 19 | 20 | #if defined YSI_TESTS 21 | #include "..\YSI_Core\y_testing" 22 | #include "y_functional/tests" 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /includes/amx/test/phys_memory-test.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "amx" 4 | #include "phys_memory" 5 | 6 | ToCharString(s[], size = sizeof(s)) { 7 | for (new i = 0; i < size; i++) { 8 | s[i] = swapchars(s[i]); 9 | } 10 | } 11 | 12 | main() { 13 | printf("AMX address: %x", GetAmxAddress()); 14 | printf("AMX base address: %x", GetAmxBaseAddress()); 15 | 16 | new s[24 char]; 17 | new s2[24]; 18 | 19 | ReadPhysMemory(0x004AB8CC, s); 20 | ToCharString(s); 21 | 22 | strunpack(s2, s); 23 | print(s2); // prints "SA-MP Dedicated Server" on SA-MP 0.3d R2 24 | } 25 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/SetPlayerArmour.pwn: -------------------------------------------------------------------------------- 1 | // SetPlayerArmour hook. 2 | foreign AC_SetPlayerArmour(playerid, Float:armour); 3 | global AC_SetPlayerArmour(playerid, Float:armour) { 4 | if (IsPlayerConnected(playerid)) { 5 | AC_players[playerid][AC_pArmour] = armour; 6 | AC_SetPlayerSync(playerid, AC_sArmour, false); 7 | } 8 | return SetPlayerArmour(playerid, armour); 9 | } 10 | #if defined _ALS_SetPlayerArmour 11 | #undef SetPlayerArmour 12 | #else 13 | #define _ALS_SetPlayerArmour 14 | #endif 15 | #define SetPlayerArmour AC_SetPlayerArmour 16 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/SetPlayerHealth.pwn: -------------------------------------------------------------------------------- 1 | // SetPlayerHealth hook. 2 | foreign AC_SetPlayerHealth(playerid, Float:health); 3 | global AC_SetPlayerHealth(playerid, Float:health) { 4 | if (IsPlayerConnected(playerid)) { 5 | AC_players[playerid][AC_pHealth] = health; 6 | AC_SetPlayerSync(playerid, AC_sHealth, false); 7 | } 8 | return SetPlayerHealth(playerid, health); 9 | } 10 | #if defined _ALS_SetPlayerHealth 11 | #undef SetPlayerHealth 12 | #else 13 | #define _ALS_SetPlayerHealth 14 | #endif 15 | #define SetPlayerHealth AC_SetPlayerHealth 16 | -------------------------------------------------------------------------------- /includes/datagram.inc: -------------------------------------------------------------------------------- 1 | /* Datagram sending/receiving 2 | * 3 | * (c) Copyright 2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _datagram_included 7 | #endinput 8 | #endif 9 | #define _datagram_included 10 | #pragma library DGram 11 | 12 | native sendstring(const message[], const destination[]=""); 13 | native sendpacket(const packet[], size, const destination[]=""); 14 | 15 | native listenport(port); 16 | 17 | forward @receivestring(const message[], const source[]); 18 | forward @receivepacket(const packet[], size, const source[]); 19 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/SetPlayerSpecialAction.pwn: -------------------------------------------------------------------------------- 1 | // SetPlayerSpecialAction hook. 2 | foreign AC_SetPlayerSpecialAction(playerid, actionid); 3 | global AC_SetPlayerSpecialAction(playerid, actionid) { 4 | if (IsPlayerConnected(playerid)) { 5 | AC_players[playerid][AC_pSpecialAction] = actionid; 6 | } 7 | return SetPlayerSpecialAction(playerid, actionid); 8 | } 9 | #if defined _ALS_SetPlayerSpecialAction 10 | #undef SetPlayerSpecialAction 11 | #else 12 | #define _ALS_SetPlayerSpecialAction 13 | #endif 14 | #define SetPlayerSpecialAction AC_SetPlayerSpecialAction 15 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/TogglePlayerSpectating.pwn: -------------------------------------------------------------------------------- 1 | // TogglePlayerSpectating hook. 2 | foreign AC_TogglePlayerSpectating(playerid, toggle); 3 | global AC_TogglePlayerSpectating(playerid, toggle) { 4 | if (IsPlayerConnected(playerid)) { 5 | if (toggle) { 6 | AC_players[playerid][AC_pState] &= ~AC_psSpawn; 7 | } 8 | } 9 | return TogglePlayerSpectating(playerid, toggle); 10 | } 11 | #if defined _ALS_TogglePlayerSpectating 12 | #undef TogglePlayerSpectating 13 | #else 14 | #define _ALS_TogglePlayerSpectating 15 | #endif 16 | #define TogglePlayerSpectating AC_TogglePlayerSpectating 17 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerSpawn.pwn: -------------------------------------------------------------------------------- 1 | // OnPlayerSpawn mhook. 2 | mhook OnPlayerSpawn(playerid) { 3 | AC_players[playerid][AC_pState] = 0; 4 | AC_players[playerid][AC_pState] |= AC_psSpawn; 5 | AC_players[playerid][AC_pState] &= ~AC_psFreeze; 6 | AC_players[playerid][AC_pSync] = 0; 7 | AC_players[playerid][AC_pLastUpdate] = GetTickCount(); 8 | AC_players[playerid][AC_pHealth] = 100.0; 9 | AC_players[playerid][AC_pArmour] = 0.0; 10 | // TODO: Update position. 11 | // TODO: Update weapons. 12 | AC_players[playerid][AC_pSpecialAction] = SPECIAL_ACTION_NONE; 13 | return 1; 14 | } 15 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/utils/IsPlayerAtVendingMachine.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is around a vending machine. 3 | * Player's ID. 4 | * True if the player is near a vending machine or false if not. 5 | */ 6 | AC_STOCK AC_IsPlayerAtVendingMachine(playerid) { 7 | for (new i = 0; i != sizeof(AC_VENDING_MACHINES); ++i) { 8 | if (IsPlayerInRangeOfPoint(playerid, AC_VENDING_MACHINE_RANGE, AC_VENDING_MACHINES[i][0], AC_VENDING_MACHINES[i][1], AC_VENDING_MACHINES[i][2])) { 9 | return true; 10 | } 11 | } 12 | return false; 13 | } 14 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Armour.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is using armour hack. 3 | * Player's ID. 4 | */ 5 | AC_STOCK AC_Watchguard_Armour(playerid) { 6 | new Float:armour; 7 | GetPlayerArmour(playerid, armour); 8 | if (!AC_IsPlayerSynced(playerid, AC_sArmour)) { 9 | AC_SetPlayerSync(playerid, AC_sArmour, armour == AC_players[playerid][AC_pArmour]); 10 | } else { 11 | if (armour > AC_players[playerid][AC_pArmour]) { 12 | AC_CheatDetected(playerid, AC_cArmour); 13 | } 14 | AC_players[playerid][AC_pArmour] = armour; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Health.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Checks if a player is using health hack. 3 | * Player's ID. 4 | */ 5 | AC_STOCK AC_Watchguard_Health(playerid) { 6 | new Float:health; 7 | GetPlayerHealth(playerid, health); 8 | if (!AC_IsPlayerSynced(playerid, AC_sHealth)) { 9 | AC_SetPlayerSync(playerid, AC_sHealth, health == AC_players[playerid][AC_pHealth]); 10 | } else { 11 | if ((!AC_IsPlayerAtVendingMachine(playerid)) && (health > AC_players[playerid][AC_pHealth])) { 12 | AC_CheatDetected(playerid, AC_cHealth); 13 | } 14 | AC_players[playerid][AC_pHealth] = health; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /includes/YSI_Data/y_bintree/tests.inc: -------------------------------------------------------------------------------- 1 | Test:y_bintree_1() 2 | { 3 | new BinaryInput:values<100>; 4 | for (new i = 0; i != sizeof (values); ++i) 5 | { 6 | values[i][E_BINTREE_INPUT_VALUE] = i; 7 | values[i][E_BINTREE_INPUT_POINTER] = i * 2 + 1; 8 | } 9 | new BinaryTree:tree<100>; 10 | Bintree_Generate(tree, values); 11 | for (new i = 0; i != sizeof (values); ++i) 12 | { 13 | ASSERT(Bintree_FindValue(tree, i) == i * 2 + 1); 14 | } 15 | for (new i = -100; i != 0; ++i) 16 | { 17 | ASSERT(Bintree_FindValue(tree, i) == BINTREE_NOT_FOUND); 18 | } 19 | for (new i = sizeof (values); i != 1000; ++i) 20 | { 21 | ASSERT(Bintree_FindValue(tree, i) == BINTREE_NOT_FOUND); 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/hooks/natives/TogglePlayerControllable.pwn: -------------------------------------------------------------------------------- 1 | // TogglePlayerControllable hook. 2 | foreign AC_TogglePlayerControllable(playerid, toggle); 3 | global AC_TogglePlayerControllable(playerid, toggle) { 4 | if (IsPlayerConnected(playerid)) { 5 | if (toggle) { 6 | AC_players[playerid][AC_pState] &= ~AC_psFreeze; 7 | } else { 8 | AC_players[playerid][AC_pState] |= AC_psFreeze; 9 | } 10 | } 11 | return TogglePlayerControllable(playerid, toggle); 12 | } 13 | #if defined _ALS_TogglePlayerControllable 14 | #undef TogglePlayerControllable 15 | #else 16 | #define _ALS_TogglePlayerControllable 17 | #endif 18 | #define TogglePlayerControllable AC_TogglePlayerControllable 19 | -------------------------------------------------------------------------------- /includes/YSI_Extra/y_extra.inc: -------------------------------------------------------------------------------- 1 | #if defined _INC_y_extra 2 | #endinput 3 | #endif 4 | #define _INC_y_extra 5 | 6 | #tryinclude 7 | #tryinclude 8 | 9 | #if !defined sscanf || !defined WP_Hash 10 | #error y_extra requires plugins - please install sscanf and whirlpool. 11 | #endif 12 | 13 | // If you want to use y_extra, you need to use these (but nothing else). 14 | #include "..\YSI_Visual\y_commands" 15 | #include "..\YSI_Players\y_text" 16 | 17 | #if defined _inc_y_users 18 | #include "extra\y_extra_users" 19 | #endif 20 | 21 | // Don't need to check for y_languages being included as it's done by y_text. 22 | #include "extra\y_extra_languages" 23 | 24 | #include "extra\y_extra_other" 25 | -------------------------------------------------------------------------------- /includes/a_sampdb.inc: -------------------------------------------------------------------------------- 1 | /* SA-MP Native SQLite Database Functions 2 | * 3 | * (c) Copyright 2007, SA-MP Team 4 | * 5 | */ 6 | 7 | #if defined _sampdb_included 8 | #endinput 9 | #endif 10 | #define _sampdb_included 11 | #pragma library sampdb 12 | 13 | native DB:db_open(name[]); 14 | native db_close(DB:db); 15 | native DBResult:db_query(DB:db,query[]); 16 | native db_free_result(DBResult:dbresult); 17 | native db_num_rows(DBResult:dbresult); 18 | native db_next_row(DBResult:dbresult); 19 | native db_num_fields(DBResult:dbresult); 20 | native db_field_name(DBResult:dbresult, field, result[], maxlength); 21 | native db_get_field(DBResult:dbresult, field, result[], maxlength); 22 | native db_get_field_assoc(DBResult:dbresult, const field[], result[], maxlength); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------- 3 | A gamemode for SA-MP where the player can play the story mode missions with cutscenes (where possible). 4 | 5 | Contributions are greatly appreciated. Please fork this repository and open a pull request to add missions, fixes, improvements, etc. 6 | 7 | Setting up 8 | ------------- 9 | You need [MySQL plugin](http://forum.sa-mp.com/showthread.php?t=56564) in order to run the gamemode. 10 | 11 | Create a database called gtamissions and import the players.sql table. 12 | 13 | Done. 14 | 15 | Creating missions 16 | ------------- 17 | Check the wiki for instructions. 18 | 19 | Pictures 20 | ------------- 21 | ![alt text](http://i.imgur.com/nseLAgu.jpg "Actual Gameplay") 22 | ![alt text](http://i.imgur.com/YVp6zAV.png "Actual Gameplay") 23 | -------------------------------------------------------------------------------- /includes/YSI_AC/.gitignore: -------------------------------------------------------------------------------- 1 | # ========================= 2 | # Anticheat test 3 | # ========================= 4 | test-server/server_log.txt 5 | 6 | # ========================= 7 | # Linux 8 | # ========================= 9 | 10 | .* 11 | !.gitignore 12 | *~ 13 | 14 | # ========================= 15 | # OS X 16 | # ========================= 17 | 18 | .DS_Store 19 | .AppleDouble 20 | .LSOverride 21 | Icon 22 | 23 | # Thumbnails 24 | ._* 25 | 26 | # Files that might appear on external disk 27 | .Spotlight-V100 28 | .Trashes 29 | 30 | # ========================= 31 | # Windows 32 | # ========================= 33 | 34 | # Windows image file caches 35 | Thumbs.db 36 | ehthumbs.db 37 | 38 | # Folder config file 39 | Desktop.ini 40 | 41 | # Recycle Bin used on file shares 42 | $RECYCLE.BIN/ -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/utils/sync/SetPlayerSync.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Sets a player's sync status. 3 | * Player's ID. 4 | * Sync's ID. 5 | * Is player synced or not? 6 | */ 7 | AC_STOCK AC_SetPlayerSync(playerid, sync, status = true) { 8 | if (IsPlayerConnected(playerid)) { 9 | if (status) { 10 | AC_players[playerid][AC_pSync] |= 1 << sync; 11 | AC_players[playerid][AC_pSyncFails][sync] = 0; 12 | } else { 13 | AC_players[playerid][AC_pSync] &= ~(1 << sync); 14 | ++AC_players[playerid][AC_pSyncFails][sync]; 15 | if (AC_players[playerid][AC_pSyncFails][sync] % AC_SYNC_MAX_FAILS == 0) { 16 | AC_CheatDetected(playerid, AC_cSync, sync, ""); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/utils/CheatDetected.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Triggers the `Anticheat_OnCheatDetected` callback. 3 | * Player's ID. 4 | * Cheat ID. 5 | * Additional cheat ID (depends on hack tool, detection method, etc.). 6 | * Additional information. 7 | */ 8 | AC_STOCK AC_CheatDetected(playerid, cheatid, extraid = 0, info[] = "") { 9 | P:1("[anticheat] AC_CheatDetected(playerid = %d, cheatid = %d, extraid = %d, info = %s", playerid, cheatid, extraid, info); 10 | if (isnull(info)) { 11 | CallLocalFunction(#AC_OnCheatDetected, "iiis", playerid, cheatid, extraid, "\1"); 12 | } else { 13 | CallLocalFunction(#AC_OnCheatDetected, "iiis", playerid, cheatid, extraid, info); 14 | } 15 | } -------------------------------------------------------------------------------- /includes/amx/test/dynamic_call-test.pwn: -------------------------------------------------------------------------------- 1 | #include "dynamic_call" 2 | 3 | forward test(i, &j, s[], t[]); 4 | 5 | main() { 6 | new x = 456; 7 | 8 | print("public - method #1"); 9 | CallFunction(GetPublicAddressFromName("test"), 123, ref(x), ref("hell"), ref("yeah")); 10 | 11 | print("public - method #2"); 12 | Push(123); 13 | Push(ref(x)); 14 | Push(ref("hell")); 15 | Push(ref("yeah")); 16 | Call(GetPublicAddressFromName("test")); 17 | 18 | print("native - method #1"); 19 | CallNativeByAddress(GetNativeAddressFromName("printf"), ref("Hello, %s!"), ref("World")); 20 | 21 | print("native - method #2"); 22 | Push(ref("Hello, %s!")); 23 | Push(ref("World")); 24 | SysreqD(GetNativeAddressFromName("printf")); 25 | } 26 | 27 | public test(i, &j, s[], t[]) { 28 | printf("test: %d %d %s %s", i, j, s, t); 29 | } 30 | -------------------------------------------------------------------------------- /includes/a_http.inc: -------------------------------------------------------------------------------- 1 | /* SA-MP threaded HTTP/1.0 client for pawn 2 | * 3 | * (c) Copyright 2010, SA-MP Team 4 | * 5 | */ 6 | 7 | // HTTP requests 8 | #define HTTP_GET 1 9 | #define HTTP_POST 2 10 | #define HTTP_HEAD 3 11 | 12 | // HTTP error response codes 13 | // These codes compliment ordinary HTTP response codes returned in 'response_code' 14 | // (10x) (20x OK) (30x Moved) (40x Unauthorised) (50x Server Error) 15 | #define HTTP_ERROR_BAD_HOST 1 16 | #define HTTP_ERROR_NO_SOCKET 2 17 | #define HTTP_ERROR_CANT_CONNECT 3 18 | #define HTTP_ERROR_CANT_WRITE 4 19 | #define HTTP_ERROR_CONTENT_TOO_BIG 5 20 | #define HTTP_ERROR_MALFORMED_RESPONSE 6 21 | 22 | native HTTP(index, type, url[], data[], callback[]); 23 | 24 | // example HTTP callback: public MyHttpResponse(index, response_code, data[]) { ... } -------------------------------------------------------------------------------- /modules/def/missions.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/def/missions.pwn 3 | * 4 | * DESCRIPTION : 5 | * List and constants of current implemented missions. 6 | * 7 | * NOTES : 8 | * - 9 | */ 10 | 11 | #include 12 | 13 | enum Mission (+=1) 14 | { 15 | MISSION_INTRO, 16 | MISSION_SWEET_CALL = 1, 17 | MISSION_HOME_INVASION 18 | } 19 | static Mission:gplAccomplishedMissions[MAX_PLAYERS]; 20 | 21 | Mission:GetPlayerCurrentMission(playerid) 22 | { 23 | return gplAccomplishedMissions[playerid]; 24 | } 25 | 26 | SetPlayerCurrentMission(playerid, Mission:missionid) 27 | { 28 | gplAccomplishedMissions[playerid] = missionid; 29 | } 30 | 31 | hook OnPlayerConnect(playerid) 32 | { 33 | gplAccomplishedMissions[playerid] = MISSION_INTRO; 34 | return 1; 35 | } 36 | -------------------------------------------------------------------------------- /includes/core.inc: -------------------------------------------------------------------------------- 1 | /* Core functions 2 | * 3 | * (c) Copyright 1998-2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _core_included 7 | #endinput 8 | #endif 9 | #define _core_included 10 | #pragma library Core 11 | 12 | native heapspace(); 13 | 14 | native funcidx(const name[]); 15 | 16 | native numargs(); 17 | native getarg(arg, index=0); 18 | native setarg(arg, index=0, value); 19 | 20 | native tolower(c); 21 | native toupper(c); 22 | native swapchars(c); 23 | 24 | native random(max); 25 | 26 | native min(value1, value2); 27 | native max(value1, value2); 28 | native clamp(value, min=cellmin, max=cellmax); 29 | 30 | native getproperty(id=0, const name[]="", value=cellmin, string[]=""); 31 | native setproperty(id=0, const name[]="", value=cellmin, const string[]=""); 32 | native deleteproperty(id=0, const name[]="", value=cellmin); 33 | native existproperty(id=0, const name[]="", value=cellmin); 34 | 35 | -------------------------------------------------------------------------------- /includes/YSI_Core/y_master/_cleanup.inc: -------------------------------------------------------------------------------- 1 | #if AUTO_INCLUDE_GUARD 2 | #undef _inc__cleanup 3 | #endif 4 | 5 | // Remote hook 6 | #undef RH 7 | 8 | // Remote timer 9 | #undef RT 10 | 11 | // Remote command 12 | #undef RC 13 | 14 | // Remote ALS 15 | #undef RA 16 | 17 | #undef Master_Caller 18 | 19 | // New hooks 20 | #undef master_hook 21 | #undef master_task 22 | #undef master_ptask 23 | #undef master_func 24 | #undef group_hook 25 | #undef @foreign 26 | #undef foreign 27 | #undef global 28 | 29 | //#undef Master_Init 30 | 31 | // Clear any previous settings. 32 | #undef YSIM_HAS_MASTER 33 | #undef _YSIM_IS_CLIENT 34 | #undef _YSIM_IS_SERVER 35 | #undef _YSIM_IS_CLOUD 36 | #undef _YSIM_IS_STUB 37 | 38 | #undef _YCM 39 | #undef MAKE_YCM 40 | #undef _YCM@ 41 | 42 | #if defined YSIM_DEFINED 43 | // Everything else in this file will already be set. This might not. 44 | #undef YSIM_DEFINED 45 | #endif 46 | 47 | #if defined _MASTER 48 | #undef _MASTER 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /includes/amx/test/asm-test.pwn: -------------------------------------------------------------------------------- 1 | #include "../asm" 2 | #include "../dynamic_call" 3 | 4 | forward HandleAsmError(ctx[AsmContext], AsmError:error); 5 | 6 | main() { 7 | // Have to use print() somewhere to make GetNativeAddressFromName() work. 8 | print("Doing #emit at runtime!"); 9 | 10 | new code[10]; 11 | new ctx[AsmContext]; 12 | 13 | AsmInit(ctx, code); 14 | AsmSetErrorHandler(ctx, GetPublicAddressFromName("HandleAsmError")); 15 | 16 | // Build a function that prints a string and returns: 17 | // 18 | // PrintString(const string[]) { 19 | // printf(string); 20 | // } 21 | // 22 | // NOTE: "print" must be called somwhere else in order to for this work! 23 | 24 | @emit proc 25 | @emit push.arg 0 26 | @emit push.num.args 1 27 | @emit sysreq "print" 28 | @emit pop.args 1 29 | @emit retn 30 | 31 | if (AsmGetError(ctx) == ASM_ERROR_NONE) { 32 | CallFunction(AsmGetCode(ctx), ref("Hello!")); 33 | } 34 | } 35 | 36 | public HandleAsmError(ctx[AsmContext]) { 37 | printf("AsmError: %d", _:AsmGetError(ctx)); 38 | } 39 | -------------------------------------------------------------------------------- /includes/YSI_Extra/y_extra_other.inc: -------------------------------------------------------------------------------- 1 | #if defined _INC_y_extra_other 2 | #endinput 3 | #endif 4 | #define _INC_y_extra_other 5 | 6 | // Include pretty much 90% of YSI in one fell swoop! 7 | 8 | loadtext core[ysi_commands], core[ysi_help]; 9 | 10 | YCMD:commands(playerid, params[], help) 11 | { 12 | if (help) 13 | { 14 | Text_Send(playerid, $YSI_COMM_HELP); 15 | } 16 | else 17 | { 18 | new 19 | count = Command_GetPlayerCommandCount(playerid); 20 | for (new i = 0; i != count; ++i) 21 | { 22 | Text_Send(playerid, $YSI_COMM_LIST, Command_GetNext(i, playerid)); 23 | } 24 | } 25 | return 1; 26 | } 27 | 28 | YCMD:help(playerid, params[], help) 29 | { 30 | if (help) 31 | { 32 | Text_Send(playerid, $YSI_HELP); 33 | } 34 | else 35 | { 36 | if (isnull(params)) 37 | { 38 | Text_Send(playerid, $YSI_HELP); 39 | } 40 | else 41 | { 42 | Command_ReProcess(playerid, params, true); 43 | } 44 | } 45 | return 1; 46 | } 47 | -------------------------------------------------------------------------------- /includes/amx/test/Makefile: -------------------------------------------------------------------------------- 1 | ifndef PAWNCC 2 | PAWNCC = pawncc 3 | endif 4 | 5 | INCLUDE = -i$(SAMP_SERVER_ROOT)/pawno/include -i../ 6 | 7 | AMX = amx-test.amx 8 | AMX += asm-test.amx 9 | AMX += disasm-test.amx 10 | AMX += dynamic_call-test.amx 11 | AMX += jit-test.amx 12 | AMX += phys_memory-test.amx 13 | AMX += stack_trace-test.amx 14 | 15 | all: clean $(AMX) windows 16 | 17 | amx-test.amx: amx-test.pwn 18 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 19 | 20 | asm-test.amx: asm-test.pwn 21 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 22 | 23 | disasm-test.amx: disasm-test.pwn 24 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 25 | 26 | dynamic_call-test.amx: dynamic_call-test.pwn 27 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 28 | 29 | jit-test.amx: jit-test.pwn 30 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 31 | 32 | phys_memory-test.amx: phys_memory-test.pwn 33 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 34 | 35 | stack_trace-test.amx: stack_trace-test.pwn 36 | $(PAWNCC) $(PFLAGS) $(INCLUDE) $^ -o$@ 37 | 38 | clean: $(SUBDIRS) 39 | rm -rf $(AMX) 40 | 41 | .PHONY: windows 42 | windows: 43 | $(MAKE) -C $@ 44 | 45 | -------------------------------------------------------------------------------- /includes/a_actor.inc: -------------------------------------------------------------------------------- 1 | /* SA-MP Actor Functions 2 | * 3 | * (c) Copyright 2015, SA-MP Team 4 | * 5 | */ 6 | 7 | #if defined _actor_included 8 | #endinput 9 | #endif 10 | #define _actor_included 11 | #pragma library actors 12 | 13 | native CreateActor(modelid, Float:X, Float:Y, Float:Z, Float:Rotation); 14 | native DestroyActor(actorid); 15 | 16 | native IsActorStreamedIn(actorid, forplayerid); 17 | 18 | native SetActorVirtualWorld(actorid, vworld); 19 | native GetActorVirtualWorld(actorid); 20 | 21 | native ApplyActorAnimation(actorid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time); 22 | native ClearActorAnimations(actorid); 23 | 24 | native SetActorPos(actorid, Float:X, Float:Y, Float:Z); 25 | native GetActorPos(actorid, &Float:X, &Float:Y, &Float:Z); 26 | native SetActorFacingAngle(actorid, Float:ang); 27 | native GetActorFacingAngle(actorid, &Float:ang); 28 | 29 | native SetActorHealth(actorid, Float:health); 30 | native GetActorHealth(actorid, &Float:health); 31 | native SetActorInvulnerable(actorid, invulnerable = true); 32 | native IsActorInvulnerable(actorid); 33 | 34 | native IsValidActor(actorid); -------------------------------------------------------------------------------- /includes/YSI_Extra/y_extra_languages.inc: -------------------------------------------------------------------------------- 1 | #if defined _INC_y_extra_languages 2 | #endinput 3 | #endif 4 | #define _INC_y_extra_languages 5 | 6 | // Include pretty much 90% of YSI in one fell swoop! 7 | 8 | loadtext core[ysi_langs]; 9 | 10 | YCMD:language(playerid, params[], help) 11 | { 12 | if (help) 13 | { 14 | Text_Send(playerid, $YSI_LANGS_HELP); 15 | } 16 | else 17 | { 18 | new 19 | lang; 20 | if (sscanf(params, "i", lang)) 21 | { 22 | new 23 | c = _:Langs_GetLanguageCount(), 24 | Language:i = Language:0; 25 | while (c) 26 | { 27 | new 28 | code[3]; 29 | strcpy(code, Langs_GetCode(i)); 30 | if (!isnull(code)) 31 | { 32 | // They may not be in order. 33 | Text_Send(playerid, $YSI_LANGS_DISP, _:i, Langs_GetName(i), code); 34 | --c; 35 | } 36 | ++i; 37 | } 38 | Text_Send(playerid, $YSI_LANGS_SET, YCMD:language); 39 | } 40 | else if (Langs_SetPlayerLanguage(playerid, Language:lang) == NO_LANGUAGE) 41 | { 42 | Text_Send(playerid, $YSI_LANGS_INV); 43 | } 44 | else 45 | { 46 | Text_Send(playerid, $YSI_LANGS_DONE, lang, Langs_GetName(Language:lang)); 47 | } 48 | } 49 | return 1; 50 | } 51 | -------------------------------------------------------------------------------- /includes/YSI_AC/NOTES.md: -------------------------------------------------------------------------------- 1 | Cheats 2 | ------ 3 | 4 | The list below shows cheats IDs and additional information that is passed via AC_OnCheatDetected. 5 | 6 | * __ID = 0: unknown hack__ 7 | 8 | Extra parameter is reserved for debugging purposes. 9 | 10 | * __ID = 1: desync__ 11 | 12 | Extra parameter is reserved for sync type. 13 | 14 | * __ID = 2: high ping__ 15 | 16 | Extra parameter is reserved for actual ping. 17 | 18 | * __ID = 3: low fps__ 19 | 20 | Extra parameter is reserved for actual FPS rate. 21 | 22 | * __ID = 4: afk__ 23 | 24 | Extra parameter is `true` if player is AFK now and `false` if it isn't anymore. 25 | 26 | * __ID = 5: health hack__ 27 | * __ID = 6: armour hack__ 28 | * __ID = 7: money hack__ 29 | * __ID = 8: fake kill__ 30 | * __ID = 9: teleport hack__ 31 | * __ID = 10: speed hack__ 32 | * __ID = 11: fly hack__ 33 | * __ID = 12: airbreak hack__ 34 | * __ID = 13: weapon hack__ 35 | * __ID = 14: joypad__ 36 | * __ID = 15: aim bot__ 37 | * __ID = 16: jetpack hack__ 38 | * __ID = 17: vehicle warp hack__ 39 | * __ID = 18: vehicle repair hack__ 40 | * __ID = 19: vehicle (illegal) mod__ 41 | * __ID = 20: RCON bruteforcer__ 42 | * __ID = 21: m0d_sa (hacking tool)__ 43 | -------------------------------------------------------------------------------- /includes/string.inc: -------------------------------------------------------------------------------- 1 | /* String functions 2 | * 3 | * (c) Copyright 2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _string_included 7 | #endinput 8 | #endif 9 | #define _string_included 10 | #pragma library String 11 | 12 | native strlen(const string[]); 13 | native strpack(dest[], const source[], maxlength=sizeof dest); 14 | native strunpack(dest[], const source[], maxlength=sizeof dest); 15 | native strcat(dest[], const source[], maxlength=sizeof dest); 16 | 17 | native strmid(dest[], const source[], start, end, maxlength=sizeof dest); 18 | native bool: strins(string[], const substr[], pos, maxlength=sizeof string); 19 | native bool: strdel(string[], start, end); 20 | 21 | native strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax); 22 | native strfind(const string[], const sub[], bool:ignorecase=false, pos=0); 23 | 24 | native strval(const string[]); 25 | native valstr(dest[], value, bool:pack=false); 26 | native bool: ispacked(const string[]); 27 | 28 | native uudecode(dest[], const source[], maxlength=sizeof dest); 29 | native uuencode(dest[], const source[], numbytes, maxlength=sizeof dest); 30 | native memcpy(dest[], const source[], index=0, numbytes, maxlength=sizeof dest); 31 | -------------------------------------------------------------------------------- /includes/YSI_AC/README.md: -------------------------------------------------------------------------------- 1 | SA-MP Anticheat 2 | =============== 3 | 4 | This library provides protection against popular hacks. 5 | 6 | Building 7 | -------- 8 | 9 | You can build this library using the Python utility located in `pawncc/builder.py`. This utility merges all components in one single file. 10 | Sample of usage: `pawncc/builder.py ./src ./Anticheat.inc` 11 | 12 | Installation 13 | ------------ 14 | 15 | For this library to run normally it requires a __master script__. The master script represents the place where data is handled and the actual cheat detection process occurs. Additionally, if there is more than one script that modifies vital information the anticheat must be included in those aswell. Those scripts are called __slave scripts__. 16 | 17 | __WARNING!__ If there is more than one master instance per server the server might report players that aren't actually cheating. 18 | 19 | 1. Include the Anticheat in your script: 20 | * __Master (core)__: 21 | 22 | #define ANTICHEAT_MASTER 23 | #include 24 | * __Slave__: 25 | 26 | #define ANTICHEAT_SLAVE 27 | #include 28 | 2. Compile your script. 29 | 30 | _For more advanced information about this library, please read [NOTES.md](https://github.com/udan11/samp-anticheat/blob/master/NOTES.md)._ -------------------------------------------------------------------------------- /includes/YSI_AC/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Dan 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /modules/def/ftime.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/def/ftime.pwn 3 | * 4 | * DESCRIPTION : 5 | * Global constants and functions to check if the player is doing something 6 | * for the first time. 7 | * 8 | * NOTES : 9 | * - 10 | */ 11 | 12 | //------------------------------------------------------------------------------ 13 | 14 | #include 15 | 16 | // Maximum 32 values per variable 17 | enum FirstTime:(<<= 1) 18 | { 19 | INVALID_FIRST_TIME_ACTION, 20 | FIRST_TIME_HOSPITAL = 1 21 | } 22 | static FirstTime:gplFirstTime[MAX_PLAYERS]; 23 | 24 | //------------------------------------------------------------------------------ 25 | 26 | SetPlayerFirstTime(playerid, FirstTime:id, bool:set) 27 | { 28 | if(set) 29 | gplFirstTime[playerid] |= id; 30 | else 31 | gplFirstTime[playerid] &= ~id; 32 | } 33 | 34 | //------------------------------------------------------------------------------ 35 | 36 | bool:GetPlayerFirstTime(playerid, FirstTime:id) 37 | { 38 | if(gplFirstTime[playerid] & id) 39 | return true; 40 | return false; 41 | } 42 | 43 | //------------------------------------------------------------------------------ 44 | 45 | hook OnPlayerConnect(playerid) 46 | { 47 | gplFirstTime[playerid] = INVALID_FIRST_TIME_ACTION; 48 | return 1; 49 | } 50 | -------------------------------------------------------------------------------- /includes/file.inc: -------------------------------------------------------------------------------- 1 | /* File input/output functions 2 | * 3 | * (c) Copyright 2004-2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _file_included 7 | #endinput 8 | #endif 9 | #define _file_included 10 | #pragma library File 11 | 12 | enum filemode 13 | { 14 | io_read, /* file must exist */ 15 | io_write, /* creates a new file */ 16 | io_readwrite, /* opens an existing file, or creates a new file */ 17 | io_append, /* appends to file (write-only) */ 18 | } 19 | 20 | enum seek_whence 21 | { 22 | seek_start, 23 | seek_current, 24 | seek_end, 25 | } 26 | 27 | const EOF = -1; 28 | 29 | native File:fopen(const name[], filemode: mode = io_readwrite); 30 | native bool:fclose(File: handle); 31 | native File:ftemp(); 32 | native bool:fremove(const name[]); 33 | 34 | native fwrite(File: handle, const string[]); 35 | native fread(File: handle, string[], size = sizeof string, bool: pack = false); 36 | native bool:fputchar(File: handle, value, bool: utf8 = true); 37 | native fgetchar(File: handle, value, bool: utf8 = true); 38 | native fblockwrite(File: handle, const buffer[], size = sizeof buffer); 39 | native fblockread(File: handle, buffer[], size = sizeof buffer); 40 | 41 | native fseek(File: handle, position = 0, seek_whence: whence = seek_start); 42 | native flength(File: handle); 43 | native fexist(const pattern[]); 44 | native bool:fmatch(name[], const pattern[], index = 0, size = sizeof name); 45 | -------------------------------------------------------------------------------- /includes/YSI_Coding/y_inline/jit.inc: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | JITed y_inline. Needs to be done ahead of time (much like the old version). 4 | 5 | Basic process: 6 | 7 | 1) Find everything that is an inline function, this will need pattern 8 | searching again as in the old version. Slow at startup, but not 9 | terrible, and fine afterwards. Note that I already scan the AMX for 10 | certain patterns, so I can scan for this too at the same time maybe. 11 | 12 | 2) Rewrite the code. The new version reads the stack at run time, this 13 | version can't so will need some more cunning method. 14 | 15 | 16 | */ 17 | 18 | static stock const 19 | YSI_g_scParameterCounts[Opcode] = 20 | { 21 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 22 | 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 23 | 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 24 | 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 25 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 26 | 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 0, 1, -1, 0, 0, 1, 0, 1, 1, 0, 27 | cellmin 28 | }; 29 | 30 | static stock 31 | YSI_g_sScanPatterns[128], 32 | YSI_g_sScanIndexes[8], 33 | YSI_g_sScanners = 0; 34 | 35 | stock Scanner_AddPattern(...) 36 | { 37 | if (YSI_g_sScanners == sizeof (YSI_g_sScanIndexes) - 1) return -1; 38 | new 39 | idx = YSI_g_sScanIndexes[YSI_g_sScanners], 40 | codes = numargs(); 41 | 42 | 43 | 44 | } 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /includes/amx/shellcode.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined SHELLCODE_INC 22 | #endinput 23 | #endif 24 | #define SHELLCODE_INC 25 | 26 | #include "amx_header" 27 | #include "dynamic_call" 28 | #include "phys_memory" 29 | 30 | stock RunShellcode(code_ptr, bool:align = true) { 31 | if (align) { 32 | code_ptr = ((code_ptr + 15) >>> 4) << 4; 33 | } 34 | return SysreqD(code_ptr); 35 | } 36 | -------------------------------------------------------------------------------- /includes/YSI_Core/y_master/_push_master.inc: -------------------------------------------------------------------------------- 1 | #if AUTO_INCLUDE_GUARD 2 | #undef _inc__push_master 3 | #endif 4 | 5 | #if _YSIM_PUSH_INDEX < 1 6 | #include "stack\_stack_push_000" 7 | #endinput 8 | #elseif _YSIM_PUSH_INDEX == 1 9 | #include "stack\_stack_push_001" 10 | #endinput 11 | #elseif _YSIM_PUSH_INDEX == 2 12 | #include "stack\_stack_push_002" 13 | #endinput 14 | #elseif _YSIM_PUSH_INDEX == 3 15 | #include "stack\_stack_push_003" 16 | #endinput 17 | #elseif _YSIM_PUSH_INDEX == 4 18 | #include "stack\_stack_push_004" 19 | #endinput 20 | #elseif _YSIM_PUSH_INDEX == 5 21 | #include "stack\_stack_push_005" 22 | #endinput 23 | #elseif _YSIM_PUSH_INDEX == 6 24 | #include "stack\_stack_push_006" 25 | #endinput 26 | #elseif _YSIM_PUSH_INDEX == 7 27 | #include "stack\_stack_push_007" 28 | #endinput 29 | #elseif _YSIM_PUSH_INDEX == 8 30 | #include "stack\_stack_push_008" 31 | #endinput 32 | #elseif _YSIM_PUSH_INDEX == 9 33 | #include "stack\_stack_push_009" 34 | #endinput 35 | #elseif _YSIM_PUSH_INDEX == 10 36 | #include "stack\_stack_push_010" 37 | #endinput 38 | #elseif _YSIM_PUSH_INDEX == 11 39 | #include "stack\_stack_push_011" 40 | #endinput 41 | #elseif _YSIM_PUSH_INDEX == 12 42 | #include "stack\_stack_push_012" 43 | #endinput 44 | #elseif _YSIM_PUSH_INDEX == 13 45 | #include "stack\_stack_push_013" 46 | #endinput 47 | #elseif _YSIM_PUSH_INDEX == 14 48 | #include "stack\_stack_push_014" 49 | #endinput 50 | #elseif _YSIM_PUSH_INDEX == 15 51 | #include "stack\_stack_push_015" 52 | #endinput 53 | #endif 54 | #error y_master MASTER stack overflow. 55 | 56 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/watchguard/Watchguard.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Anticheat's main function. Supervises players' actions. 3 | */ 4 | master_ptask AC_Watchguard[AC_WATCHGUARD_INTERVAL](playerid) { 5 | // There is no point in checking players who are AFK or aren't spawned. 6 | if (!AC_IsPlayerSpawned(playerid)) { 7 | return; 8 | } else if (AC_IsPlayerAFK(playerid)) { 9 | if ((AC_cheats[AC_cAFK][AC_ccIsEnabled]) && ((AC_players[playerid][AC_pState] & AC_psWasAFK) == 0)) { 10 | AC_CheatDetected(playerid, AC_cAFK, 1); 11 | } 12 | AC_players[playerid][AC_pState] |= AC_psWasAFK; 13 | return; 14 | } else { 15 | if ((AC_cheats[AC_cAFK][AC_ccIsEnabled]) && (AC_players[playerid][AC_pState] & AC_psWasAFK)) { 16 | AC_CheatDetected(playerid, AC_cAFK, 0); 17 | } 18 | AC_players[playerid][AC_pState] &= ~AC_psWasAFK; 19 | } 20 | // Anti-cheat modules calls. 21 | if (AC_cheats[AC_cUnknown][AC_ccIsEnabled]) { 22 | AC_Watchguard_Freeze(playerid); 23 | } 24 | if (AC_cheats[AC_cPing][AC_ccIsEnabled]) { 25 | AC_Watchguard_Ping(playerid); 26 | } 27 | if (AC_cheats[AC_cHealth][AC_ccIsEnabled]) { 28 | AC_Watchguard_Health(playerid); 29 | } 30 | if (AC_cheats[AC_cArmour][AC_ccIsEnabled]) { 31 | AC_Watchguard_Armour(playerid); 32 | } 33 | if (AC_cheats[AC_cMoney][AC_ccIsEnabled]) { 34 | AC_Watchguard_Money(playerid); 35 | } 36 | if (AC_cheats[AC_cJoypad][AC_ccIsEnabled]) { 37 | AC_Watchguard_Joypad(playerid); 38 | } 39 | if (AC_cheats[AC_cJetpack][AC_ccIsEnabled]) { 40 | AC_Watchguard_Jetpack(playerid); 41 | } 42 | // TODO: Hook other modules. 43 | } 44 | -------------------------------------------------------------------------------- /tables/players.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.3.11 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: Aug 06, 2015 at 11:02 PM 7 | -- Server version: 5.6.24 8 | -- PHP Version: 5.6.8 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8 */; 18 | 19 | -- 20 | -- Database: `gtamissions` 21 | -- 22 | 23 | -- -------------------------------------------------------- 24 | 25 | -- 26 | -- Table structure for table `players` 27 | -- 28 | 29 | CREATE TABLE IF NOT EXISTS `players` ( 30 | `id` int(10) unsigned NOT NULL, 31 | `username` varchar(24) NOT NULL, 32 | `password` varchar(32) NOT NULL, 33 | `ip` varchar(16) NOT NULL, 34 | `regdate` int(11) unsigned NOT NULL DEFAULT '0', 35 | `lastlogin` int(10) unsigned NOT NULL DEFAULT '0' 36 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; 37 | 38 | -- 39 | -- Indexes for dumped tables 40 | -- 41 | 42 | -- 43 | -- Indexes for table `players` 44 | -- 45 | ALTER TABLE `players` 46 | ADD PRIMARY KEY (`id`); 47 | 48 | -- 49 | -- AUTO_INCREMENT for dumped tables 50 | -- 51 | 52 | -- 53 | -- AUTO_INCREMENT for table `players` 54 | -- 55 | ALTER TABLE `players` 56 | MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; 57 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 58 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 59 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 60 | -------------------------------------------------------------------------------- /includes/amx/os.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined OS_INC 22 | #endinput 23 | #endif 24 | #define OS_INC 25 | 26 | #include "opcode" 27 | 28 | enum OS { 29 | OS_UNKNOWN, 30 | OS_LINUX, 31 | OS_WINDOWS 32 | }; 33 | 34 | stock OS:GetOS() { 35 | static OS:os = OS_UNKNOWN; 36 | if (os == OS_UNKNOWN) { 37 | os = RelocateOpcode(OP_LOAD_PRI) == OP_LOAD_PRI 38 | ? OS_WINDOWS 39 | : OS_LINUX; 40 | } 41 | return os; 42 | } 43 | 44 | stock bool:IsWindows() { 45 | return GetOS() == OS_WINDOWS; 46 | } 47 | 48 | stock bool:IsLinux() { 49 | return GetOS() == OS_LINUX; 50 | } 51 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/constants/player.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * The time (in ms) after a player is considered AFK. 3 | */ 4 | #define AC_AFK_TIME 1500 5 | 6 | /** 7 | * Maximum ping allowed. Whoever has a bigger ping will be reported as cheater. 8 | */ 9 | #define AC_MAX_PING 500 10 | 11 | /** 12 | * Every AC_SYNC_MAX_FAILS fails a cheat alert is triggered. 13 | */ 14 | #define AC_SYNC_MAX_FAILS 30 15 | 16 | /** 17 | * Player states. 18 | */ 19 | enum _:AC_ePlayerState (<<= 1) { 20 | AC_psSpawn = 1, // bitmask 0 21 | AC_psWasAFK, // bitmask 1 22 | AC_psFreeze, // bitmask 2 23 | AC_ps03, // bitmask 3 24 | AC_ps04, // bitmask 4 25 | AC_ps05, // bitmask 5 26 | AC_ps06, // bitmask 6 27 | AC_ps07, // bitmask 7 28 | AC_ps08, // bitmask 8 29 | AC_ps09, // bitmask 9 30 | AC_ps10, // bitmask 10 31 | AC_ps11, // bitmask 11 32 | AC_ps12, // bitmask 12 33 | AC_ps13, // bitmask 13 34 | AC_ps14, // bitmask 14 35 | AC_ps15, // bitmask 15 36 | AC_ps16, // bitmask 16 37 | AC_ps17, // bitmask 17 38 | AC_ps18, // bitmask 18 39 | AC_ps19, // bitmask 19 40 | AC_ps20, // bitmask 10 41 | AC_ps21, // bitmask 21 42 | AC_ps22, // bitmask 22 43 | AC_ps23, // bitmask 23 44 | AC_ps24, // bitmask 24 45 | AC_ps25, // bitmask 25 46 | AC_ps26, // bitmask 26 47 | AC_ps27, // bitmask 27 48 | AC_ps28, // bitmask 28 49 | AC_ps29, // bitmask 29 50 | AC_ps30, // bitmask 30 51 | AC_ps31, // bitmask 31 52 | }; 53 | 54 | /** 55 | * Sync types. 56 | */ 57 | enum _:AC_eSync { 58 | AC_sHealth, 59 | AC_sArmour 60 | }; 61 | -------------------------------------------------------------------------------- /includes/amx/heap_alloc.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined HEAP_ALLOC_INC 22 | #endinput 23 | #endif 24 | #define HEAP_ALLOC_INC 25 | 26 | #define HeapAlloc HeapAllocCells 27 | 28 | // Allocates a block of (uninitialized) memory on the heap. 29 | stock HeapAllocBytes(nbytes) { 30 | new address; 31 | #emit lctrl 2 32 | #emit stor.s.pri address 33 | #emit load.s.alt nbytes 34 | #emit add 35 | #emit sctrl 2 36 | return address; 37 | } 38 | 39 | // Same as HeapAllocBytes() but operates on cells. 40 | stock HeapAllocCells(ncells) { 41 | return HeapAllocBytes(ncells * 4); 42 | } 43 | 44 | // Releases memory allocated with HeapAlloc(). 45 | stock HeapRelease(address) { 46 | #emit load.s.pri address 47 | #emit sctrl 2 48 | return address; 49 | } 50 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/variables.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Stores a player's game data. 3 | */ 4 | enum _:AC_ePlayer { 5 | 6 | /** 7 | * Player's last known state. 8 | */ 9 | AC_pState, 10 | 11 | /** 12 | * Player's sync status. 13 | */ 14 | AC_pSync, 15 | 16 | /** 17 | * Keeps track of player's sync failures. 18 | */ 19 | AC_pSyncFails[AC_eSync], 20 | 21 | /** 22 | * Stores latest FPS measurements. 23 | */ 24 | AC_pFPS[AC_MAX_FPS_INDEX], 25 | 26 | /** 27 | * Last FPS index used. 28 | */ 29 | AC_pFPSIndex, 30 | 31 | /** 32 | * The time (in ms) when the player was last updated. 33 | */ 34 | AC_pLastUpdate, 35 | 36 | /** 37 | * Player's health. 38 | */ 39 | Float:AC_pHealth, 40 | 41 | /** 42 | * Player's armour. 43 | */ 44 | Float:AC_pArmour, 45 | 46 | /** 47 | * Player's money. 48 | */ 49 | AC_pMoney, 50 | 51 | /** 52 | * The latest time (in ms) when the player died. 53 | */ 54 | AC_pLastDeath, 55 | 56 | /** 57 | * Player's latest known position. 58 | */ 59 | Float:AC_pPos[3], 60 | 61 | /** 62 | * Player's latest known velocity. 63 | */ 64 | Float:AC_pVelocity[3], 65 | 66 | /** 67 | * Player's weapons (ID and ammo). 68 | * Two fields are used instead of a bidimensional array because Pawn doesn't support 4D arrays. 69 | */ 70 | AC_pWeaponsID[AC_MAX_WEAPON_SLOTS], 71 | AC_pWeaponsAmmo[AC_MAX_WEAPON_SLOTS], 72 | 73 | /** 74 | * Player's special action. 75 | */ 76 | AC_pSpecialAction, 77 | 78 | }; 79 | 80 | /** 81 | * Stores players' game data. 82 | */ 83 | stock AC_players[MAX_PLAYERS][AC_ePlayer]; 84 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_unqid.inc: -------------------------------------------------------------------------------- 1 | // y_textid 2 | 3 | enum E_UNIQUE_ID 4 | { 5 | E_UNIQUE_EXTERNAL, 6 | E_UNIQUE_REVISION, 7 | E_UNIQUE_INTERNAL, 8 | E_UNIQUE_FLAGS 9 | // Search using a hash map with 256 entries. 10 | E_UNIQUE_HASH_NEXT, 11 | // Combine multiple items in to a single initial ID. 12 | E_UNIQUE_LINK_NEXT 13 | } 14 | 15 | #define UniqueID:%0<%1> %0@ENTRIES[256],%0@IDS[%1][E_UNIQUE_ID],%0@EMPTY,%0@NEXT 16 | 17 | stock _Unique_Lookup(entries[256], ids[][E_UNIQUE_ID], lookup, &id, &rev, &flags) 18 | { 19 | new 20 | cur = entries[lookup & 0xFF]; // Get entry point. 21 | while (cur != -1) 22 | { 23 | if (ids[cur][E_UNIQUE_EXTERNAL] == lookup) 24 | { 25 | id = ids[cur][E_UNIQUE_INTERNAL], 26 | rev = ids[cur][E_UNIQUE_REVISION], 27 | flags = ids[cur][E_UNIQUE_FLAGS]; 28 | if (ids[cur][E_UNIQUE_LINK_NEXT] != -1) return -1; // More data. 29 | else return 1; 30 | } 31 | cur = ids[cur][E_UNIQUE_HASH_NEXT]; 32 | } 33 | return 0; 34 | } 35 | #define Unique_Lookup(%0, _Unique_Lookup(%0@ENTRIES,%0@IDS, 36 | 37 | stock _Unique_InUse(entries[256], ids[][E_UNIQUE_ID], lookup) 38 | { 39 | new 40 | cur = entries[lookup & 0xFF]; // Get entry point. 41 | while (cur != -1) 42 | { 43 | if (ids[cur][E_UNIQUE_EXTERNAL] == lookup) return 1; 44 | cur = ids[cur][E_UNIQUE_HASH_NEXT]; 45 | } 46 | return 0; 47 | } 48 | #define Unique_InUse(%0, _Unique_InUse(%0@ENTRIES,%0@IDS, 49 | 50 | stock _Unique_Assign(entries[256], ids[][E_UNIQUE_ID], &free, &next) 51 | { 52 | if (free == -1) return 0; 53 | do 54 | { 55 | if (++next == 0) ++next; 56 | } 57 | while (_Unique_InUse(entries, ids, next)); 58 | new 59 | tmp = ids[free][E_UNIQUE_HASH_NEXT]; 60 | return 61 | // Copy the data. 62 | ids[free][E_UNIQUE_EXTERNAL] = next, 63 | ++ids[free][E_UNIQUE_REVISION], 64 | // Allocate this in to the hash map. 65 | ids[free][E_UNIQUE_HASH_NEXT] = entries[next & 0xFF], 66 | entries[next & 0xFF] = free, 67 | free = tmp, 68 | // Return the ID. 69 | next; 70 | } 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /modules/player/animpreload.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/player/animpreload.pwn 3 | * 4 | * DESCRIPTION : 5 | * Preload player's animations. 6 | * 7 | * NOTES : 8 | * - 9 | */ 10 | 11 | #include 12 | 13 | //------------------------------------------------------------------------------ 14 | 15 | static bool:gplAnimationsPreLoaded[MAX_PLAYERS]; 16 | 17 | //------------------------------------------------------------------------------ 18 | 19 | PreloadAnimLib(playerid, animlib[]) 20 | { 21 | ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0); 22 | } 23 | 24 | //------------------------------------------------------------------------------ 25 | 26 | hook OnPlayerDisconnect(playerid, reason) 27 | { 28 | gplAnimationsPreLoaded[playerid] = false; 29 | return 1; 30 | } 31 | 32 | //------------------------------------------------------------------------------ 33 | 34 | hook OnPlayerSpawn(playerid) 35 | { 36 | if(!gplAnimationsPreLoaded[playerid]) 37 | { 38 | PreloadAnimLib(playerid,"SWAT"); 39 | PreloadAnimLib(playerid,"KNIFE"); 40 | PreloadAnimLib(playerid,"CRACK"); 41 | PreloadAnimLib(playerid,"POLICE"); 42 | PreloadAnimLib(playerid,"HEIST9"); 43 | PreloadAnimLib(playerid,"BLOWJOBZ"); 44 | PreloadAnimLib(playerid,"BOMBER"); 45 | PreloadAnimLib(playerid,"RAPPING"); 46 | PreloadAnimLib(playerid,"SHOP"); 47 | PreloadAnimLib(playerid,"BEACH"); 48 | PreloadAnimLib(playerid,"SMOKING"); 49 | PreloadAnimLib(playerid,"FOOD"); 50 | PreloadAnimLib(playerid,"ON_LOOKERS"); 51 | PreloadAnimLib(playerid,"DEALER"); 52 | PreloadAnimLib(playerid,"CARRY"); 53 | PreloadAnimLib(playerid,"BASEBALL"); 54 | PreloadAnimLib(playerid,"COP_AMBIENT"); 55 | PreloadAnimLib(playerid,"PARK"); 56 | PreloadAnimLib(playerid,"INT_HOUSE"); 57 | PreloadAnimLib(playerid,"CLOTHES"); 58 | PreloadAnimLib(playerid,"PED"); 59 | gplAnimationsPreLoaded[playerid] = true; 60 | } 61 | return 1; 62 | } 63 | -------------------------------------------------------------------------------- /modules/visual/cutscene.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/visual/cutscene.pwn 3 | * 4 | * DESCRIPTION : 5 | * Create functions to show black bars at top and bottom of player's screen 6 | * 7 | * NOTES : 8 | * - 9 | * 10 | */ 11 | 12 | //------------------------------------------------------------------------------ 13 | 14 | #include 15 | 16 | static Text:TOP; 17 | static Text:BOTTOM; 18 | 19 | //------------------------------------------------------------------------------ 20 | 21 | stock ShowPlayerCutsceneBars(playerid) 22 | { 23 | TextDrawShowForPlayer(playerid, TOP); 24 | TextDrawShowForPlayer(playerid, BOTTOM); 25 | } 26 | //------------------------------------------------------------------------------ 27 | 28 | stock HidePlayerCutsceneBars(playerid) 29 | { 30 | TextDrawHideForPlayer(playerid, TOP); 31 | TextDrawHideForPlayer(playerid, BOTTOM); 32 | } 33 | 34 | //------------------------------------------------------------------------------ 35 | 36 | hook OnGameModeInit() 37 | { 38 | TOP = TextDrawCreate(320.000000, 1.000000, "_"); 39 | TextDrawAlignment(TOP, 2); 40 | TextDrawBackgroundColor(TOP, 255); 41 | TextDrawFont(TOP, 1); 42 | TextDrawLetterSize(TOP, 0.500000, 8.000000); 43 | TextDrawColor(TOP, -1); 44 | TextDrawSetOutline(TOP, 0); 45 | TextDrawSetProportional(TOP, 1); 46 | TextDrawSetShadow(TOP, 1); 47 | TextDrawUseBox(TOP, 1); 48 | TextDrawBoxColor(TOP, 255); 49 | TextDrawTextSize(TOP, 0.000000, -660.000000); 50 | 51 | BOTTOM = TextDrawCreate(320.000000, 381.000000, "_"); 52 | TextDrawAlignment(BOTTOM, 2); 53 | TextDrawBackgroundColor(BOTTOM, 255); 54 | TextDrawFont(BOTTOM, 1); 55 | TextDrawLetterSize(BOTTOM, 0.500000, 8.000000); 56 | TextDrawColor(BOTTOM, -1); 57 | TextDrawSetOutline(BOTTOM, 0); 58 | TextDrawSetProportional(BOTTOM, 1); 59 | TextDrawSetShadow(BOTTOM, 1); 60 | TextDrawUseBox(BOTTOM, 1); 61 | TextDrawBoxColor(BOTTOM, 255); 62 | TextDrawTextSize(BOTTOM, 0.000000, -660.000000); 63 | return 1; 64 | } 65 | -------------------------------------------------------------------------------- /includes/YSI_Coding/y_timers/tests.inc: -------------------------------------------------------------------------------- 1 | #tryinclude "y_hooks" 2 | #tryinclude "..\y_hooks" 3 | 4 | static stock 5 | sgPlayerCounter[MAX_PLAYERS]; 6 | 7 | hook OnPlayerConnect(playerid) 8 | { 9 | sgPlayerCounter[playerid] = 0; 10 | } 11 | 12 | ptask y_timers_PCounter[1000](playerid) 13 | { 14 | // What an odd bug! Putting this in a format breaks the format! 15 | ++sgPlayerCounter[playerid]; 16 | //printf("playerid: %d, %d", playerid, sgPlayerCounter[playerid]); 17 | //new 18 | // b = sgPlayerCounter[playerid]; 19 | //printf("playerid: %d, %d", playerid, b); 20 | va_SendClientMessage(playerid, 0xFF0000AA, "PLAYER COUNTER: %d", sgPlayerCounter[playerid]); 21 | } 22 | 23 | task y_timers_Counter[1000]() 24 | { 25 | static 26 | sCounter = 0; 27 | va_SendClientMessageToAll(0x0000FFAA, "GLOBAL COUNTER: %d", sCounter++); 28 | } 29 | 30 | PTest:PCounter1(playerid) 31 | { 32 | ASK("Is the red PLAYER COUNTER going up?"); 33 | } 34 | 35 | PTest:PCounter2(playerid) 36 | { 37 | pause y_timers_PCounter[playerid]; 38 | ASK("Has the red PLAYER COUNTER stopped?"); 39 | } 40 | 41 | PTest:Counter(playerid) 42 | { 43 | ASK("Is the blue GLOBAL COUNTER going up?"); 44 | } 45 | 46 | timer BigMessage1[4000](playerid) 47 | { 48 | SendClientMessage(playerid, 0x00FF00AA, "BIG MESSAGE appearing once."); 49 | } 50 | 51 | timer BigMessage2[4000](playerid) 52 | { 53 | SendClientMessage(playerid, 0x00FF00AA, "BIG MESSAGE appearing repeatedly."); 54 | } 55 | 56 | PTest:Timer1(playerid) 57 | { 58 | defer BigMessage1(playerid); 59 | ASK("Is a green BIG MESSAGE appearing once after 4 seconds?"); 60 | } 61 | 62 | static 63 | Timer:sgTimer; 64 | 65 | PTest:Timer2(playerid) 66 | { 67 | sgTimer = repeat BigMessage2(playerid); 68 | ASK("Is a green BIG MESSAGE appearing every 4 seconds?"); 69 | } 70 | 71 | timer StopMessage1[4000](playerid) 72 | { 73 | SendClientMessage(playerid, 0x00FF00AA, "BIG MESSAGE should stop now."); 74 | stop sgTimer; 75 | } 76 | 77 | PTest:Timer3(playerid) 78 | { 79 | defer StopMessage1(playerid); 80 | ASK("Is the green BIG MESSAGE stopping appearing after 4 seconds?"); 81 | } 82 | 83 | #tryinclude "y_hooks" 84 | #tryinclude "..\y_hooks" 85 | 86 | -------------------------------------------------------------------------------- /includes/amx/amx_memory.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined AMX_MEMORY_INC 22 | #endinput 23 | #endif 24 | #define AMX_MEMORY_INC 25 | 26 | #include 27 | 28 | // Returns the address of a variable/array. 29 | stock ref(...) { 30 | assert(numargs() == 1); 31 | #emit load.s.pri 12 // first argument 32 | #emit retn 33 | return 0; // make compiler happy 34 | } 35 | 36 | stock ReadAmxMemory(address) { 37 | #emit lref.s.pri address 38 | #emit retn 39 | return 0; // make compiler happy 40 | } 41 | 42 | stock ReadAmxMemoryArray(address, values[], size = sizeof(values)) { 43 | for (new i = 0; i < size; i++) { 44 | values[i] = ReadAmxMemory(address + i * 4); 45 | } 46 | } 47 | 48 | stock WriteAmxMemory(address, value) { 49 | #emit load.s.pri value 50 | #emit sref.s.pri address 51 | #emit retn 52 | return 0; // make compiler happy 53 | } 54 | 55 | stock WriteAmxMemoryArray(address, const values[], size = sizeof(values)) { 56 | for (new i = 0; i < size; i++) { 57 | WriteAmxMemory(address + i * 4, values[i]); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /server-readme.txt: -------------------------------------------------------------------------------- 1 | SA-MP 0.3 Server Setup 2 | ---------------------- 3 | 4 | Once the configuration is complete, run samp-server.exe to 5 | launch the server process. 6 | 7 | CONFIGURATION: 8 | 9 | Example server.cfg: 10 | echo Executing Server Config... 11 | lanmode 0 12 | maxplayers 32 13 | port 7777 14 | hostname Unnamed Server 15 | announce 0 16 | gamemode0 lvdm 1 17 | gamemode1 rivershell 1 18 | weburl www.sa-mp.com 19 | rcon_password changeme 20 | 21 | To configure the server, you must edit the values in server.cfg. They are explained below: 22 | 23 | hostname 24 | -------- 25 | Parameters: 26 | string 27 | 28 | Description: 29 | Specifies the hostname shown in the server browser 30 | 31 | port 32 | ---- 33 | Parameters: 34 | int 35 | 36 | Description: 37 | Specifies the port to listen on. 38 | This port is used for game connections, rcon connections, and for querying. 39 | 40 | maxplayers 41 | ---------- 42 | Parameters: 43 | int 44 | 45 | Description: 46 | Specifies the maximum amount of players. 47 | 48 | lanmode 49 | ------- 50 | Parameters: 51 | int (0 or 1) 52 | 53 | Description: 54 | Turns lanmode on (1) or off (0). Lanmode (as the name suggests) is for use on LAN games, where bandwidth is not a problem. Lanmode sends data at a higher rate, for a smoother game. 55 | 56 | 57 | announce 58 | ------- 59 | Parameters: 60 | int (0 or 1) 61 | 62 | Description: 63 | Announces your server to the 'Internet' server list in the SA:MP browser. On (1) or Off (0). 64 | 65 | weburl 66 | ------ 67 | Parameters: 68 | string 69 | 70 | Description: 71 | Specifies the URL shown in the server browser, which is associated to the server. 72 | 73 | rcon_password 74 | ------------- 75 | Parameters: 76 | string 77 | 78 | Description: 79 | Specifies the password needed to connect to rcon, or login to rcon ingame. 80 | 81 | gamemode0 - gamemode15 82 | ---------------------- 83 | Parameters: 84 | string 85 | int 86 | 87 | Description: 88 | Specifies the rotation settings. The first parameter sets the game mode name. The second is the number of times it will repeat. 89 | You can use gamemode0 to specify the first gamemode, gamemode1 to specify the second, etc. 90 | -------------------------------------------------------------------------------- /includes/amx/amx_base.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2011-2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined AMX_BASE_INC 22 | #endinput 23 | #endif 24 | #define AMX_BASE_INC 25 | 26 | static stock GetAmxBaseAddress_helper() { 27 | return 0; 28 | } 29 | 30 | // Returns the AMX base address i.e. amx->base. 31 | stock GetAmxBaseAddressNow() { 32 | new cod, dat; 33 | #emit lctrl 0 34 | #emit stor.s.pri cod 35 | #emit lctrl 1 36 | #emit stor.s.pri dat 37 | 38 | // Get code section start address relative to data. 39 | new code_start = cod - dat; 40 | 41 | // Get address of GetAmxBaseAddress_helper(). 42 | new fn_addr; 43 | #emit const.pri GetAmxBaseAddress_helper 44 | #emit stor.s.pri fn_addr 45 | 46 | // Get absolute address from the CALL instruction. 47 | new fn_addr_reloc, call_addr; 48 | GetAmxBaseAddress_helper(); 49 | #emit lctrl 6 50 | #emit stor.s.pri call_addr 51 | call_addr = call_addr - 12 + code_start; 52 | #emit lref.s.pri call_addr 53 | #emit stor.s.pri fn_addr_reloc 54 | 55 | return fn_addr_reloc - fn_addr - cod; 56 | } 57 | 58 | stock GetAmxBaseAddress() { 59 | static amx_base = 0; 60 | if (amx_base == 0) { 61 | amx_base = GetAmxBaseAddressNow(); 62 | } 63 | return amx_base; 64 | } 65 | -------------------------------------------------------------------------------- /includes/util.inc: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : util.inc 3 | * 4 | * DESCRIPTION : 5 | * Useful functions & macros for GTA:SA-MP Pawn. 6 | * 7 | * NOTES : 8 | * - 9 | * 10 | */ 11 | 12 | //------------------------------------------------------------------------------ 13 | 14 | /* 15 | Sounds macro 16 | */ 17 | #define PlayConfirmSound(%0) PlayerPlaySound(%0,1058,0.0,0.0,0.0) 18 | #define PlaySelectSound(%0) PlayerPlaySound(%0,1083,0.0,0.0,0.0) 19 | #define PlayCancelSound(%0) PlayerPlaySound(%0,1084,0.0,0.0,0.0) 20 | #define PlayErrorSound(%0) PlayerPlaySound(%0,1085,0.0,0.0,0.0) 21 | 22 | stock PlayMissionPassedSound(playerid) 23 | { 24 | PlayAudioStreamForPlayer(playerid, "https://dl.dropboxusercontent.com/u/118147782/MissionPassed.mp3"); 25 | defer StopAudioStream(playerid); 26 | } 27 | 28 | timer StopAudioStream[10000](playerid) 29 | { 30 | StopAudioStreamForPlayer(playerid); 31 | } 32 | 33 | //------------------------------------------------------------------------------ 34 | 35 | /* 36 | ClearPlayerScreen 37 | description: 38 | Clear the player chat. 39 | args: 40 | playerid - ID of the player. 41 | */ 42 | stock ClearPlayerScreen(playerid) 43 | { 44 | for(new i = 0; i < 20; i++) 45 | SendClientMessage(playerid, -1, " "); 46 | } 47 | 48 | /* 49 | IsPlayerInArea 50 | description: 51 | Checks if a player is in a area. 52 | args: 53 | playerid - ID of the player. 54 | minx - minimum X coord. 55 | miny - minimum Y coord. 56 | maxx - maximum X coord. 57 | maxy - maximum Y coord. 58 | */ 59 | stock IsPlayerInArea(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy) 60 | { 61 | new Float:X, Float:Y, Float:Z; 62 | GetPlayerPos(playerid, X, Y, Z); 63 | if(X >= minx && X <= maxx && Y >= miny && Y <= maxy) 64 | return 1; 65 | return 0; 66 | } 67 | 68 | /* 69 | IsPlayerInArea 70 | description: 71 | Checks if a player is running 72 | args: 73 | playerid - ID of the player. 74 | */ 75 | stock bool:IsPlayerRunning(playerid) 76 | { 77 | new keys, ud, lr; 78 | GetPlayerKeys(playerid, keys, ud, lr); 79 | 80 | if(keys & KEY_WALK || (ud == 0 && lr == 0)) 81 | return false; 82 | 83 | return true; 84 | } 85 | -------------------------------------------------------------------------------- /modules/visual/info.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/visual/cutscene.pwn 3 | * 4 | * DESCRIPTION : 5 | * Create functions to show info box as in singleplayer. 6 | * 7 | * NOTES : 8 | * - 9 | * 10 | */ 11 | 12 | //------------------------------------------------------------------------------ 13 | 14 | #include 15 | 16 | static PlayerText:gplTextDraw[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}; 17 | 18 | //------------------------------------------------------------------------------ 19 | 20 | ShowPlayerInfoMessage(playerid, message[]) 21 | { 22 | if(gplTextDraw[playerid] != PlayerText:INVALID_TEXT_DRAW) 23 | { 24 | PlayerTextDrawSetString(playerid, gplTextDraw[playerid], message); 25 | return 1; 26 | } 27 | 28 | gplTextDraw[playerid] = CreatePlayerTextDraw(playerid, 25.000000, 106.000000, message); 29 | PlayerTextDrawBackgroundColor(playerid, gplTextDraw[playerid], -256); 30 | PlayerTextDrawFont(playerid, gplTextDraw[playerid], 1); 31 | PlayerTextDrawLetterSize(playerid, gplTextDraw[playerid], 0.420000, 1.600000); 32 | PlayerTextDrawColor(playerid, gplTextDraw[playerid], -858993409); 33 | PlayerTextDrawSetOutline(playerid, gplTextDraw[playerid], 1); 34 | PlayerTextDrawSetProportional(playerid, gplTextDraw[playerid], 1); 35 | PlayerTextDrawUseBox(playerid, gplTextDraw[playerid], 1); 36 | PlayerTextDrawBoxColor(playerid, gplTextDraw[playerid], 0x00000047); 37 | PlayerTextDrawTextSize(playerid, gplTextDraw[playerid], 168.000000, -3.000000); 38 | PlayerTextDrawShow(playerid, gplTextDraw[playerid]); 39 | return 1; 40 | } 41 | 42 | //------------------------------------------------------------------------------ 43 | 44 | HidePlayerInfoMessage(playerid) 45 | { 46 | if(gplTextDraw[playerid] == PlayerText:INVALID_TEXT_DRAW) 47 | return 1; 48 | 49 | PlayerTextDrawDestroy(playerid, gplTextDraw[playerid]); 50 | gplTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW; 51 | return 1; 52 | } 53 | 54 | //------------------------------------------------------------------------------ 55 | 56 | hook OnPlayerDisconnect(playerid, reason) 57 | { 58 | if(gplTextDraw[playerid] != PlayerText:INVALID_TEXT_DRAW) 59 | gplTextDraw[playerid] = PlayerText:INVALID_TEXT_DRAW; 60 | return 1; 61 | } 62 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_renative.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ==================================== 3 | y_testing - Run unit tests easilly 4 | ==================================== 5 | Description: 6 | Runs any functions named as tests when the Testing_Run function is called. 7 | Legal: 8 | Version: MPL 1.1 9 | 10 | The contents of this file are subject to the Mozilla Public License Version 11 | 1.1 (the "License"); you may not use this file except in compliance with 12 | the License. You may obtain a copy of the License at 13 | http://www.mozilla.org/MPL/ 14 | 15 | Software distributed under the License is distributed on an "AS IS" basis, 16 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 17 | for the specific language governing rights and limitations under the 18 | License. 19 | 20 | The Original Code is the YSI testing include. 21 | 22 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 23 | Portions created by the Initial Developer are Copyright (C) 2011 24 | the Initial Developer. All Rights Reserved. 25 | 26 | Contributors: 27 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 28 | 29 | Thanks: 30 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 31 | ZeeX - Very productive conversations. 32 | koolk - IsPlayerinAreaEx code. 33 | TheAlpha - Danish translation. 34 | breadfish - German translation. 35 | Fireburn - Dutch translation. 36 | yom - French translation. 37 | 50p - Polish translation. 38 | Zamaroht - Spanish translation. 39 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 40 | for me to strive to better. 41 | Pixels^ - Running XScripters where the idea was born. 42 | Matite - Pestering me to release it and using it. 43 | 44 | Very special thanks to: 45 | Thiadmer - PAWN, whose limits continue to amaze me! 46 | Kye/Kalcor - SA:MP. 47 | SA:MP Team past, present and future - SA:MP. 48 | 49 | Version: 50 | 1.0 51 | Changelog: 52 | 25/10/10: 53 | Integrated in to YSI. 54 | 06/08/10: 55 | First version 56 | 57 | \**--------------------------------------------------------------------------**/ 58 | 59 | #if defined _INC_y_renative 60 | #endinput 61 | #endif 62 | #define _INC_y_renative 63 | 64 | #define @Rg<%0|||%1|||%2> %0(%1)=%2; 65 | #define _YSI_RE_NATIVE @Rg 66 | 67 | #define _YSI_REM 68 | -------------------------------------------------------------------------------- /modules/visual/subtitles.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/visual/subtitles.pwn 3 | * 4 | * DESCRIPTION : 5 | * Create, destroy and show subtitles for players. 6 | * 7 | * NOTES : 8 | * - 9 | * 10 | */ 11 | 12 | //------------------------------------------------------------------------------ 13 | 14 | #include 15 | 16 | //------------------------------------------------------------------------------ 17 | 18 | static PlayerText:gpTextDrawSub[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...}; 19 | 20 | //------------------------------------------------------------------------------ 21 | 22 | ShowPlayerSubtitle(playerid, text[], showtime = 0) 23 | { 24 | if(gpTextDrawSub[playerid] != PlayerText:INVALID_TEXT_DRAW) 25 | { 26 | PlayerTextDrawSetString(playerid, gpTextDrawSub[playerid], text); 27 | return 1; 28 | } 29 | 30 | gpTextDrawSub[playerid] = CreatePlayerTextDraw(playerid, 325.666625, 425.563018, text); 31 | PlayerTextDrawLetterSize(playerid, gpTextDrawSub[playerid], 0.400000, 1.600000); 32 | PlayerTextDrawAlignment(playerid, gpTextDrawSub[playerid], 2); 33 | PlayerTextDrawColor(playerid, gpTextDrawSub[playerid], 0xe8e8e8ff); 34 | PlayerTextDrawSetShadow(playerid, gpTextDrawSub[playerid], 1); 35 | PlayerTextDrawSetOutline(playerid, gpTextDrawSub[playerid], 0); 36 | PlayerTextDrawBackgroundColor(playerid, gpTextDrawSub[playerid], 255); 37 | PlayerTextDrawFont(playerid, gpTextDrawSub[playerid], 1); 38 | PlayerTextDrawSetProportional(playerid, gpTextDrawSub[playerid], 1); 39 | PlayerTextDrawSetShadow(playerid, gpTextDrawSub[playerid], 1); 40 | PlayerTextDrawShow(playerid, gpTextDrawSub[playerid]); 41 | 42 | if(showtime > 0) 43 | defer HidePlayerSubtitle[showtime](playerid); 44 | return 1; 45 | } 46 | 47 | //------------------------------------------------------------------------------ 48 | 49 | timer HidePlayerSubtitle[6000](playerid) 50 | { 51 | if(gpTextDrawSub[playerid] == PlayerText:INVALID_TEXT_DRAW) 52 | return 1; 53 | 54 | PlayerTextDrawDestroy(playerid, gpTextDrawSub[playerid]); 55 | gpTextDrawSub[playerid] = PlayerText:INVALID_TEXT_DRAW; 56 | return 1; 57 | } 58 | 59 | //------------------------------------------------------------------------------ 60 | 61 | hook OnPlayerDisconnect(playerid, reason) 62 | { 63 | gpTextDrawSub[playerid] = PlayerText:INVALID_TEXT_DRAW; 64 | return 1; 65 | } 66 | -------------------------------------------------------------------------------- /includes/YSI_Storage/y_svar/tests.inc: -------------------------------------------------------------------------------- 1 | enum y_svar_E_TEST 2 | { 3 | y_svar_E_TEST_A, 4 | Float:y_svar_E_TEST_B, 5 | y_svar_E_TEST_C[24] 6 | } 7 | 8 | svar y_svar_TestEnum[y_svar_E_TEST]; 9 | svar y_svar_Test1D[200]; 10 | svar y_svar_Test2D[200][200]; 11 | svar y_svar_Test2DEnum[200][y_svar_E_TEST]; 12 | svar y_svar_TestEnum2D[y_svar_E_TEST][200]; 13 | 14 | Test:y_svar_Enum() 15 | { 16 | // Should fail first time ever, but then not again. 17 | ASSERT(y_svar_TestEnum[y_svar_E_TEST_A] == 42); 18 | y_svar_TestEnum[y_svar_E_TEST_A] = 42; 19 | ASSERT(y_svar_TestEnum[y_svar_E_TEST_B] == 55.44); 20 | y_svar_TestEnum[y_svar_E_TEST_B] = 55.44; 21 | ASSERT(!strcmp(y_svar_TestEnum[y_svar_E_TEST_C], "SOME STORED DATA") && y_svar_TestEnum[y_svar_E_TEST_C][0]); 22 | strcpy(y_svar_TestEnum[y_svar_E_TEST_C], "SOME STORED DATA", 24); 23 | } 24 | 25 | Test:y_svar_1D() 26 | { 27 | // Should fail first time ever, but then not again. 28 | new 29 | fails = 0; 30 | for (new i = 0; i != sizeof (y_svar_Test1D); ++i) 31 | { 32 | if (y_svar_Test1D[i] != i) ++fails; 33 | y_svar_Test1D[i] = i; 34 | } 35 | ASSERT(fails == 0); 36 | } 37 | 38 | Test:y_svar_2D() 39 | { 40 | // Should fail first time ever, but then not again. 41 | new 42 | fails = 0; 43 | for (new i = 0; i != sizeof (y_svar_Test2D); ++i) 44 | { 45 | for (new j = 0; j != sizeof (y_svar_Test2D[]); ++j) 46 | { 47 | if (y_svar_Test2D[i][j] != i * j) ++fails; 48 | y_svar_Test2D[i][j] = i * j; 49 | } 50 | } 51 | ASSERT(fails == 0); 52 | } 53 | 54 | Test:y_svar_2DEnum() 55 | { 56 | // Should fail first time ever, but then not again. 57 | new 58 | fails = 0; 59 | for (new i = 0; i != sizeof (y_svar_Test2DEnum); ++i) 60 | { 61 | if (!(y_svar_Test2DEnum[i][y_svar_E_TEST_A] == 42 * i)) ++fails; 62 | y_svar_Test2DEnum[i][y_svar_E_TEST_A] = 42 * i; 63 | if (!(y_svar_Test2DEnum[i][y_svar_E_TEST_B] == 55.44 + i)) ++fails; 64 | y_svar_Test2DEnum[i][y_svar_E_TEST_B] = 55.44 + i; 65 | if (strcmp(y_svar_Test2DEnum[i][y_svar_E_TEST_C], "SOME STORED DATA") || !y_svar_Test2DEnum[i][y_svar_E_TEST_C][0]) ++fails; 66 | strcpy(y_svar_Test2DEnum[i][y_svar_E_TEST_C], "SOME STORED DATA", 24); 67 | } 68 | ASSERT(fails == 0); 69 | } 70 | 71 | Test:y_svar_Enum2D() 72 | { 73 | // Should fail first time ever, but then not again. 74 | new 75 | fails = 0; 76 | for (new i = 0; i != sizeof (y_svar_TestEnum2D[]); ++i) 77 | { 78 | if (y_svar_TestEnum2D[y_svar_E_TEST_A][i] != i + 101) ++fails; 79 | y_svar_TestEnum2D[y_svar_E_TEST_A][i] = i + 101; 80 | } 81 | ASSERT(fails == 0); 82 | } 83 | -------------------------------------------------------------------------------- /includes/YSI_Server/y_colors.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ========================== 3 | y_colours - X11 colours! 4 | ========================== 5 | Description: 6 | This holds the colour information that used to be part of the text system 7 | but which is far more useful than just for text. This now supports the full 8 | set of X11 colours, both by name and by definition. You can also define 9 | your own if you so choose (up to 32 - should be enough given that this 10 | includes the X11 colours). 11 | Legal: 12 | Version: MPL 1.1 13 | 14 | The contents of this file are subject to the Mozilla Public License Version 15 | 1.1 (the "License"); you may not use this file except in compliance with 16 | the License. You may obtain a copy of the License at 17 | http://www.mozilla.org/MPL/ 18 | 19 | Software distributed under the License is distributed on an "AS IS" basis, 20 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 21 | for the specific language governing rights and limitations under the 22 | License. 23 | 24 | The Original Code is the YSI colours include. 25 | 26 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 27 | Portions created by the Initial Developer are Copyright (C) 2011 28 | the Initial Developer. All Rights Reserved. 29 | 30 | Contributors: 31 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 32 | 33 | Thanks: 34 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 35 | ZeeX - Very productive conversations. 36 | koolk - IsPlayerinAreaEx code. 37 | TheAlpha - Danish translation. 38 | breadfish - German translation. 39 | Fireburn - Dutch translation. 40 | yom - French translation. 41 | 50p - Polish translation. 42 | Zamaroht - Spanish translation. 43 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 44 | for me to strive to better. 45 | Pixels^ - Running XScripters where the idea was born. 46 | Matite - Pestering me to release it and using it. 47 | 48 | Very special thanks to: 49 | Thiadmer - PAWN, whose limits continue to amaze me! 50 | Kye/Kalcor - SA:MP. 51 | SA:MP Team past, present and future - SA:MP. 52 | 53 | Version: 54 | 1.0 55 | Changelog: 56 | 06/08/10: 57 | First version 58 | 59 | \**--------------------------------------------------------------------------**/ 60 | 61 | #if defined _INC_y_colors 62 | #endinput 63 | #endif 64 | #define _INC_y_colors 65 | 66 | #include "..\YSI_Server\y_colours" 67 | -------------------------------------------------------------------------------- /includes/YSI_Visual/y_commands/card.h: -------------------------------------------------------------------------------- 1 | ign Command_ReProcess(p,string:c[],h); 2 | 3 | global Command_ReProcess(playerid,string:cmdName[],help) 4 | { 5 | static sCmd[64] = "@yC_", sPos, sReturn, sHash, e_COMMAND_ERRORS:sErr; 6 | // Check that the input is a valid command. Note that changing the command prefix here would be VERY trivial! 7 | if ((sReturn = _:_Command_IsPrefix(cmdName[0])) && !cmdName[1]) return Command_OnReceived(INVALID_INPUT, playerid, cmdName); 8 | else if (isnull(cmdName)) return Command_OnReceived(INVALID_INPUT, playerid, NULL); 9 | #if !defined Y_COMMANDS_NO_IPC // Check for a valid player when debugging is disabled 10 | if (!IsPlayerConnected(playerid)) return Command_OnReceived(NO_PLAYER, playerid, cmdName); 11 | if (PA_Get(YSI_g_sDisabledPlayers, playerid)) return Command_OnReceived(DISABLED, playerid, cmdName); 12 | playerid:1("Commands_OnPlayerCommandText called: %d %s", playerid, cmdName); 13 | new prevID = YSI_g_sCurrentID; // To add "next" to the intrusive linked list. 14 | // Get the hashed version of the decoded string, skipping the possible "/". 15 | sPos = Puny_EncodeHash(sCmd[4], cmdName[sReturn], sHash, .delimiter = '@') + sReturn; 16 | while (cmdName[sPos] == ' ') ++sPos; // Better/slower: ('\0' < cmdName[sPos] <= ' '). 17 | YSI_g_sCurrentID = HashMap_GetWithHash(YSI_g_sCommandMap, sCmd[4], sHash); 18 | playerid:5("Commands_OnPlayerCommandText: %s, %d, %d, %d", sCmd[4], sPos, sHash, YSI_g_sCurrentID); 19 | if (YSI_g_sCurrentID == COMMAND_NOT_FOUND) return YSI_g_sCurrentID = prevID, Command_OnReceived(UNDEFINED, playerid, cmdName); 20 | #if defined Y_COMMANDS_USE_CHARS // Not everything starts with '/', some are custom. 21 | // Have a prefix, but not the right one despite calling this function directly 22 | if (sReturn && _Command_GetPrefix(YSI_g_sCurrentID) != cmdName[0]) return Command_OnReceived(BAD_PREFIX, playerid, cmdName); 23 | playerid:5("Commands_OnPlayerCommandText: Use %d", _Command_GetPlayer(YSI_g_sCurrentID, playerid)); 24 | if (_Command_GetPlayer(YSI_g_sCurrentID, playerid)) { // Can the player use this command? 25 | if (!Command_OnReceived(OK, playerid, cmdName)) return YSI_g_sCurrentID = prevID, 0; 26 | _Command_GetReal(sHash, YSI_g_sCurrentID, sCmd[4]); // Find the true version of the command (alts etc). 27 | P:5("Commands_OnPlayerCommandText: Read %d", YSI_g_sCurrentID); 28 | P:5("Commands_OnPlayerCommandText: Master %d %d", Master_ID(), _:MASTER_GET); 29 | #if YSIM_HAS_MASTER 30 | if (MASTER_EXCLUSIVE) 31 | #endif 32 | -------------------------------------------------------------------------------- /includes/YSI_Storage/y_bitmap/subpixel.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ================================= 3 | y_bitmap - Generate bitmaps. 4 | ================================= 5 | Description: 6 | Code to generate images on the server in the bitmap format. This is by far 7 | the simplest format to write to as it is just a huge array of colours (at 8 | least 24-bit bitmaps are, and we only do them). 9 | 10 | This file works out the colour of a pixel near the edge of a shape for 11 | better blending. 12 | Legal: 13 | Version: MPL 1.1 14 | 15 | The contents of this file are subject to the Mozilla Public License Version 16 | 1.1 (the "License"); you may not use this file except in compliance with 17 | the License. You may obtain a copy of the License at 18 | http://www.mozilla.org/MPL/ 19 | 20 | Software distributed under the License is distributed on an "AS IS" basis, 21 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 22 | for the specific language governing rights and limitations under the 23 | License. 24 | 25 | The Original Code is the YSI utils include. 26 | 27 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 28 | Portions created by the Initial Developer are Copyright (C) 2011 29 | the Initial Developer. All Rights Reserved. 30 | 31 | Contributors: 32 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 33 | 34 | Thanks: 35 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 36 | ZeeX - Very productive conversations. 37 | koolk - IsPlayerinAreaEx code. 38 | TheAlpha - Danish translation. 39 | breadfish - German translation. 40 | Fireburn - Dutch translation. 41 | yom - French translation. 42 | 50p - Polish translation. 43 | Zamaroht - Spanish translation. 44 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 45 | for me to strive to better. 46 | Pixels^ - Running XScripters where the idea was born. 47 | Matite - Pestering me to release it and using it. 48 | 49 | Very special thanks to: 50 | Thiadmer - PAWN, whose limits continue to amaze me! 51 | Kye/Kalcor - SA:MP. 52 | SA:MP Team past, present and future - SA:MP. 53 | 54 | Version: 55 | 0.1 56 | Changelog: 57 | 29/03/13: 58 | First version. 59 | Functions: 60 | Stock: 61 | - 62 | Inline: 63 | - 64 | Variables: 65 | Global: 66 | - 67 | \**--------------------------------------------------------------------------**/ 68 | 69 | stock Bitmap_StraightLine(sX, sY, eX, eY, width, pattern[] = "SOLID") 70 | { 71 | } 72 | -------------------------------------------------------------------------------- /includes/YSI_Core/y_master/_pop_master.inc: -------------------------------------------------------------------------------- 1 | #if AUTO_INCLUDE_GUARD 2 | #undef _inc__pop_master 3 | #endif 4 | 5 | #if _YSIM_PUSH_INDEX < 1 6 | #define MASTER 0 7 | #endinput 8 | #elseif _YSIM_PUSH_INDEX == 1 9 | #define MASTER _YSIM_STACK_SLOT_0 10 | #undef _YSIM_PUSH_INDEX 11 | #define _YSIM_PUSH_INDEX 0 12 | #endinput 13 | #elseif _YSIM_PUSH_INDEX == 2 14 | #define MASTER _YSIM_STACK_SLOT_1 15 | #undef _YSIM_PUSH_INDEX 16 | #define _YSIM_PUSH_INDEX 1 17 | #endinput 18 | #elseif _YSIM_PUSH_INDEX == 3 19 | #define MASTER _YSIM_STACK_SLOT_2 20 | #undef _YSIM_PUSH_INDEX 21 | #define _YSIM_PUSH_INDEX 2 22 | #endinput 23 | #elseif _YSIM_PUSH_INDEX == 4 24 | #define MASTER _YSIM_STACK_SLOT_3 25 | #undef _YSIM_PUSH_INDEX 26 | #define _YSIM_PUSH_INDEX 3 27 | #endinput 28 | #elseif _YSIM_PUSH_INDEX == 5 29 | #define MASTER _YSIM_STACK_SLOT_4 30 | #undef _YSIM_PUSH_INDEX 31 | #define _YSIM_PUSH_INDEX 4 32 | #endinput 33 | #elseif _YSIM_PUSH_INDEX == 6 34 | #define MASTER _YSIM_STACK_SLOT_5 35 | #undef _YSIM_PUSH_INDEX 36 | #define _YSIM_PUSH_INDEX 5 37 | #endinput 38 | #elseif _YSIM_PUSH_INDEX == 7 39 | #define MASTER _YSIM_STACK_SLOT_6 40 | #undef _YSIM_PUSH_INDEX 41 | #define _YSIM_PUSH_INDEX 6 42 | #endinput 43 | #elseif _YSIM_PUSH_INDEX == 8 44 | #define MASTER _YSIM_STACK_SLOT_7 45 | #undef _YSIM_PUSH_INDEX 46 | #define _YSIM_PUSH_INDEX 7 47 | #endinput 48 | #elseif _YSIM_PUSH_INDEX == 9 49 | #define MASTER _YSIM_STACK_SLOT_8 50 | #undef _YSIM_PUSH_INDEX 51 | #define _YSIM_PUSH_INDEX 8 52 | #endinput 53 | #elseif _YSIM_PUSH_INDEX == 10 54 | #define MASTER _YSIM_STACK_SLOT_9 55 | #undef _YSIM_PUSH_INDEX 56 | #define _YSIM_PUSH_INDEX 9 57 | #endinput 58 | #elseif _YSIM_PUSH_INDEX == 11 59 | #define MASTER _YSIM_STACK_SLOT_10 60 | #undef _YSIM_PUSH_INDEX 61 | #define _YSIM_PUSH_INDEX 10 62 | #endinput 63 | #elseif _YSIM_PUSH_INDEX == 12 64 | #define MASTER _YSIM_STACK_SLOT_11 65 | #undef _YSIM_PUSH_INDEX 66 | #define _YSIM_PUSH_INDEX 11 67 | #endinput 68 | #elseif _YSIM_PUSH_INDEX == 13 69 | #define MASTER _YSIM_STACK_SLOT_12 70 | #undef _YSIM_PUSH_INDEX 71 | #define _YSIM_PUSH_INDEX 12 72 | #endinput 73 | #elseif _YSIM_PUSH_INDEX == 14 74 | #define MASTER _YSIM_STACK_SLOT_13 75 | #undef _YSIM_PUSH_INDEX 76 | #define _YSIM_PUSH_INDEX 13 77 | #endinput 78 | #elseif _YSIM_PUSH_INDEX == 15 79 | #define MASTER _YSIM_STACK_SLOT_14 80 | #undef _YSIM_PUSH_INDEX 81 | #define _YSIM_PUSH_INDEX 14 82 | #endinput 83 | #elseif _YSIM_PUSH_INDEX == 16 84 | #define MASTER _YSIM_STACK_SLOT_15 85 | #undef _YSIM_PUSH_INDEX 86 | #define _YSIM_PUSH_INDEX 15 87 | #endinput 88 | #endif 89 | #error y_master MASTER stack impossibility. 90 | 91 | -------------------------------------------------------------------------------- /includes/amx/stack_trace.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined STACK_TRACE_INC 22 | #endinput 23 | #endif 24 | #define STACK_TRACE_INC 25 | 26 | #include "amx_base" 27 | #include "amx_header" 28 | #include "frame_info" 29 | 30 | stock GetFunctionFromReturnAddress(ret_addr) { 31 | new addr = ret_addr - 4; 32 | 33 | #emit load.s.alt addr 34 | #emit lctrl 0 35 | #emit add 36 | #emit move.alt 37 | #emit lctrl 1 38 | #emit sub.alt 39 | 40 | #emit stor.s.pri addr 41 | #emit lref.s.alt addr 42 | #emit lctrl 0 43 | #emit sub.alt 44 | #emit stor.s.pri addr 45 | 46 | return addr - GetAmxBaseAddress(); 47 | } 48 | 49 | stock GetStackTrace(trace[], skip = 0, max = sizeof(trace)) { 50 | new frm_addr; 51 | #emit lctrl 5 52 | #emit stor.s.pri frm_addr 53 | 54 | new length = 0; 55 | while (length < max) { 56 | new ret_addr = GetFrameReturn(frm_addr); 57 | if (length >= skip) { 58 | trace[length] = ret_addr; 59 | } 60 | if (ret_addr == 0) { 61 | break; 62 | } 63 | frm_addr = GetFramePreviousFrame(frm_addr); 64 | if (frm_addr == 0) { 65 | break; 66 | } 67 | length++; 68 | } 69 | 70 | return length; 71 | } 72 | 73 | stock PrintStackTrace(trace[], max = sizeof(trace)) { 74 | print("Stack trace:"); 75 | 76 | new i = 0; 77 | 78 | for (; trace[i] != 0 && i < max - 1; i++) { 79 | new name[32]; 80 | new address = GetFunctionFromReturnAddress(trace[i + 1]); 81 | if (GetPublicNameFromAddress(address, name)) { 82 | printf(" %s[%08x]", name, trace[i]); 83 | } else { 84 | printf(" ??[%08x]", trace[i]); 85 | } 86 | } 87 | 88 | printf(" ??[%08x]", trace[i]); 89 | } 90 | -------------------------------------------------------------------------------- /includes/amx/amx.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined AMX_INC 22 | #endinput 23 | #endif 24 | #define AMX_INC 25 | 26 | #include "phys_memory" 27 | #include "shellcode" 28 | 29 | const AMX_OFFSET_BASE = 0; 30 | const AMX_OFFSET_DATA = 4; 31 | const AMX_OFFSET_CALLBACK = 8; 32 | const AMX_OFFSET_DEBUG = 12; 33 | const AMX_OFFSET_CIP = 16; 34 | const AMX_OFFSET_FRM = 20; 35 | const AMX_OFFSET_HEA = 24; 36 | const AMX_OFFSET_HLW = 28; 37 | const AMX_OFFSET_STK = 32; 38 | const AMX_OFFSET_STP = 36; 39 | const AMX_OFFSET_FLAGS = 40; 40 | const AMX_OFFSET_USERTAGS = 44; 41 | const AMX_OFFSET_USERDATA = 60; 42 | const AMX_OFFSET_ERROR = 76; 43 | const AMX_OFFSET_PARAMCOUNT = 80; 44 | const AMX_OFFSET_PRI = 84; 45 | const AMX_OFFSET_ALT = 88; 46 | const AMX_OFFSET_RESET_STK = 92; 47 | const AMX_OFFSET_RESET_HEA = 96; 48 | const AMX_OFFSET_SYSREQ_D = 100; 49 | 50 | // Returns the address of the AMX struct instance in memory that corresponds 51 | // to this script. This function works only on Windows! 52 | stock GetAmxAddress() { 53 | static address = 0; 54 | if (address == 0) { 55 | static const code[] = { 56 | 0x90909090, 0x90909090, 0x90909090, 0x90909090, // for alignment 57 | 0x0424448b, 0xC3C3C3C3 58 | }; 59 | address = RunShellcode(refabs(code)); 60 | } 61 | return address; 62 | } 63 | 64 | // Reads a cell from the AMX struct. 65 | stock ReadAmxCell(offset) { 66 | new amx = GetAmxAddress(); 67 | return ReadPhysMemoryCell(amx + offset); 68 | } 69 | 70 | // Writes a cell to the AMX struct. 71 | stock WriteAmxCell(offset, value) { 72 | new amx = GetAmxAddress(); 73 | WritePhysMemoryCell(amx + offset, value); 74 | } 75 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_globaltags.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ================================= 3 | y_globaltags - Variable tags. 4 | ================================= 5 | Description: 6 | Declare GLOBAL_TAG_TYPES to define many tag types for function calls. 7 | Legal: 8 | Version: MPL 1.1 9 | 10 | The contents of this file are subject to the Mozilla Public License Version 11 | 1.1 (the "License"); you may not use this file except in compliance with 12 | the License. You may obtain a copy of the License at 13 | http://www.mozilla.org/MPL/ 14 | 15 | Software distributed under the License is distributed on an "AS IS" basis, 16 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 17 | for the specific language governing rights and limitations under the 18 | License. 19 | 20 | The Original Code is the YSI utils include. 21 | 22 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 23 | Portions created by the Initial Developer are Copyright (C) 2011 24 | the Initial Developer. All Rights Reserved. 25 | 26 | Contributors: 27 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 28 | 29 | Thanks: 30 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 31 | ZeeX - Very productive conversations. 32 | koolk - IsPlayerinAreaEx code. 33 | TheAlpha - Danish translation. 34 | breadfish - German translation. 35 | Fireburn - Dutch translation. 36 | yom - French translation. 37 | 50p - Polish translation. 38 | Zamaroht - Spanish translation. 39 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 40 | for me to strive to better. 41 | Pixels^ - Running XScripters where the idea was born. 42 | Matite - Pestering me to release it and using it. 43 | 44 | Very special thanks to: 45 | Thiadmer - PAWN, whose limits continue to amaze me! 46 | Kye/Kalcor - SA:MP. 47 | SA:MP Team past, present and future - SA:MP. 48 | 49 | Version: 50 | 0.1 51 | Changelog: 52 | 25/02/12: 53 | First version. 54 | Functions: 55 | Stock: 56 | - 57 | Inline: 58 | - 59 | Variables: 60 | Global: 61 | - 62 | 63 | \**--------------------------------------------------------------------------**/ 64 | 65 | #if defined _INC_y_globaltags 66 | #endinput 67 | #endif 68 | #define _INC_y_globaltags 69 | 70 | // "File,Float," must remain last always. 71 | #if defined CUSTOM_TAG_TYPES 72 | #define File,Float, Float,File,Text3D,CUSTOM_TAG_TYPES 73 | #else 74 | #define File,Float, Float,File,Text3D 75 | #endif 76 | // Add new tags to the START of this list. 77 | //#define GLOBAL_TAG_TYPES {_,Language,Bit,PlayerText3D,Text,Text3D,Menu,DB,DBResult,Style,XML,Bintree,Group,Timer,File,Float} //,CUSTOM_TAG_TYPES} 78 | #define GLOBAL_TAG_TYPES {_,Language,Bit,Text,Menu,Style,XML,Bintree,Group,Timer,File,Float,} //,CUSTOM_TAG_TYPES} 79 | 80 | -------------------------------------------------------------------------------- /modules/game/clock.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/game/clock.pwn 3 | * 4 | * DESCRIPTION : 5 | * Synchronize the clock to all the players. 6 | * 7 | * NOTES : 8 | * - 9 | * 10 | */ 11 | 12 | #include 13 | 14 | //------------------------------------------------------------------------------ 15 | 16 | // Server start time - 00:00 17 | new gCurrentHour = 00; 18 | new gCurrentMinute = 00; 19 | 20 | new Text:gClockTD; 21 | new bool:gplClockLoaded[MAX_PLAYERS]; 22 | 23 | //------------------------------------------------------------------------------ 24 | 25 | hook OnPlayerDisconnect(playerid, reason) 26 | { 27 | gplClockLoaded[playerid] = false; 28 | return 1; 29 | } 30 | 31 | //------------------------------------------------------------------------------ 32 | 33 | hook OnPlayerSpawn(playerid) 34 | { 35 | if(!gplClockLoaded[playerid]) 36 | { 37 | gplClockLoaded[playerid] = true; 38 | TextDrawShowForPlayer(playerid, gClockTD); 39 | } 40 | return 1; 41 | } 42 | 43 | //------------------------------------------------------------------------------ 44 | 45 | stock ShowPlayerClock(playerid) 46 | { 47 | TextDrawShowForPlayer(playerid, gClockTD); 48 | } 49 | 50 | //------------------------------------------------------------------------------ 51 | 52 | stock HidePlayerClock(playerid) 53 | { 54 | TextDrawHideForPlayer(playerid, gClockTD); 55 | } 56 | 57 | //------------------------------------------------------------------------------ 58 | 59 | hook OnGameModeInit() 60 | { 61 | gClockTD = TextDrawCreate(545.000000, 20.000000, "03:00"); 62 | TextDrawBackgroundColor(gClockTD, 255); 63 | TextDrawFont(gClockTD, 3); 64 | TextDrawLetterSize(gClockTD, 0.6, 2.0); 65 | TextDrawColor(gClockTD, 0xc3c3c3ff); 66 | TextDrawBoxColor(gClockTD, 0x000000ff); 67 | TextDrawSetOutline(gClockTD, 2); 68 | TextDrawSetShadow(gClockTD, 0); 69 | TextDrawSetProportional(gClockTD, 1); 70 | return 1; 71 | } 72 | 73 | //------------------------------------------------------------------------------ 74 | 75 | stock GetServerTime(&hour, &minute) 76 | { 77 | hour = gCurrentHour; 78 | minute = gCurrentMinute; 79 | } 80 | 81 | //------------------------------------------------------------------------------ 82 | 83 | task UpdateServerClock[1000]() 84 | { 85 | gCurrentMinute++; 86 | if(gCurrentMinute > 59) 87 | { 88 | gCurrentHour++; 89 | gCurrentMinute = 0; 90 | if(gCurrentHour > 23) 91 | gCurrentHour = 0; 92 | } 93 | 94 | new sCT[12]; 95 | format(sCT, sizeof(sCT), "%02d:%02d", gCurrentHour, gCurrentMinute); 96 | TextDrawSetString(gClockTD, sCT); 97 | 98 | foreach(new i: Player) 99 | SetPlayerTime(i, gCurrentHour, gCurrentMinute); 100 | } 101 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_funcinc.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | =============================== 3 | y_funcinc - Fix SYSREQ.C bugs 4 | =============================== 5 | Description: 6 | Calls functions which are used in SYSREQ.C calls before they are used. The 7 | compiler crashes if the functions are not used in an included function 8 | before being used in a SYSREQ.C call as the function is not in the native 9 | functions table. 10 | Legal: 11 | Version: MPL 1.1 12 | 13 | The contents of this file are subject to the Mozilla Public License Version 14 | 1.1 (the "License"); you may not use this file except in compliance with 15 | the License. You may obtain a copy of the License at 16 | http://www.mozilla.org/MPL/ 17 | 18 | Software distributed under the License is distributed on an "AS IS" basis, 19 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 20 | for the specific language governing rights and limitations under the 21 | License. 22 | 23 | The Original Code is the YSI funcinc include. 24 | 25 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 26 | Portions created by the Initial Developer are Copyright (C) 2011 27 | the Initial Developer. All Rights Reserved. 28 | 29 | Contributors: 30 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 31 | 32 | Thanks: 33 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 34 | ZeeX - Very productive conversations. 35 | koolk - IsPlayerinAreaEx code. 36 | TheAlpha - Danish translation. 37 | breadfish - German translation. 38 | Fireburn - Dutch translation. 39 | yom - French translation. 40 | 50p - Polish translation. 41 | Zamaroht - Spanish translation. 42 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 43 | for me to strive to better. 44 | Pixels^ - Running XScripters where the idea was born. 45 | Matite - Pestering me to release it and using it. 46 | 47 | Very special thanks to: 48 | Thiadmer - PAWN, whose limits continue to amaze me! 49 | Kye/Kalcor - SA:MP. 50 | SA:MP Team past, present and future - SA:MP. 51 | 52 | Version: 53 | 1.0 54 | Changelog: 55 | 06/08/10: 56 | First version 57 | 58 | \**--------------------------------------------------------------------------**/ 59 | 60 | #if defined _INC_y_funcinc 61 | #endinput 62 | #endif 63 | #define _INC_y_funcinc 64 | 65 | forward _@_y_funcinc_@_(); 66 | 67 | public _@_y_funcinc_@_() 68 | { 69 | // This function calls any functions used in assembly code in YSI to ensure 70 | // that they are included in the native function table. 71 | printf(""); 72 | new _funcinc_a[1 char]; 73 | strunpack(_funcinc_a, ""); 74 | memcpy("", "", 0, 0, 0); 75 | format("", 0, ""); 76 | strfind("", "", false, 0); 77 | strcat(_funcinc_a, "", 0); 78 | strlen(""); 79 | CallRemoteFunction("", ""); 80 | CallLocalFunction("", ""); 81 | SetTimerEx("", 0, 0, ""); 82 | heapspace(); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_gamerzps.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ========================================= 3 | y_gamerzps - GPS plugin + YSI. 4 | ========================================= 5 | Description: 6 | This file unites various YSI features with Gamer_Z's GPS (Gamer_Z's 7 | Positioning System) plugin so that you can use hooks and inlines with it. 8 | Legal: 9 | Version: MPL 1.1 10 | 11 | The contents of this file are subject to the Mozilla Public License Version 12 | 1.1 (the "License"); you may not use this file except in compliance with 13 | the License. You may obtain a copy of the License at 14 | http://www.mozilla.org/MPL/ 15 | 16 | Software distributed under the License is distributed on an "AS IS" basis, 17 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 18 | for the specific language governing rights and limitations under the 19 | License. 20 | 21 | The Original Code is the YSI classes include. 22 | 23 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 24 | Portions created by the Initial Developer are Copyright (C) 2011 25 | the Initial Developer. All Rights Reserved. 26 | 27 | Contributors: 28 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 29 | 30 | Thanks: 31 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 32 | ZeeX - Very productive conversations. 33 | koolk - IsPlayerinAreaEx code. 34 | TheAlpha - Danish translation. 35 | breadfish - German translation. 36 | Fireburn - Dutch translation. 37 | yom - French translation. 38 | 50p - Polish translation. 39 | Zamaroht - Spanish translation. 40 | Los - Portuguese translation. 41 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 42 | for me to strive to better. 43 | Pixels^ - Running XScripters where the idea was born. 44 | Matite - Pestering me to release it and using it. 45 | 46 | Very special thanks to: 47 | Thiadmer - PAWN, whose limits continue to amaze me! 48 | Kye/Kalcor - SA:MP. 49 | SA:MP Team past, present and future - SA:MP. 50 | 51 | Optional plugins: 52 | Gamer_Z - GPS. 53 | Incognito - Streamer. 54 | Me - sscanf2, fixes2, Whirlpool. 55 | 56 | Version: 57 | 0.1 58 | Changelog: 59 | 20/10/12: 60 | First version. 61 | Functions: 62 | Public: 63 | - 64 | Core: 65 | - 66 | Stock: 67 | - 68 | Static: 69 | - 70 | Inline: 71 | - 72 | API: 73 | - 74 | Callbacks: 75 | - 76 | Definitions: 77 | - 78 | Enums: 79 | - 80 | Macros: 81 | - 82 | Tags: 83 | - 84 | Variables: 85 | Global: 86 | - 87 | Static: 88 | - 89 | Commands: 90 | - 91 | Compile options: 92 | - 93 | Operators: 94 | - 95 | \**--------------------------------------------------------------------------**/ 96 | 97 | #if defined _INC_y_gamerzps 98 | #endinput 99 | #endif 100 | #define _INC_y_gamerzps 101 | 102 | 103 | -------------------------------------------------------------------------------- /includes/YSI_Players/y_text/renderer3.inc: -------------------------------------------------------------------------------- 1 | // Rendered v3. In this version, strings are pre-processed to remove ALL of the 2 | // special characters, and linked lists of them are appended to the end of the 3 | // string instead. 4 | 5 | // We can probably merge the two formatting phases, there is really no reason 6 | // for them to be separate (assuming I can compact enough data in). 7 | 8 | // Colours are stored in a very unique manner (at least I've never seen it 9 | // before). Most people can't tell the difference visually between, say, 10 | // 0x286A44FF and 0x286A45FF (it's hard enough to read the difference). There 11 | // is just one bit different, and that is the LSB of the Blue component, meaning 12 | // that it makes a trivial contribution to the colour displayed. If we use 13 | // these LSBs for something else, then it doesn't matter if they are set or not 14 | // for the display of the colour, and we can instead get 4 bit flags embedded 15 | // within the colour. 16 | 17 | enum e_TEXT_RENDER_COLOUR 18 | { 19 | e_TEXT_RENDER_COLOUR_END = 0x01000000, // {/} 20 | e_TEXT_RENDER_COLOUR_FADE = 0x00010000, // {>XXXXXX} 21 | e_TEXT_RENDER_COLOUR_STAR = 0x00000100, // {*} 22 | e_TEXT_RENDER_COLOUR_____ = 0x00000001, // 23 | e_TEXT_RENDER_COLOUR_MASK = 0xFEFEFEFE 24 | } 25 | 26 | // We have 27 | 28 | 29 | 30 | #if 0 31 | 32 | // Current specifier position: 10 33 | // Inserted data: 12 characters. 34 | 35 | // For each pass after the current one... 36 | { 37 | // Get the current pointer in the linked list. 38 | new 39 | cur = indexes[pass]; 40 | // Add the shift on. 41 | str[cur] += addition; 42 | do 43 | { 44 | cur += 2; 45 | } 46 | while 47 | } 48 | 49 | 50 | Y_TEXT_STATIC stock TextR_UpdatePass(string:str[], indexes[E_TEXT_RENDER_PASSES], addition, nextPos, E_TEXT_RENDER_PASSES:pass) 51 | { 52 | // "pass" is not defined here in "for" so we can skip early passes in the 53 | // update code after they have already been run. The calling code passes 54 | // the CURRENT pass, which is instantly incremented. 55 | while (++pass != E_TEXT_RENDER_PASSES) 56 | { 57 | new 58 | cur = indexes[pass]; 59 | if (cur > nextPos) 60 | { 61 | // Also covers cases where there are none left. 62 | indexes[pass] += addition; 63 | } 64 | else 65 | { 66 | // Add the length of the string just formatted (-2) to the offset to 67 | // the next action of the current pass in this string. Get the new 68 | // relative offset to the next item. 69 | new 70 | off = (str[cur] += addition); 71 | // Find the absolute position of the next item, then test if it is 72 | // before "nextPos" (not <=). 73 | while ((cur += off) < nextPos) 74 | { 75 | if ((off = str[cur] & e_TEXT_RENDER_NEXT_MASK)) 76 | { 77 | indexes[pass] = cur; 78 | } 79 | else 80 | { 81 | // There are no actions of this rendering pass after 82 | // "nextPos" in the string. 83 | indexes[pass] = 65536; 84 | break; 85 | } 86 | } 87 | } 88 | } 89 | } 90 | 91 | #endif 92 | 93 | -------------------------------------------------------------------------------- /includes/YSI_Core/y_als.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ============================== 3 | y_als - Useful codes for ALS 4 | ============================== 5 | Description: 6 | Provides a number of macros for making ALS (Advanced Library System) 7 | callback hooking simpler. 8 | Legal: 9 | Version: MPL 1.1 10 | 11 | The contents of this file are subject to the Mozilla Public License Version 12 | 1.1 (the "License"); you may not use this file except in compliance with 13 | the License. You may obtain a copy of the License at 14 | http://www.mozilla.org/MPL/ 15 | 16 | Software distributed under the License is distributed on an "AS IS" basis, 17 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 18 | for the specific language governing rights and limitations under the 19 | License. 20 | 21 | The Original Code is the YSI ALS include. 22 | 23 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 24 | Portions created by the Initial Developer are Copyright (C) 2011 25 | the Initial Developer. All Rights Reserved. 26 | 27 | Contributors: 28 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 29 | 30 | Thanks: 31 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 32 | ZeeX - Very productive conversations. 33 | koolk - IsPlayerinAreaEx code. 34 | TheAlpha - Danish translation. 35 | breadfish - German translation. 36 | Fireburn - Dutch translation. 37 | yom - French translation. 38 | 50p - Polish translation. 39 | Zamaroht - Spanish translation. 40 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 41 | for me to strive to better. 42 | Pixels^ - Running XScripters where the idea was born. 43 | Matite - Pestering me to release it and using it. 44 | 45 | Very special thanks to: 46 | Thiadmer - PAWN, whose limits continue to amaze me! 47 | Kye/Kalcor - SA:MP. 48 | SA:MP Team past, present and future - SA:MP. 49 | 50 | Version: 51 | 1.0 52 | Changelog: 53 | 29/04/11: 54 | Added "call" macro to make testing easier. 55 | 21/10/10: 56 | First version 57 | 58 | \**--------------------------------------------------------------------------**/ 59 | 60 | #if !defined _INC_y_als 61 | 62 | #include "..\YSI_Internal\y_version" 63 | #include "y_utils" 64 | #include "..\YSI_Server\y_scriptinit" 65 | #include "..\YSI_Data\y_bit" 66 | #include "..\YSI_Internal\y_shortfunc" 67 | 68 | #include "y_als/impl" 69 | 70 | #if defined YSI_TESTS 71 | #include "..\YSI_Coding\y_va" 72 | 73 | #include "y_testing" 74 | #include "y_als/tests" 75 | #endif 76 | #define _INC_y_als 77 | #endif 78 | 79 | // Allow multiple inclusions. 80 | #include "..\YSI_Internal\y_compilerpass" 81 | #if AUTO_INCLUDE_GUARD 82 | #if !defined _inc_y_als 83 | #error Did you do instead of the required ? 84 | #endif 85 | #undef _inc_y_als 86 | #endif 87 | 88 | #if !defined ALS_MAKE 89 | #if defined ALS_PREFIX 90 | #error Use ALS_MAKE not ALS_PREFIX 91 | #endif 92 | //&&& 93 | #define ALS_MAKE<%0...%1> %0Mode_%1 94 | #endif 95 | -------------------------------------------------------------------------------- /includes/amx/stack_dump.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined STACK_DUMP_INC 22 | #endinput 23 | #endif 24 | #define STACK_DUMP_INC 25 | 26 | ///////////////////////////////////////////////// 27 | // Stack layout 28 | ///////////////////////////////////////////////// 29 | // what | stack pointer (STK) 30 | //----------------------------------------------- 31 | // | STP 32 | // ... | STP - 4 33 | // ... | STP - 8 34 | // ... | ... 35 | // argument_N | FRM + 4*(N+3) 36 | // ... | ... 37 | // argument_2 | FRM + 16 38 | // argument_1 | FRM + 12 39 | // 4*N | FRM + 8 40 | // RET address | FRM + 4 41 | // old FRM | FRM 42 | // | 43 | //-------------- N E W F R A M E --------------- 44 | // | 45 | // local_var_1 | FRM - 4 46 | // local_var_2 | FRM - 8 47 | // ... | ... 48 | // local_var_M | FRM - 4*M 49 | // ... | ... 50 | // ... | 8 51 | // ... | 4 52 | // | 0 53 | //----------------------------------------------- 54 | 55 | #include 56 | 57 | #include "amx_memory" 58 | 59 | stock DumpStack() 60 | { 61 | new stp, stk; 62 | 63 | #emit lctrl 3 64 | #emit stor.s.pri stp 65 | #emit lctrl 4 66 | #emit stor.s.pri stk 67 | 68 | print("------------------------"); 69 | print("Stack dump:"); 70 | print("------------------------"); 71 | 72 | // Skip locals + FRM + RETN address + paramcount. 73 | stk += 20; 74 | 75 | // Don't print above the top of the stack. 76 | new i = stp; 77 | printf("[0x%08x]: TOP", i); 78 | i -= 4; 79 | for ( ; i >= stk; i -= 4) { 80 | printf("[0x%08x]: 0x%08x", i, ReadAmxMemory(i)); 81 | } 82 | 83 | print("------------------------"); 84 | } 85 | -------------------------------------------------------------------------------- /includes/YSI_Storage/y_bitmap.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ================================= 3 | y_bitmap - Generate bitmaps. 4 | ================================= 5 | Description: 6 | Code to generate images on the server in the bitmap format. This is by far 7 | the simplest format to write to as it is just a huge array of colours (at 8 | least 24-bit bitmaps are, and we only do them). 9 | Legal: 10 | Version: MPL 1.1 11 | 12 | The contents of this file are subject to the Mozilla Public License Version 13 | 1.1 (the "License"); you may not use this file except in compliance with 14 | the License. You may obtain a copy of the License at 15 | http://www.mozilla.org/MPL/ 16 | 17 | Software distributed under the License is distributed on an "AS IS" basis, 18 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 19 | for the specific language governing rights and limitations under the 20 | License. 21 | 22 | The Original Code is the YSI utils include. 23 | 24 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 25 | Portions created by the Initial Developer are Copyright (C) 2011 26 | the Initial Developer. All Rights Reserved. 27 | 28 | Contributors: 29 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 30 | 31 | Thanks: 32 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 33 | ZeeX - Very productive conversations. 34 | koolk - IsPlayerinAreaEx code. 35 | TheAlpha - Danish translation. 36 | breadfish - German translation. 37 | Fireburn - Dutch translation. 38 | yom - French translation. 39 | 50p - Polish translation. 40 | Zamaroht - Spanish translation. 41 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 42 | for me to strive to better. 43 | Pixels^ - Running XScripters where the idea was born. 44 | Matite - Pestering me to release it and using it. 45 | 46 | Very special thanks to: 47 | Thiadmer - PAWN, whose limits continue to amaze me! 48 | Kye/Kalcor - SA:MP. 49 | SA:MP Team past, present and future - SA:MP. 50 | 51 | Version: 52 | 0.1 53 | Changelog: 54 | 29/03/13: 55 | First version. 56 | Functions: 57 | Stock: 58 | - 59 | Inline: 60 | - 61 | Variables: 62 | Global: 63 | - 64 | \**--------------------------------------------------------------------------**/ 65 | 66 | #if defined _INC_y_bitmap 67 | #endinput 68 | #endif 69 | #define _INC_y_bitmap 70 | 71 | #include "..\YSI_Internal\y_version" 72 | #include "..\YSI_Data\y_bit" 73 | #include "..\YSI_Core\y_utils" 74 | #include "..\YSI_Coding\y_malloc" 75 | // Because having colours is always good... 76 | #include "..\YSI_Server\y_colours" 77 | 78 | #if defined YSI_MALLOC_SECURE 79 | #error y_bitmap does not (well) work with YSI_MALLOC_SECURE. 80 | #endif 81 | 82 | #include "y_bitmap/impl" 83 | #include "y_bitmap/fonts" 84 | #include "y_bitmap/blending" 85 | #include "y_bitmap/subpixel" 86 | #include "y_bitmap/patterns" 87 | #include "y_bitmap/shapes" 88 | 89 | #include "y_bitmap/write" 90 | 91 | #if defined YSI_TESTS 92 | #include "..\YSI_Core\y_testing" 93 | #include "y_bitmap/tests" 94 | #endif 95 | -------------------------------------------------------------------------------- /includes/YSI_Storage/y_bitmap/blending.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ================================= 3 | y_bitmap - Generate bitmaps. 4 | ================================= 5 | Description: 6 | Code to generate images on the server in the bitmap format. This is by far 7 | the simplest format to write to as it is just a huge array of colours (at 8 | least 24-bit bitmaps are, and we only do them). 9 | 10 | This file combines a colour with alpha on to the pixel already at the given 11 | location. 12 | Legal: 13 | Version: MPL 1.1 14 | 15 | The contents of this file are subject to the Mozilla Public License Version 16 | 1.1 (the "License"); you may not use this file except in compliance with 17 | the License. You may obtain a copy of the License at 18 | http://www.mozilla.org/MPL/ 19 | 20 | Software distributed under the License is distributed on an "AS IS" basis, 21 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 22 | for the specific language governing rights and limitations under the 23 | License. 24 | 25 | The Original Code is the YSI utils include. 26 | 27 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 28 | Portions created by the Initial Developer are Copyright (C) 2011 29 | the Initial Developer. All Rights Reserved. 30 | 31 | Contributors: 32 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 33 | 34 | Thanks: 35 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 36 | ZeeX - Very productive conversations. 37 | koolk - IsPlayerinAreaEx code. 38 | TheAlpha - Danish translation. 39 | breadfish - German translation. 40 | Fireburn - Dutch translation. 41 | yom - French translation. 42 | 50p - Polish translation. 43 | Zamaroht - Spanish translation. 44 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 45 | for me to strive to better. 46 | Pixels^ - Running XScripters where the idea was born. 47 | Matite - Pestering me to release it and using it. 48 | 49 | Very special thanks to: 50 | Thiadmer - PAWN, whose limits continue to amaze me! 51 | Kye/Kalcor - SA:MP. 52 | SA:MP Team past, present and future - SA:MP. 53 | 54 | Version: 55 | 0.1 56 | Changelog: 57 | 29/03/13: 58 | First version. 59 | Functions: 60 | Stock: 61 | - 62 | Inline: 63 | - 64 | Variables: 65 | Global: 66 | - 67 | \**--------------------------------------------------------------------------**/ 68 | 69 | stock Bitmap_WritePixel(Bitmap:ctx, const x, const y, const colour) 70 | { 71 | new 72 | a = colour & 0xFF; 73 | switch (a) 74 | { 75 | case 0: return; 76 | case 0xFF: Bitmap_WriteCtx(ctx, x, y, colour); 77 | default: 78 | { 79 | new 80 | r = ((colour & 0xFF000000) >>> 8) * a, 81 | g = ((colour & 0x00FF0000) >>> 8) * a, 82 | b = ((colour & 0x0000FF00) >>> 8) * a, 83 | oc = Bitmap_ReadCtx(ctx, x, y); 84 | a = 256 - a; 85 | oc = 86 | ((((oc & 0xFF000000) >>> 8) * a + r) & 0xFF000000) | 87 | ((((oc & 0x00FF0000) >>> 8) * a + g) & 0x00FF0000) | 88 | ((((oc & 0x0000FF00) >>> 8) * a + b) & 0x0000FF00) ; 89 | Bitmap_WriteCtx(ctx, x, y, oc); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /includes/YSI_Visual/y_races/groups.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ======================================= 3 | y_races - Group settings 4 | ======================================= 5 | Description: 6 | - 7 | Legal: 8 | Version: MPL 1.1 9 | 10 | The contents of this file are subject to the Mozilla Public License Version 11 | 1.1 (the "License"); you may not use this file except in compliance with 12 | the License. You may obtain a copy of the License at 13 | http://www.mozilla.org/MPL/ 14 | 15 | Software distributed under the License is distributed on an "AS IS" basis, 16 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 17 | for the specific language governing rights and limitations under the 18 | License. 19 | 20 | The Original Code is the YSI classgroups include. 21 | 22 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 23 | Portions created by the Initial Developer are Copyright (C) 2011 24 | the Initial Developer. All Rights Reserved. 25 | 26 | Contributors: 27 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 28 | 29 | Thanks: 30 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 31 | ZeeX - Very productive conversations. 32 | koolk - IsPlayerinAreaEx code. 33 | TheAlpha - Danish translation. 34 | breadfish - German translation. 35 | Fireburn - Dutch translation. 36 | yom - French translation. 37 | 50p - Polish translation. 38 | Zamaroht - Spanish translation. 39 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 40 | for me to strive to better. 41 | Pixels^ - Running XScripters where the idea was born. 42 | Matite - Pestering me to release it and using it. 43 | 44 | Very special thanks to: 45 | Thiadmer - PAWN, whose limits continue to amaze me! 46 | Kye/Kalcor - SA:MP. 47 | SA:MP Team past, present and future - SA:MP. 48 | 49 | Version: 50 | 1.0 51 | Changelog: 52 | 28/03/13: 53 | First version 54 | \**--------------------------------------------------------------------------**/ 55 | 56 | stock Races_SetupGroups() 57 | { 58 | Group_SetGlobalRaceDefault(false); 59 | // This already is the default. 60 | //Group_SetRaceDefault(false); 61 | } 62 | 63 | stock Races_ResolveGroups(class, Group:forgroup, bool:cp) 64 | { 65 | P:2("Class_ResolveGroups: call Resolve %d %d %d", class, _:forgroup, cp); 66 | if (cp) 67 | { 68 | // Here "class" means "playerid". 69 | Group_SetPlayer(forgroup, class, true); 70 | } 71 | else 72 | { 73 | P:7("Class_ResolveGroups: Enable this class: %d For: %d", class, _:forgroup); 74 | // Only enable this class for one group. 75 | //Group_UpdateAllClass(class, false); 76 | //Group_SetClass(forgroup, class, true); 77 | /*#if !(YSIM_HAS_MASTER && (_YSIM_IS_CLIENT || _YSIM_IS_STUB)) 78 | _yGIClass(-1, 2, _:forgroup); 79 | Class_InitialiseFromGroups(el); 80 | _yGIClass(-1, 3, _:forgroup); 81 | #endif 82 | GROUP_ADD 83 | { 84 | // el. 85 | }*/ 86 | if (forgroup == Group:-1) Group_ExclusiveClass(GROUP_GLOBAL, class); 87 | else Group_ExclusiveClass(forgroup, class); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /includes/YSI_Coding/y_va/tests.inc: -------------------------------------------------------------------------------- 1 | static 2 | YSI_g_sVariable; 3 | 4 | forward y_va_PublicTestFunction(vara, varb); 5 | 6 | public y_va_PublicTestFunction(vara, varb) 7 | { 8 | if (vara) 9 | { 10 | YSI_g_sVariable = varb; 11 | } 12 | else 13 | { 14 | ++YSI_g_sVariable; 15 | } 16 | } 17 | 18 | static stock y_va_CallRemoteFunction(va_args<>) 19 | { 20 | va_CallRemoteFunction("y_va_PublicTestFunction", "ii", va_start<0>); 21 | } 22 | 23 | Test:y_va_CallRemoteFunction() 24 | { 25 | YSI_g_sVariable = 5; 26 | y_va_CallRemoteFunction(0, 11); 27 | ASSERT(YSI_g_sVariable == 6); 28 | y_va_CallRemoteFunction(1, 11); 29 | ASSERT(YSI_g_sVariable == 11); 30 | } 31 | 32 | static stock y_va_CallLocalFunction(va_args<>) 33 | { 34 | va_CallLocalFunction("y_va_PublicTestFunction", "ii", va_start<0>); 35 | } 36 | 37 | Test:y_va_CallLocalFunction() 38 | { 39 | YSI_g_sVariable = 8; 40 | y_va_CallLocalFunction(0, 45); 41 | ASSERT(YSI_g_sVariable == 9); 42 | y_va_CallLocalFunction(1, 45); 43 | ASSERT(YSI_g_sVariable == 45); 44 | } 45 | 46 | static stock y_va_SetTimerEx(va_args<>) 47 | { 48 | return va_SetTimerEx("y_va_SetTimerExPublic", 1000, false, "iii", va_start<0>); 49 | } 50 | 51 | Test:va_SetTimerEx() 52 | { 53 | ASSERT(y_va_SetTimerEx(5, 6, 7) != 0); 54 | } 55 | 56 | static stock y_va_format(dest[], size, fmat[], va_args<>) 57 | { 58 | va_format(dest, size, fmat, va_start<3>); 59 | } 60 | 61 | Test:y_va_format() 62 | { 63 | new 64 | str[64]; 65 | y_va_format(str, sizeof (str), "Hello %d %04x %s", 99, 0x1F, "woop"); 66 | ASSERT(!strcmp(str, "Hello 99 001F woop")); 67 | } 68 | 69 | static stock y_va_return(dest[], size, fmat[], va_args<>) 70 | { 71 | strcpy(dest, va_return(fmat, va_start<3>), size); 72 | } 73 | 74 | Test:y_va_return() 75 | { 76 | new 77 | str[YSI_MAX_STRING * 8]; 78 | y_va_return(str, sizeof (str), "Hi %.3f %8.8s %8.8s", 5.5, "this is a very long string", "short"); 79 | ASSERT(!strcmp(str, "Hi 5.500 this is short ")); 80 | } 81 | 82 | static stock y_va_DoubleIndirection(dest[1040], fmat[], var0, var1, var2, va_args<>) //var3, var4, size = sizeof (dest)) 83 | { 84 | #pragma unused var0, var1, var2 85 | // va_format(dest, 32, fmat, va_start<5>); 86 | dest = va_return(fmat, va_start<5>); 87 | } 88 | 89 | Test:y_va_DoubleIndirection() 90 | { 91 | new 92 | dest[1040], 93 | var0 = 44, 94 | var1 = 55, 95 | var2 = 66, 96 | var3 = 77, 97 | var4 = 88; 98 | y_va_DoubleIndirection(dest, "%d %d", var0, var1, var2, var3, var4); 99 | ASSERT(var0 == 44); 100 | ASSERT(var1 == 55); 101 | ASSERT(var2 == 66); 102 | ASSERT(var3 == 77); 103 | ASSERT(var4 == 88); 104 | ASSERT(!strcmp(dest, "77 88")); 105 | } 106 | 107 | static stock bool:y_va_Locals(real[], fmat[], va_args<>) 108 | { 109 | new 110 | dest[128]; 111 | va_format(dest, sizeof (dest), fmat, va_start<2>); 112 | return !strcmp(dest, real); 113 | } 114 | 115 | Test:y_va_Locals() 116 | { 117 | ASSERT(y_va_Locals("42", "%d", 42)); 118 | ASSERT(y_va_Locals("42 43 44", "%d %d %d", 42, 43, 44)); 119 | ASSERT(y_va_Locals("hi", "%s", "hi")); 120 | ASSERT(y_va_Locals("he -1", "%.2s %d", "hello", -1)); 121 | } 122 | 123 | 124 | -------------------------------------------------------------------------------- /includes/YSI_Data/y_hashmap.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ==================================== 3 | y_hashmap - Link strings to values 4 | ==================================== 5 | Description: 6 | Maps string indexes to integer indexes. Uses a fast hash to get an array 7 | slot, then a linked list to resolve collisions. 8 | Legal: 9 | Version: MPL 1.1 10 | 11 | The contents of this file are subject to the Mozilla Public License Version 12 | 1.1 (the "License"); you may not use this file except in compliance with 13 | the License. You may obtain a copy of the License at 14 | http://www.mozilla.org/MPL/ 15 | 16 | Software distributed under the License is distributed on an "AS IS" basis, 17 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 18 | for the specific language governing rights and limitations under the 19 | License. 20 | 21 | The Original Code is the YSI hashmap include. 22 | 23 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 24 | Portions created by the Initial Developer are Copyright (C) 2011 25 | the Initial Developer. All Rights Reserved. 26 | 27 | Contributors: 28 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 29 | 30 | Thanks: 31 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 32 | ZeeX - Very productive conversations. 33 | koolk - IsPlayerinAreaEx code. 34 | TheAlpha - Danish translation. 35 | breadfish - German translation. 36 | Fireburn - Dutch translation. 37 | yom - French translation. 38 | 50p - Polish translation. 39 | Zamaroht - Spanish translation. 40 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 41 | for me to strive to better. 42 | Pixels^ - Running XScripters where the idea was born. 43 | Matite - Pestering me to release it and using it. 44 | 45 | Very special thanks to: 46 | Thiadmer - PAWN, whose limits continue to amaze me! 47 | Kye/Kalcor - SA:MP. 48 | SA:MP Team past, present and future - SA:MP. 49 | 50 | Version: 51 | 2.0 52 | Changelog: 53 | 23/06/13: 54 | First version. 55 | Functions: 56 | stock: 57 | HashMap_Init - Associate a hash map with an array. 58 | HashMap_Add - Add a value under a given string. 59 | HashMap_Get - Get a value from a string. 60 | HashMap_RemoveKey - Remove a string and its value from a hash map. 61 | HashMap_Set - Change the value associated with a key. 62 | Definitions: 63 | HASH_MAP_DATA - What should be added to enums to be hash map referenced. 64 | HashMap - Declare a new hash map. 65 | \**--------------------------------------------------------------------------**/ 66 | 67 | #if defined _INC_y_hashmap 68 | #endinput 69 | #endif 70 | #define _INC_y_hashmap 71 | 72 | #include "..\amx\amx_memory" 73 | #include "..\YSI_Core\y_utils" 74 | #include "..\YSI_Storage\y_amx" 75 | #include "..\YSI_Coding\y_stringhash" 76 | #include "..\YSI_Internal\y_shortfunc" 77 | 78 | #include "y_hashmap/impl" 79 | 80 | // The hashmap tests are vast. Only include them when explicitly requested. 81 | #if defined YSI_TESTS && defined YSI_HASHMAP_TESTS 82 | #include "..\YSI_Core\y_testing" 83 | #include "y_hashmap/tests" 84 | #endif 85 | 86 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_classgroups.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ======================================= 3 | y_classes - Advanced class selection! 4 | ======================================= 5 | Description: 6 | Allows for advanced class selection options such as skins only certain 7 | people can see and actually removing skins from class selection. 8 | Legal: 9 | Version: MPL 1.1 10 | 11 | The contents of this file are subject to the Mozilla Public License Version 12 | 1.1 (the "License"); you may not use this file except in compliance with 13 | the License. You may obtain a copy of the License at 14 | http://www.mozilla.org/MPL/ 15 | 16 | Software distributed under the License is distributed on an "AS IS" basis, 17 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 18 | for the specific language governing rights and limitations under the 19 | License. 20 | 21 | The Original Code is the YSI classgroups include. 22 | 23 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 24 | Portions created by the Initial Developer are Copyright (C) 2011 25 | the Initial Developer. All Rights Reserved. 26 | 27 | Contributors: 28 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 29 | 30 | Thanks: 31 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 32 | ZeeX - Very productive conversations. 33 | koolk - IsPlayerinAreaEx code. 34 | TheAlpha - Danish translation. 35 | breadfish - German translation. 36 | Fireburn - Dutch translation. 37 | yom - French translation. 38 | 50p - Polish translation. 39 | Zamaroht - Spanish translation. 40 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 41 | for me to strive to better. 42 | Pixels^ - Running XScripters where the idea was born. 43 | Matite - Pestering me to release it and using it. 44 | 45 | Very special thanks to: 46 | Thiadmer - PAWN, whose limits continue to amaze me! 47 | Kye/Kalcor - SA:MP. 48 | SA:MP Team past, present and future - SA:MP. 49 | 50 | Version: 51 | 1.0 52 | Changelog: 53 | 29/11/10: 54 | First version 55 | 56 | \**--------------------------------------------------------------------------**/ 57 | 58 | #if defined _INC_y_classgroups 59 | #endinput 60 | #endif 61 | #define _INC_y_classgroups 62 | 63 | stock Class_ResolveGroups(class, Group:forgroup, bool:cp) 64 | { 65 | P:2("Class_ResolveGroups: call Resolve %d %d %d", class, _:forgroup, cp); 66 | if (cp) 67 | { 68 | // Here "class" means "playerid". 69 | Group_SetPlayer(forgroup, class, true); 70 | } 71 | else 72 | { 73 | P:7("Class_ResolveGroups: Enable this class: %d For: %d", class, _:forgroup); 74 | // Only enable this class for one group. 75 | //Group_UpdateAllClass(class, false); 76 | //Group_SetClass(forgroup, class, true); 77 | /*#if !(YSIM_HAS_MASTER && (_YSIM_IS_CLIENT || _YSIM_IS_STUB)) 78 | _yGIClass(-1, 2, _:forgroup); 79 | Class_InitialiseFromGroups(el); 80 | _yGIClass(-1, 3, _:forgroup); 81 | #endif 82 | GROUP_ADD 83 | { 84 | // el. 85 | }*/ 86 | if (forgroup == Group:-1) Group_ExclusiveClass(GROUP_GLOBAL, class); 87 | else Group_ExclusiveClass(forgroup, class); 88 | } 89 | } 90 | 91 | -------------------------------------------------------------------------------- /includes/YSI_Extra/y_files.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ======================== 3 | y_files - Include File 4 | ======================== 5 | Description: 6 | Provides native declarations for YSF functions. 7 | Legal: 8 | Version: MPL 1.1 9 | 10 | The contents of this file are subject to the Mozilla Public License Version 11 | 1.1 (the "License"); you may not use this file except in compliance with 12 | the License. You may obtain a copy of the License at 13 | http://www.mozilla.org/MPL/ 14 | 15 | Software distributed under the License is distributed on an "AS IS" basis, 16 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 17 | for the specific language governing rights and limitations under the 18 | License. 19 | 20 | The Original Code is the YSI files include. 21 | 22 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 23 | Portions created by the Initial Developer are Copyright (C) 2011 24 | the Initial Developer. All Rights Reserved. 25 | 26 | Contributors: 27 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 28 | 29 | Thanks: 30 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 31 | ZeeX - Very productive conversations. 32 | koolk - IsPlayerinAreaEx code. 33 | TheAlpha - Danish translation. 34 | breadfish - German translation. 35 | Fireburn - Dutch translation. 36 | yom - French translation. 37 | 50p - Polish translation. 38 | Zamaroht - Spanish translation. 39 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 40 | for me to strive to better. 41 | Pixels^ - Running XScripters where the idea was born. 42 | Matite - Pestering me to release it and using it. 43 | 44 | Very special thanks to: 45 | Thiadmer - PAWN, whose limits continue to amaze me! 46 | Kye/Kalcor - SA:MP. 47 | SA:MP Team past, present and future - SA:MP. 48 | 49 | Version: 50 | 0.1 51 | Changelog: 52 | 15/09/10: 53 | First version split from the old YSF. 54 | Functions: 55 | Public: 56 | - 57 | Core: 58 | - 59 | Stock: 60 | - 61 | Static: 62 | - 63 | Inline: 64 | - 65 | API: 66 | - 67 | Callbacks: 68 | - 69 | Definitions: 70 | - 71 | Enums: 72 | - 73 | Macros: 74 | - 75 | Tags: 76 | - 77 | Variables: 78 | Global: 79 | - 80 | Static: 81 | - 82 | Commands: 83 | - 84 | Compile options: 85 | - 86 | Operators: 87 | - 88 | 89 | \**--------------------------------------------------------------------------**/ 90 | 91 | #if defined _INC_y_files 92 | #endinput 93 | #endif 94 | #define _INC_y_files 95 | 96 | /**--------------------------------------------------------------------------**\ 97 | ================= 98 | y_ini Libraries 99 | ================= 100 | 101 | \**--------------------------------------------------------------------------**/ 102 | 103 | // File functions 104 | native ffind(const pattern[], filename[], len, &idx); 105 | native frename(const oldname[], const newname[]); 106 | 107 | // Directory functions 108 | native dfind(const pattern[], filename[], len, &idx); 109 | native dcreate(const name[]); 110 | native drename(const oldname[], const newname[]); 111 | -------------------------------------------------------------------------------- /includes/YSI_Coding/y_va.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ============================== 3 | y_va - Enhanced vararg code! 4 | ============================== 5 | Description: 6 | This library currently provides two functions - va_printf and va_format 7 | which perform printf and format using variable arguments passed to another 8 | function. 9 | 10 | This is bsed on the variable parameter passing method based on code by Zeex. 11 | See page 15 of the code optimisations topic. 12 | Legal: 13 | Version: MPL 1.1 14 | 15 | The contents of this file are subject to the Mozilla Public License Version 16 | 1.1 (the "License"); you may not use this file except in compliance with 17 | the License. You may obtain a copy of the License at 18 | http://www.mozilla.org/MPL/ 19 | 20 | Software distributed under the License is distributed on an "AS IS" basis, 21 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 22 | for the specific language governing rights and limitations under the 23 | License. 24 | 25 | The Original Code is the YSI vararg include. 26 | 27 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 28 | Portions created by the Initial Developer are Copyright (C) 2011 29 | the Initial Developer. All Rights Reserved. 30 | 31 | Contributors: 32 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 33 | 34 | Thanks: 35 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 36 | ZeeX - Very productive conversations. 37 | koolk - IsPlayerinAreaEx code. 38 | TheAlpha - Danish translation. 39 | breadfish - German translation. 40 | Fireburn - Dutch translation. 41 | yom - French translation. 42 | 50p - Polish translation. 43 | Zamaroht - Spanish translation. 44 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 45 | for me to strive to better. 46 | Pixels^ - Running XScripters where the idea was born. 47 | Matite - Pestering me to release it and using it. 48 | 49 | Very special thanks to: 50 | Thiadmer - PAWN, whose limits continue to amaze me! 51 | Kye/Kalcor - SA:MP. 52 | SA:MP Team past, present and future - SA:MP. 53 | 54 | Version: 55 | 1.0 56 | Changelog: 57 | 02/05/11: 58 | First version. 59 | Functions: 60 | Public: 61 | - 62 | Core: 63 | - 64 | Stock: 65 | - 66 | Static: 67 | - 68 | Inline: 69 | - 70 | API: 71 | - 72 | Callbacks: 73 | - 74 | Definitions: 75 | - 76 | Enums: 77 | - 78 | Macros: 79 | - 80 | Tags: 81 | - 82 | Variables: 83 | Global: 84 | - 85 | Static: 86 | - 87 | Commands: 88 | - 89 | Compile options: 90 | - 91 | Operators: 92 | - 93 | 94 | \**--------------------------------------------------------------------------**/ 95 | 96 | #if defined _INC_y_va 97 | #endinput 98 | #endif 99 | #define _INC_y_va 100 | 101 | //#define va_args<%0> %0 102 | #define va_args<%0> GLOBAL_TAG_TYPES:... 103 | #define va_start<%0> (va_:(%0)) 104 | 105 | #include "..\YSI_Internal\y_version" 106 | #include "..\YSI_Internal\y_funcinc" 107 | #include "..\YSI_Core\y_utils" 108 | 109 | #include "y_va/impl" 110 | 111 | #if defined YSI_TESTS 112 | #include "..\YSI_Core\y_testing" 113 | #include "y_va/tests" 114 | #endif 115 | 116 | -------------------------------------------------------------------------------- /includes/YSI_Storage/y_svar.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ================================= 3 | y_svar - Automatic data saving. 4 | ================================= 5 | Description: 6 | Declares data to be automatically saved and loaded for the whole server. 7 | Legal: 8 | Version: MPL 1.1 9 | 10 | The contents of this file are subject to the Mozilla Public License Version 11 | 1.1 (the "License"); you may not use this file except in compliance with 12 | the License. You may obtain a copy of the License at 13 | http://www.mozilla.org/MPL/ 14 | 15 | Software distributed under the License is distributed on an "AS IS" basis, 16 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 17 | for the specific language governing rights and limitations under the 18 | License. 19 | 20 | The Original Code is the YSI utils include. 21 | 22 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 23 | Portions created by the Initial Developer are Copyright (C) 2011 24 | the Initial Developer. All Rights Reserved. 25 | 26 | Contributors: 27 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 28 | 29 | Thanks: 30 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 31 | ZeeX - Very productive conversations. 32 | koolk - IsPlayerinAreaEx code. 33 | TheAlpha - Danish translation. 34 | breadfish - German translation. 35 | Fireburn - Dutch translation. 36 | yom - French translation. 37 | 50p - Polish translation. 38 | Zamaroht - Spanish translation. 39 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 40 | for me to strive to better. 41 | Pixels^ - Running XScripters where the idea was born. 42 | Matite - Pestering me to release it and using it. 43 | 44 | Very special thanks to: 45 | Thiadmer - PAWN, whose limits continue to amaze me! 46 | Kye/Kalcor - SA:MP. 47 | SA:MP Team past, present and future - SA:MP. 48 | 49 | Version: 50 | 0.1 51 | Changelog: 52 | 25/02/12: 53 | First version. 54 | Functions: 55 | Stock: 56 | - 57 | Inline: 58 | - 59 | Variables: 60 | Global: 61 | - 62 | \**--------------------------------------------------------------------------**/ 63 | 64 | #if defined _INC_y_svar 65 | #endinput 66 | #endif 67 | #define _INC_y_svar 68 | 69 | // y_uvars 70 | 71 | #if !defined MODE_NAME 72 | #error Please define "MODE_NAME" before including y_svar. 73 | #endif 74 | 75 | #if defined SVAR_USE_MYSQL 76 | #if _YSI_PLUGINS_MYSQL == 7 77 | #include "y_svar/blueg7" 78 | #elseif _YSI_PLUGINS_MYSQL == 6 79 | #include "y_svar/blueg6" 80 | #elseif _YSI_PLUGINS_MYSQL == 7 81 | #include "y_svar/stricken" 82 | #else 83 | #error No MySQL plugin found. 84 | #endif 85 | #elseif defined SVAR_USE_SQLITE 86 | #include "y_svar/sqlite" 87 | #else 88 | #include "..\YSI_Internal\y_version" 89 | #include "..\YSI_Storage\y_amx" 90 | #include "..\YSI_Core\y_debug" 91 | #include "..\YSI_Core\y_utils" 92 | #include "..\YSI_Storage\y_ini" 93 | #include "..\YSI_Coding\y_hooks" 94 | #include "..\YSI_Internal\y_stripnumbers" 95 | 96 | #include "y_svar/ini" 97 | #endif 98 | #if defined YSI_TESTS 99 | #include "..\YSI_Core\y_testing" 100 | #include "y_svar/tests" 101 | #endif 102 | -------------------------------------------------------------------------------- /modules/missions/sweetcall.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/missions/sweetcall.pwn 3 | * 4 | * DESCRIPTION : 5 | * After first call sweet calls CJ. 6 | * 7 | * NOTES : 8 | * - 9 | */ 10 | 11 | #include 12 | 13 | static gplCurrentSound[MAX_PLAYERS] = {-1, ...}; 14 | static bool:gplIsPhoneRinging[MAX_PLAYERS]; 15 | 16 | static gCutsceneData[][][] = 17 | { 18 | {29098, 1500, !"Sweet, hey, wassup?"}, 19 | {29099, 2000, !"Thought I'd explain some shit."}, 20 | {29100, 2500, !"Since you been away, shit has changed 'round here."}, 21 | {29101, 2150, !"Grove Street Families ain't big no more."}, 22 | {29102, 4200, !"Seville Boulevard Families and Temple Drive Families are beefing, and split with the Grove."}, 23 | {29103, 4200, !"Now we so busy set tripping, Ballas and Vagos have taken over, so watch yo'self out there."}, 24 | {29104, 3100, !"Just because theyre wearing greens, dont mean theyre allies. Copy?"}, 25 | {29105, 1500, !"Yeah, I hear you."}, 26 | {29106, 1500, !"Thanks for the heads up."}, 27 | {29107, 1500, !"Don't mention it."} 28 | }; 29 | 30 | hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) 31 | { 32 | if((newkeys & KEY_YES) && gplIsPhoneRinging[playerid]) 33 | { 34 | gplCurrentSound[playerid] = 0; 35 | gplIsPhoneRinging[playerid] = false; 36 | SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE); 37 | HidePlayerInfoMessage(playerid); 38 | defer ProcessPhoneCutscene(playerid); 39 | } 40 | return 1; 41 | } 42 | 43 | hook OnPlayerSpawn(playerid) 44 | { 45 | if(GetPlayerCurrentMission(playerid) == MISSION_SWEET_CALL && gplIsPhoneRinging[playerid] == false) 46 | defer RingPlayerPhone(playerid); 47 | return 1; 48 | } 49 | 50 | hook OnPlayerDisconnect(playerid, reason) 51 | { 52 | gplCurrentSound[playerid] = -1; 53 | gplIsPhoneRinging[playerid] = false; 54 | return 1; 55 | } 56 | 57 | timer ProcessPhoneCutscene[1000](playerid) 58 | { 59 | new i = gplCurrentSound[playerid]; 60 | if(i < sizeof(gCutsceneData)) 61 | { 62 | gplCurrentSound[playerid]++; 63 | PlayerPlaySound(playerid, gCutsceneData[i][0][0], 0.0, 0.0, 0.0); 64 | ShowPlayerSubtitle(playerid, gCutsceneData[i][2]); 65 | defer ProcessPhoneCutscene[gCutsceneData[i][1][0]](playerid); 66 | } 67 | else if(i == sizeof(gCutsceneData)) 68 | { 69 | HidePlayerSubtitle(playerid); 70 | SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE); 71 | SetPlayerCurrentMission(playerid, MISSION_HOME_INVASION); 72 | SetPlayerMapIcon(playerid, 0, 2459.3779, -1689.3700, 13.5377, 34, -1, MAPICON_GLOBAL_CHECKPOINT); // next mission 73 | } 74 | } 75 | 76 | timer RingPlayerPhone[3000](playerid) 77 | { 78 | if(!IsPlayerConnected(playerid)) 79 | return 1; 80 | else if(IsPlayerInAnyVehicle(playerid)) 81 | { 82 | defer RingPlayerPhone(playerid); 83 | return 1; 84 | } 85 | else if(gplCurrentSound[playerid] == -1) 86 | { 87 | defer RingPlayerPhone(playerid); 88 | gplIsPhoneRinging[playerid] = true; 89 | PlayerPlaySound(playerid, 20600, 0.0, 0.0, 0.0); 90 | ShowPlayerInfoMessage(playerid, "Press Y to answer the phone."); 91 | } 92 | return 1; 93 | } 94 | -------------------------------------------------------------------------------- /includes/YSI_AC/y_ac@do_compiler_long_fix/constants/game.pwn: -------------------------------------------------------------------------------- 1 | /** 2 | * Multiple measurements are done to deal with FPS spikes. 3 | */ 4 | #define AC_MAX_FPS_INDEX 4 5 | 6 | /** 7 | * Maximum slots for weapons. 8 | */ 9 | #define AC_MAX_WEAPON_SLOTS 13 10 | 11 | /** 12 | * Whether two or three dimension vectors should be used. 13 | * 14 | * When 3D vectors are used, falling is reported as speed / teleport hack (sometimes). 15 | * In other words, using 2D vectors reduces the number of fake reports. 16 | * 17 | */ 18 | #define AC_USE_2D_VECTORS true 19 | 20 | /** 21 | * Vending machins' range. 22 | */ 23 | #define AC_VENDING_MACHINE_RANGE 15.0 24 | 25 | /** 26 | * The time (in ms) between checks. 27 | * Default timers from SA-MP are lazy. I suggest using a timer-fix for better output. 28 | */ 29 | #define AC_WATCHGUARD_INTERVAL 1500 30 | 31 | /** 32 | * Vending machines' position. 33 | */ 34 | stock const Float:AC_VENDING_MACHINES[][3] = { 35 | {-14.70, 1175.36, 18.95}, {201.02, -107.62, 0.90}, 36 | {662.43, -552.16, 15.71}, {-76.03, 1227.99, 19.13}, 37 | {1154.73, -1460.89, 15.16}, {1277.84, 372.52, 18.95}, 38 | {1398.84, 2222.61, 10.42}, {1520.15, 1055.27, 10.00}, 39 | {1634.11, -2237.53, 12.89}, {1659.46, 1722.86, 10.22}, 40 | {1729.79, -1943.05, 12.95}, {1789.21, -1369.27, 15.16}, 41 | {1928.73, -1772.45, 12.95}, {2060.12, -1897.64, 12.93}, 42 | {2085.77, 2071.36, 10.45}, {2139.52, -1161.48, 23.36}, 43 | {2153.23, -1016.15, 62.23}, {2271.73, -76.46, 25.96}, 44 | {2319.99, 2532.85, 10.22}, {2325.98, -1645.13, 14.21}, 45 | {2352.18, -1357.16, 23.77}, {2480.86, -1959.27, 12.96}, 46 | {2503.14, 1243.70, 10.22}, {-253.74, 2597.95, 62.24}, 47 | {-253.74, 2599.76, 62.24}, {2647.70, 1129.66, 10.22}, 48 | {2845.73, 1295.05, 10.79}, {-862.83, 1536.61, 21.98}, 49 | {-1350.12, 492.29, 10.59}, {-1350.12, 493.86, 10.59}, 50 | {-1455.12, 2591.66, 55.23}, {-1980.79, 142.66, 27.07}, 51 | {-2005.65, -490.05, 34.73}, {-2011.14, -398.34, 34.73}, 52 | {-2034.46, -490.05, 34.73}, {-2039.85, -398.34, 34.73}, 53 | {-2063.27, -490.05, 34.73}, {-2068.56, -398.34, 34.73}, 54 | {-2092.09, -490.05, 34.73}, {-2097.27, -398.34, 34.73}, 55 | {-2118.62, -422.41, 34.73}, {-2118.97, -423.65, 34.73}, 56 | {-2229.19, 286.41, 34.70}, {-2420.18, 985.95, 44.30}, 57 | {-2420.22, 984.58, 44.30}, {2155.84, 1607.88, 1000.06}, 58 | {2155.91, 1606.77, 1000.05}, {2202.45, 1617.01, 1000.06}, 59 | {2209.24, 1621.21, 1000.06}, {2209.91, 1607.20, 1000.05}, 60 | {2222.20, 1606.77, 1000.05}, {2222.37, 1602.64, 1000.06}, 61 | {2225.20, -1153.42, 1025.91}, {-15.10, -140.23, 1003.63}, 62 | {-16.12, -91.64, 1003.63}, {-16.53, -140.30, 1003.63}, 63 | {-17.55, -91.71, 1003.63}, {-19.04, -57.84, 1003.63}, 64 | {-32.45, -186.70, 1003.63}, {-33.88, -186.77, 1003.63}, 65 | {330.68, 178.50, 1020.07}, {331.92, 178.50, 1020.07}, 66 | {-35.73, -140.23, 1003.63}, {350.91, 206.09, 1008.48}, 67 | {-36.15, -57.88, 1003.63}, {361.56, 158.62, 1008.48}, 68 | {371.59, 178.45, 1020.07}, {373.83, -178.14, 1000.73}, 69 | {374.89, 188.98, 1008.48}, {379.04, -178.88, 1000.73}, 70 | {495.97, -24.32, 1000.73}, {500.56, -1.37, 1000.73}, 71 | {501.83, -1.43, 1000.73}, {2576.70, -1284.43, 1061.09} 72 | }; 73 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_cgen.inc: -------------------------------------------------------------------------------- 1 | #if defined _INC_y_cgen 2 | #endinput 3 | #endif 4 | #define _INC_y_cgen 5 | 6 | #include "..\YSI_Storage\y_amx" 7 | #include "..\amx\asm" 8 | 9 | // We use "STE" not a string literal as we are trying to use up code space, not 10 | // data space! 11 | #define _CODE_1 SetTimerEx(s,0,0,s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) 12 | #define _CODE_2 _CODE_1;_CODE_1;_CODE_1;_CODE_1;_CODE_1;_CODE_1 13 | 14 | static stock 15 | YSI_g_sCodeSpace = -1, 16 | YSI_g_sCodeEnd = -1; 17 | 18 | forward _@_y_cgen_@_0(); 19 | 20 | public _@_y_cgen_@_0() 21 | { 22 | #emit RETN // Invisible return. 23 | //P:F("Someone called \"_@_y_cgen_@_0\" and somehow it didn't crash yet!"); 24 | //assert(FALSE); // Always fails. 25 | // Reserve a huge area of "COD" for our own use! 26 | static 27 | s[] = ""; 28 | // This reserves about 10kb of space in "COD". If 10kb isn't enough I don't 29 | // know WHAT you're doing - that's enough space for about 200 hooks! 30 | _CODE_2; 31 | _CODE_2; 32 | _CODE_2; 33 | _CODE_2; 34 | _CODE_2; 35 | _CODE_2; 36 | _CODE_2; 37 | _CODE_2; 38 | _CODE_2; 39 | _CODE_2; 40 | _CODE_2; 41 | _CODE_2; 42 | _CODE_2; 43 | _CODE_2; 44 | _CODE_2; 45 | _CODE_2; 46 | // These are blocks of 16 lines. If you ever need to increase this space, 47 | // just duplicate a block of 16 lines. Do not put multiple "_CODE_2;" 48 | // statements on one line - the pre-processor expands this so much that that 49 | // will probably just crash. 50 | _CODE_2; 51 | _CODE_2; 52 | _CODE_2; 53 | _CODE_2; 54 | _CODE_2; 55 | _CODE_2; 56 | _CODE_2; 57 | _CODE_2; 58 | _CODE_2; 59 | _CODE_2; 60 | _CODE_2; 61 | _CODE_2; 62 | _CODE_2; 63 | _CODE_2; 64 | _CODE_2; 65 | _CODE_2; 66 | } 67 | 68 | forward _@_y_cgen_@_1(); 69 | 70 | public _@_y_cgen_@_1() 71 | { 72 | // This function SHOULD come straight after "_@_y_hooks_@_0" in both the 73 | // public functions table and code segment if the compiler is true to form. 74 | } 75 | 76 | static stock CGen_GetAddr(const func[]) 77 | { 78 | new 79 | entry = AMX_HEADER_PUBLICS + funcidx(func) * 8, 80 | ret = AMX_HEADER_COD + AMX_Read(entry); 81 | // Reset the pointer to this function, so calling it fails. 82 | //AMX_Write(entry, 0); 83 | return ret; 84 | } 85 | 86 | static stock CGen_SetupCodeSpace() 87 | { 88 | if (YSI_g_sCodeSpace != -1) return; 89 | // Both these functions can now be safely called - but why would you? 90 | YSI_g_sCodeSpace = CGen_GetAddr("_@_y_cgen_@_0"), 91 | YSI_g_sCodeEnd = CGen_GetAddr("_@_y_cgen_@_1"), 92 | // Rewrite "_@_y_cgen_@_0" to just "return 0;". 93 | AMX_Write(YSI_g_sCodeSpace, _:RelocateOpcode(OP_PROC)), 94 | AMX_Write(YSI_g_sCodeSpace + 4, _:RelocateOpcode(OP_ZERO_PRI)), 95 | AMX_Write(YSI_g_sCodeSpace + 8, _:RelocateOpcode(OP_RETN)), 96 | YSI_g_sCodeSpace += 12; 97 | } 98 | 99 | stock CGen_UseCodeSpace(ctx[AsmContext]) 100 | { 101 | CGen_SetupCodeSpace(); 102 | AsmInitPtr(ctx, YSI_g_sCodeSpace, YSI_g_sCodeEnd - YSI_g_sCodeSpace); 103 | } 104 | 105 | stock CGen_GetCodeSpace() 106 | { 107 | CGen_SetupCodeSpace(); 108 | return YSI_g_sCodeSpace; 109 | } 110 | 111 | stock CGen_AddCodeSpace(num) 112 | { 113 | if (YSI_g_sCodeSpace == -1) P:E("YSI_g_sCodeSpace is -1 in \"CGen_AddCodeSpace\""); 114 | else YSI_g_sCodeSpace += num; 115 | } 116 | 117 | #undef _CODE_2 118 | #undef _CODE_1 119 | 120 | -------------------------------------------------------------------------------- /includes/YSI_Coding/y_hooks.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ============================== 3 | y_hooks - Hook any callback! 4 | ============================== 5 | Description: 6 | Automatically hooks any callbacks with a very simple syntax. 7 | Legal: 8 | Version: MPL 1.1 9 | 10 | The contents of this file are subject to the Mozilla Public License Version 11 | 1.1 (the "License"); you may not use this file except in compliance with 12 | the License. You may obtain a copy of the License at 13 | http://www.mozilla.org/MPL/ 14 | 15 | Software distributed under the License is distributed on an "AS IS" basis, 16 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 17 | for the specific language governing rights and limitations under the 18 | License. 19 | 20 | The Original Code is the SA:MP callback hooks include. 21 | 22 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 23 | Portions created by the Initial Developer are Copyright (C) 2008 24 | the Initial Developer. All Rights Reserved. 25 | 26 | Contributors: 27 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 28 | 29 | Thanks: 30 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 31 | Peter, Cam - Support. 32 | ZeeX, g_aSlice/Slice, Popz, others - Very productive conversations. 33 | koolk - IsPlayerinAreaEx code. 34 | TheAlpha - Danish translation. 35 | breadfish - German translation. 36 | Fireburn - Dutch translation. 37 | yom - French translation. 38 | 50p - Polish translation. 39 | Zamaroht - Spanish translation. 40 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 41 | for me to strive to better. 42 | Pixels^ - Running XScripters where the idea was born. 43 | Matite - Pestering me to release it and using it. 44 | 45 | Very special thanks to: 46 | Thiadmer - PAWN, whose limits continue to amaze me! 47 | Kye/Kalcor - SA:MP. 48 | SA:MP Team past, present and future - SA:MP. 49 | 50 | Version: 51 | 2.0 52 | Changelog: 53 | 25/02/12: 54 | Extracted most of the code to a separate file. 55 | 17/03/11: 56 | Second complete re-write using another new technique. Now VERY fast! 57 | Updated OnPlayerUpdate code using Google63's SCTRL jump code. 58 | 06/08/10: 59 | First version 60 | 61 | \**--------------------------------------------------------------------------**/ 62 | 63 | #include "..\YSI_Internal\y_compilerpass" 64 | #if AUTO_INCLUDE_GUARD 65 | #if !defined _inc_y_hooks 66 | #error Did you do instead of the required ? 67 | #endif 68 | #undef _inc_y_hooks 69 | #endif 70 | 71 | // Multiple includes! 72 | #include "..\YSI_Internal\y_unique" 73 | 74 | #if defined _INC_y_hooks 75 | #endinput 76 | #endif 77 | #define _INC_y_hooks 78 | 79 | #if defined YSI_TESTS 80 | #define _Y_HOOKS_STATIC 81 | #else 82 | #define _Y_HOOKS_STATIC static 83 | #endif 84 | 85 | #include "..\YSI_Internal\y_unique" 86 | #include "..\YSI_Core\y_cell" 87 | #include "..\YSI_Core\y_utils" 88 | #include "..\YSI_Storage\y_amx" 89 | #include "..\YSI_Core\y_als" 90 | 91 | #include "..\YSI_Internal\y_cgen" 92 | 93 | #include "..\amx\asm" 94 | //asm" 95 | 96 | #include "y_hooks/impl" 97 | 98 | #if defined YSI_TESTS 99 | #include "..\YSI_Core\y_testing" 100 | #include "y_hooks/tests" 101 | // Get some new IDs. 102 | //#include "..\YSI_Internal\y_unique" 103 | #endif 104 | 105 | -------------------------------------------------------------------------------- /modules/game/hospital.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : modules/game/hospital.pwn 3 | * 4 | * DESCRIPTION : 5 | * Sends players to hospital when they die. 6 | * 7 | * NOTES : 8 | * - 9 | */ 10 | 11 | #include 12 | 13 | //------------------------------------------------------------------------------ 14 | 15 | // Checks if the player died before spawning 16 | static bool:gPlayerDied[MAX_PLAYERS]; 17 | 18 | // Player current hospital cutscene message 19 | static gplCurrentMessage[MAX_PLAYERS]; 20 | 21 | //------------------------------------------------------------------------------ 22 | 23 | static gHospitalTutorial[][] = 24 | { 25 | "If your health reaches zero, you will pass out and you will be treated at the local medical center.", 26 | "To help put your health back up to normal, you can eat food, use health pick-ups or you can protect yourself by wearing body armor.", 27 | "Before you are discharged, hospital staff will confiscate your weapons and bill you for the healthcare you received." 28 | }; 29 | 30 | //------------------------------------------------------------------------------ 31 | 32 | hook OnPlayerDeath(playerid, killerid, reason) 33 | { 34 | if(GetPlayerCurrentMission(playerid) > MISSION_INTRO) 35 | gPlayerDied[playerid] = true; 36 | GameTextForPlayer(playerid, "Wasted", 5000, 2); 37 | return 1; 38 | } 39 | 40 | //------------------------------------------------------------------------------ 41 | 42 | hook OnPlayerDisconnect(playerid, reason) 43 | { 44 | gPlayerDied[playerid] = false; 45 | return 1; 46 | } 47 | 48 | //------------------------------------------------------------------------------ 49 | 50 | hook OnPlayerSpawn(playerid) 51 | { 52 | if(gPlayerDied[playerid]) 53 | { 54 | SetPlayerFacingAngle(playerid, 133.5321); 55 | SetPlayerPos(playerid, 2028.3698, -1420.2480, 16.9922); 56 | if(!GetPlayerFirstTime(playerid, FIRST_TIME_HOSPITAL)) 57 | { 58 | gplCurrentMessage[playerid] = 0; 59 | SelectTextDraw(playerid, 0x00000000); // Hide player HUD 60 | HidePlayerClock(playerid); 61 | ShowPlayerCutsceneBars(playerid); 62 | TogglePlayerControllable(playerid, false); 63 | SetPlayerCameraPos(playerid, 2025.1041, -1429.3228, 22.5467); 64 | SetPlayerCameraLookAt(playerid, 2025.3395, -1428.3467, 21.8717); 65 | ProcessHospitalCutscene(playerid); 66 | } 67 | else 68 | SetCameraBehindPlayer(playerid); 69 | } 70 | return 1; 71 | } 72 | 73 | //------------------------------------------------------------------------------ 74 | 75 | timer ProcessHospitalCutscene[6500](playerid) 76 | { 77 | new i = gplCurrentMessage[playerid]; 78 | if(i < sizeof(gHospitalTutorial)) 79 | { 80 | ClearPlayerScreen(playerid); 81 | gplCurrentMessage[playerid]++; 82 | PlaySelectSound(playerid); 83 | ShowPlayerInfoMessage(playerid, gHospitalTutorial[i]); 84 | defer ProcessHospitalCutscene(playerid); 85 | } 86 | else if(i == sizeof(gHospitalTutorial)) 87 | { 88 | ShowPlayerClock(playerid); 89 | CancelSelectTextDraw(playerid); // Show player HUD 90 | HidePlayerCutsceneBars(playerid); 91 | HidePlayerInfoMessage(playerid); 92 | SetCameraBehindPlayer(playerid); 93 | TogglePlayerControllable(playerid, true); 94 | SetPlayerFirstTime(playerid, FIRST_TIME_HOSPITAL, true); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /includes/amx/phys_memory.inc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2011-2012 Zeex 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | // DEALINGS IN THE SOFTWARE. 20 | 21 | #if defined PHYS_MEMORY_INC 22 | #endinput 23 | #endif 24 | #define PHYS_MEMORY_INC 25 | 26 | #include 27 | 28 | #include "amx_base" 29 | 30 | static stock GetDat() { 31 | #emit lctrl 1 32 | #emit retn 33 | return 0; // make compiler happy 34 | } 35 | 36 | static stock AbsToRel(address) { 37 | return address - (GetAmxBaseAddress() + GetDat()); 38 | } 39 | 40 | static stock RelToAbs(address) { 41 | return address + (GetAmxBaseAddress() + GetDat()); 42 | } 43 | 44 | // Returns the absolute address of a variable/array. 45 | stock refabs(...) { 46 | assert(numargs() == 1); 47 | new address; 48 | #emit load.s.pri 12 49 | #emit stor.s.pri address 50 | return RelToAbs(address); 51 | } 52 | 53 | stock ReadPhysMemory(address, dest[], num = sizeof(dest)) { 54 | new rel_addr = AbsToRel(address); 55 | 56 | // Current destination cell address. 57 | new cur_dest; 58 | #emit load.s.pri dest 59 | #emit stor.s.pri cur_dest 60 | 61 | // Currently reading address. 62 | new cur_addr = rel_addr; 63 | 64 | // Read num cells to dest. 65 | for (new i = 0; i < num; i++, cur_addr += 4, cur_dest += 4) { 66 | #emit lref.s.pri cur_addr 67 | #emit sref.s.pri cur_dest 68 | } 69 | 70 | #emit stack 12 71 | #emit retn 72 | 73 | return 0; // make compiler happy 74 | } 75 | 76 | stock WritePhysMemory(address, src[], num = sizeof(src)) { 77 | new rel_addr = AbsToRel(address); 78 | 79 | // Current destination cell address.. 80 | new cur_src; 81 | #emit load.s.pri src 82 | #emit stor.s.pri cur_src 83 | 84 | // Currently reading address. 85 | new cur_addr = rel_addr; 86 | 87 | // Write num cells from src. 88 | for (new i = 0; i < num; i++, cur_addr += 4, cur_src += 4) { 89 | #emit lref.s.pri cur_src 90 | #emit sref.s.pri cur_addr 91 | } 92 | 93 | #emit stack 12 94 | #emit retn 95 | 96 | return 0; // make compiler happy 97 | } 98 | 99 | stock ReadPhysMemoryCell(address) { 100 | new rel_addr = AbsToRel(address); 101 | #emit lref.s.pri rel_addr 102 | #emit stack 4 103 | #emit retn 104 | return 0; // make compiler happy 105 | } 106 | 107 | stock WritePhysMemoryCell(address, what) { 108 | new rel_addr = AbsToRel(address); 109 | #emit load.s.pri what 110 | #emit sref.s.pri rel_addr 111 | #emit stack 4 112 | #emit retn 113 | return 0; // make compiler happy 114 | } 115 | -------------------------------------------------------------------------------- /includes/YSI_Core/y_functional/tests.inc: -------------------------------------------------------------------------------- 1 | #define FUNC_CHECK_ARR(%0,%1) for (new __i, __j = min(sizeof (%0), sizeof (%1)); __i != __j; ++__i) ASSERT(%0[__i] == %1[__i]) 2 | 3 | Test:FUNC_Map1() 4 | { 5 | new 6 | a0[10] = {0, 1, 2, ...}, 7 | a1[10] = {0, 2, 4, ...}; 8 | inline const Double(x) 9 | { 10 | @return x * 2; 11 | } 12 | Map(using inline Double, a0, a0); 13 | FUNC_CHECK_ARR(a0, a1); 14 | } 15 | 16 | Test:FUNC_Map2() 17 | { 18 | new 19 | a0[10] = {0, 1, 2, ...}, 20 | a1[10] = {0, 2, 4, ...}, 21 | a2[10] = {0, 1, 2, ...}, 22 | a3[10]; 23 | inline const Double(x) 24 | { 25 | @return x * 2; 26 | } 27 | Map(using inline Double, a0, a3); 28 | FUNC_CHECK_ARR(a0, a2); 29 | FUNC_CHECK_ARR(a3, a1); 30 | } 31 | 32 | Test:FUNC_Map3() 33 | { 34 | new 35 | a0[10] = {0, 1, 2, ...}, 36 | a1[10] = {1, 4, 7, ...}, 37 | a2[10] = {0, 1, 2, ...}, 38 | a3[10]; 39 | Map({_0 * 3 + 1}, a0, a3); 40 | FUNC_CHECK_ARR(a0, a2); 41 | FUNC_CHECK_ARR(a3, a1); 42 | } 43 | 44 | Test:FUNC_Map_1() 45 | { 46 | new 47 | a0[10] = {0, 1, 2, ...}, 48 | a1[10] = {0, 1, 2, ...}; 49 | inline const Triple(x) 50 | { 51 | @return x * 3; 52 | } 53 | Map_(using inline Triple, a0); 54 | FUNC_CHECK_ARR(a0, a1); 55 | } 56 | 57 | Test:FUNC_Map_2() 58 | { 59 | new 60 | a0[10] = {0, 1, 2, ...}, 61 | a1[10] = {0, 1, 2, ...}; 62 | Map_({_0 * 4}, a0); 63 | FUNC_CHECK_ARR(a0, a1); 64 | } 65 | 66 | Test:FUNC_MapIdx() 67 | { 68 | new 69 | a0[10] = {1, ...}, 70 | a1[10] = {2, 4, 6, ...}; 71 | inline const AddAndMul(idx, x) 72 | { 73 | @return (x + idx) * 2; 74 | } 75 | MapIdx(using inline AddAndMul, a0, a0); 76 | FUNC_CHECK_ARR(a0, a1); 77 | } 78 | 79 | Test:FUNC_MapIdx_() 80 | { 81 | new 82 | a0[10] = {0, 1, 2, ...}, 83 | a1[10] = {0, 1, 2, ...}; 84 | inline const Thing(idx, x) 85 | { 86 | #pragma unused idx, x 87 | @return 42; 88 | } 89 | MapIdx_(using inline Thing, a0); 90 | FUNC_CHECK_ARR(a0, a1); 91 | } 92 | 93 | Test:FUNC_ZipWith() 94 | { 95 | new 96 | a0[10] = { 0, 1, 2, ...}, 97 | a1[10] = {10, 20, 30, ...}, 98 | a2[10], 99 | a3[10] = { 0, 20, 60, 120, 200, 300, 420, 560, 720, 900}; 100 | inline const Mul(a, b) @return a * b; 101 | ZipWith(using inline Mul, a0, a1, a2); 102 | FUNC_CHECK_ARR(a2, a3); 103 | } 104 | 105 | Test:FUNC_ZipWith3() 106 | { 107 | new 108 | a0[10] = { 0, 1, 2, ...}, 109 | a1[10] = {10, 20, 30, ...}, 110 | a9[10] = {22, ...}, 111 | a2[10], 112 | a3[10] = {22, 42, 82, 142, 222, 322, 442, 582, 742, 922}; 113 | inline const MulAdd(a, b, c) @return a * b + c; 114 | ZipWith3(using inline MulAdd, a0, a1, a9, a2); 115 | FUNC_CHECK_ARR(a2, a3); 116 | } 117 | 118 | Test:FUNC_FoldR1() 119 | { 120 | new 121 | a0[10] = { 0, 1, 2, ...}, 122 | ret; 123 | ret = FoldR({_0 * _1}, a0, 10); 124 | ASSERT(ret == 0); 125 | } 126 | 127 | Test:FUNC_FoldR2() 128 | { 129 | new 130 | a0[10] = { 1, 2, 3, ...}, 131 | ret; 132 | ret = FoldR({_0 * _1}, a0, 10); 133 | ASSERT(ret == 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 10); 134 | } 135 | 136 | Test:FUNC_FoldL1() 137 | { 138 | new 139 | a0[10] = { 1, 2, 3, ...}, 140 | ret; 141 | ret = FoldL({_0 * _1}, 11, a0); 142 | ASSERT(ret == 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11); 143 | } 144 | 145 | Test:FUNC_FoldR3() 146 | { 147 | new 148 | a0[10] = { 1, 2, 3, ...}, 149 | ret; 150 | ret = FoldR({_0 * _1}, a0, 15, 0); 151 | ASSERT(ret == 15); 152 | } 153 | 154 | Test:FUNC_FoldL2() 155 | { 156 | new 157 | a0[10] = { 1, 2, 3, ...}, 158 | ret; 159 | ret = FoldL({_0 * _1}, 99, a0, 0); 160 | ASSERT(ret == 99); 161 | } 162 | 163 | #undef FUNC_CHECK_ARR 164 | 165 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_compilerpass.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ================================ 3 | Y Sever Includes - Compiler Pass 4 | ================================ 5 | Description: 6 | Detect which pass the compiler is on. Used by y_groups to include code that 7 | might be needed before it is known if it is needed (it can be dumped later). 8 | Legal: 9 | Version: MPL 1.1 10 | 11 | The contents of this file are subject to the Mozilla Public License Version 12 | 1.1 (the "License"); you may not use this file except in compliance with 13 | the License. You may obtain a copy of the License at 14 | http://www.mozilla.org/MPL/ 15 | 16 | Software distributed under the License is distributed on an "AS IS" basis, 17 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 18 | for the specific language governing rights and limitations under the 19 | License. 20 | 21 | The Original Code is the YSI master include. 22 | 23 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 24 | Portions created by the Initial Developer are Copyright (C) 2011 25 | the Initial Developer. All Rights Reserved. 26 | 27 | Contributors: 28 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 29 | 30 | Thanks: 31 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 32 | ZeeX - Very productive conversations. 33 | koolk - IsPlayerinAreaEx code. 34 | TheAlpha - Danish translation. 35 | breadfish - German translation. 36 | Fireburn - Dutch translation. 37 | yom - French translation. 38 | 50p - Polish translation. 39 | Zamaroht - Spanish translation. 40 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 41 | for me to strive to better. 42 | Pixels^ - Running XScripters where the idea was born. 43 | Matite - Pestering me to release it and using it. 44 | 45 | Very special thanks to: 46 | Thiadmer - PAWN, whose limits continue to amaze me! 47 | Kye/Kalcor - SA:MP. 48 | SA:MP Team past, present and future - SA:MP. 49 | 50 | Version: 51 | 0.1 52 | Changelog: 53 | 14/04/13: 54 | First version. 55 | Functions: 56 | Public: 57 | - 58 | Core: 59 | - 60 | Stock: 61 | - 62 | Static: 63 | - 64 | Inline: 65 | - 66 | API: 67 | - 68 | Hooks: 69 | - 70 | Callbacks: 71 | - 72 | Definitions: 73 | - 74 | Enums: 75 | - 76 | Macros: 77 | - 78 | Tags: 79 | - 80 | Variables: 81 | Global: 82 | -. 83 | Static: 84 | - 85 | Commands: 86 | - 87 | Compile options: 88 | - 89 | Operators: 90 | - 91 | Natives: 92 | - 93 | \**--------------------------------------------------------------------------**/ 94 | 95 | #if defined _INC_y_compilerpass 96 | #endinput 97 | #endif 98 | #define _INC_y_compilerpass 99 | 100 | #if defined __COMPILER_SECOND_PASS 101 | #define __COMPILER_PASS (1) 102 | #else 103 | #define __COMPILER_PASS (0) 104 | #endif 105 | #define COMPILER_1ST_PASS (__COMPILER_PASS == (0)) 106 | #define COMPILER_2ND_PASS (__COMPILER_PASS == (1)) 107 | #define COMPILER_FIRST_PASS COMPILER_1ST_PASS 108 | #define COMPILER_SECOND_PASS COMPILER_2ND_PASS 109 | static stock __COMPILER_SECOND_PASS() {} 110 | 111 | #if __Pawn >= 0x0400 112 | #error YSI does not yet support PAWN 4.0 113 | #elseif __Pawn < 0x0300 114 | #error YSI does not yet support PAWN 2.0/1.0 115 | #endif 116 | 117 | #if !defined __compat 118 | #define __compat 1 119 | #endif 120 | 121 | #if __Pawn == 0x030A && !__compat 122 | #define AUTO_INCLUDE_GUARD 0 123 | #else 124 | #define AUTO_INCLUDE_GUARD 1 125 | #endif 126 | 127 | #if __Pawn == 0x030A 128 | #define NESTED_ELLIPSIS 129 | #endif -------------------------------------------------------------------------------- /gamemodes/main.pwn: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * FILENAME : main.pwn 3 | * 4 | * DESCRIPTION : 5 | * Includes all modules, includes and constants. 6 | * 7 | * NOTES : 8 | * This file is not intended to handle player's processes. 9 | * 10 | * CONTRIBUTORS : 11 | * Larceny 12 | * 13 | * THANKS : 14 | * SA:MP Team past, present and future - SA:MP. 15 | * Y_Less - YSI. 16 | * BlueG - MySQL Plugin. 17 | * Toribio/Southclaw - Progress bar inc. 18 | * Incognito - Streamer plugin 19 | */ 20 | 21 | // Required to be at the top 22 | #include 23 | 24 | //------------------------------------------------------------------------------ 25 | 26 | // Script version 27 | #define SCRIPT_VERSION_MAJOR 0 28 | #define SCRIPT_VERSION_MINOR 1 29 | #define SCRIPT_VERSION_PATCH 0 30 | #define SCRIPT_VERSION_NAME "GTA:Missions" 31 | 32 | // Database 33 | #define MySQL_HOST "localhost" 34 | #define MySQL_USER "root" 35 | #define MySQL_DB "gtamissions" 36 | #define MySQL_PASS "" 37 | new gMySQL; 38 | 39 | //------------------------------------------------------------------------------ 40 | 41 | // Libraries 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | //------------------------------------------------------------------------------ 51 | 52 | hook OnGameModeInit() 53 | { 54 | print("\n\n============================================================\n"); 55 | print("Initializing...\n"); 56 | SetGameModeText(SCRIPT_VERSION_NAME " " #SCRIPT_VERSION_MAJOR "." #SCRIPT_VERSION_MINOR "." #SCRIPT_VERSION_PATCH); 57 | 58 | // MySQL connection 59 | mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG); 60 | gMySQL = mysql_connect(MySQL_HOST, MySQL_USER, MySQL_DB, MySQL_PASS); 61 | if(mysql_errno(gMySQL) != 0) 62 | { 63 | print("ERROR: Could not connect to database!"); 64 | return -1; // Stop the initialization if can't connect to database. 65 | } 66 | else 67 | printf("[mysql] connected to database %s at %s successfully!", MySQL_DB, MySQL_HOST); 68 | 69 | // Gamemode settings 70 | ShowNameTags(1); 71 | UsePlayerPedAnims(); 72 | DisableInteriorEnterExits(); // For server-sided entrances 73 | SetNameTagDrawDistance(40.0); 74 | EnableStuntBonusForAll(false); 75 | return 1; 76 | } 77 | 78 | //------------------------------------------------------------------------------ 79 | 80 | // Modules 81 | 82 | /* Defs */ 83 | #include "../modules/def/ftime.pwn" 84 | #include "../modules/def/dialog.pwn" 85 | #include "../modules/def/mapicons.pwn" 86 | #include "../modules/def/missions.pwn" 87 | 88 | /* Data */ 89 | #include "../modules/data/accounts.pwn" 90 | 91 | /* Game */ 92 | #include "../modules/game/clock.pwn" 93 | #include "../modules/game/hospital.pwn" 94 | 95 | /* Player */ 96 | #include "../modules/player/animpreload.pwn" 97 | 98 | /* Missions */ 99 | #include "../modules/missions/intro.pwn" 100 | #include "../modules/missions/sweetcall.pwn" 101 | #include "../modules/missions/homeinvasion.pwn" 102 | 103 | /* Visual */ 104 | #include "../modules/visual/subtitles.pwn" 105 | #include "../modules/visual/cutscene.pwn" 106 | #include "../modules/visual/info.pwn" 107 | 108 | //------------------------------------------------------------------------------ 109 | 110 | main() 111 | { 112 | printf("\n\n%s %d.%d.%d initialiazed.\n", SCRIPT_VERSION_NAME, SCRIPT_VERSION_MAJOR, SCRIPT_VERSION_MINOR, SCRIPT_VERSION_PATCH); 113 | print("============================================================\n"); 114 | } 115 | -------------------------------------------------------------------------------- /includes/YSI_Coding/y_inline.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | =================================== 3 | y_inline - PAWN inline functions. 4 | =================================== 5 | Description: 6 | This library allows a user to write inline functions in their script. It 7 | first detects all inline functions and generates data on them, such as 8 | parameter counts and addresses. When an inline function is passed in code 9 | its current context data is stored. Finally, when an inline function is 10 | found to be called at some point its current local stack is stored in global 11 | memory. When the function actually is called, the stack is restored, and 12 | additional parameters which are the inline function parameters, are passed. 13 | Legal: 14 | Version: MPL 1.1 15 | 16 | The contents of this file are subject to the Mozilla Public License Version 17 | 1.1 (the "License"); you may not use this file except in compliance with 18 | the License. You may obtain a copy of the License at 19 | http://www.mozilla.org/MPL/ 20 | 21 | Software distributed under the License is distributed on an "AS IS" basis, 22 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 23 | for the specific language governing rights and limitations under the 24 | License. 25 | 26 | The Original Code is the YSI Inline Function include. 27 | 28 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 29 | Portions created by the Initial Developer are Copyright (C) 2011 30 | the Initial Developer. All Rights Reserved. 31 | 32 | Contributors: 33 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 34 | 35 | Thanks: 36 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 37 | ZeeX - Very productive conversations. 38 | koolk - IsPlayerinAreaEx code. 39 | TheAlpha - Danish translation. 40 | breadfish - German translation. 41 | Fireburn - Dutch translation. 42 | yom - French translation. 43 | 50p - Polish translation. 44 | Zamaroht - Spanish translation. 45 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 46 | for me to strive to better. 47 | Pixels^ - Running XScripters where the idea was born. 48 | Matite - Pestering me to release it and using it. 49 | 50 | Very special thanks to: 51 | Thiadmer - PAWN, whose limits continue to amaze me! 52 | Kye/Kalcor - SA:MP. 53 | SA:MP Team past, present and future - SA:MP. 54 | 55 | Version: 56 | 1.0 57 | Changelog: 58 | 22/06/13: 59 | Rewrote the library from scratch for better performance all round. 60 | 20/10/12: 61 | Fixed a bug with "Callback_Release" with public functions. 62 | 15/11/11: 63 | Changed the precedence of "using" types. 64 | 19/09/11: 65 | First version 66 | \**--------------------------------------------------------------------------**/ 67 | 68 | #if defined _INC_y_inline 69 | #endinput 70 | #endif 71 | #define _INC_y_inline 72 | 73 | #if !defined YSI_MAX_INLINE_STRING 74 | #define YSI_MAX_INLINE_STRING YSI_MAX_STRING 75 | #endif 76 | 77 | 78 | #include "..\amx\asm" 79 | #include "..\amx\disasm" 80 | #include "..\amx\frame_info" 81 | #include "..\YSI_Storage\y_amx" 82 | #include "..\YSI_Internal\y_shortfunc" 83 | #include "..\YSI_Core\y_debug" 84 | #include "..\YSI_Core\y_utils" 85 | #include "..\YSI_Data\y_bit" 86 | #include "y_malloc" 87 | 88 | 89 | #include "y_inline/macros" 90 | #include "..\YSI_Internal\y_cgen" 91 | 92 | #include "y_inline/impl" 93 | 94 | #if defined YSI_TESTS 95 | #include "..\amx\amx_memory.inc" 96 | 97 | #include "..\YSI_Core\y_testing" 98 | #include "y_hooks" 99 | #include "y_inline/tests" 100 | #endif 101 | 102 | -------------------------------------------------------------------------------- /includes/YSI_Coding/y_timers.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ==================================== 3 | y_timers - Run timers efficiently. 4 | ==================================== 5 | Description: 6 | Sets up repeating timers without requiring any SetTimers and arranges them 7 | so that they will be very unlikely to meet (at least for a long time) using 8 | scheduling algorithms to get timers with the same period to be offset. Also 9 | fixes arrays and strings in timers so they can be passed properly. 10 | Legal: 11 | Version: MPL 1.1 12 | 13 | The contents of this file are subject to the Mozilla Public License Version 14 | 1.1 (the "License"); you may not use this file except in compliance with 15 | the License. You may obtain a copy of the License at 16 | http://www.mozilla.org/MPL/ 17 | 18 | Software distributed under the License is distributed on an "AS IS" basis, 19 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 20 | for the specific language governing rights and limitations under the 21 | License. 22 | 23 | The Original Code is the YSI timers include. 24 | 25 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 26 | Portions created by the Initial Developer are Copyright (C) 2011 27 | the Initial Developer. All Rights Reserved. 28 | 29 | Contributors: 30 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 31 | 32 | Thanks: 33 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 34 | ZeeX - Very productive conversations. 35 | koolk - IsPlayerinAreaEx code. 36 | TheAlpha - Danish translation. 37 | breadfish - German translation. 38 | Fireburn - Dutch translation. 39 | yom - French translation. 40 | 50p - Polish translation. 41 | Zamaroht - Spanish translation. 42 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 43 | for me to strive to better. 44 | Pixels^ - Running XScripters where the idea was born. 45 | Matite - Pestering me to release it and using it. 46 | 47 | Very special thanks to: 48 | Thiadmer - PAWN, whose limits continue to amaze me! 49 | Kye/Kalcor - SA:MP. 50 | SA:MP Team past, present and future - SA:MP. 51 | 52 | Version: 53 | 2.0 54 | Changelog: 55 | 29/04/11: 56 | Added version 2 of the code with more advanced options. 57 | 21/03/11: 58 | Added debug printing to timer functions. Uses "P:C" in compiling. 59 | 26/10/10: 60 | Officially added simple calling. 61 | Added "delay" functions. 62 | 12/10/10: 63 | Rewrote for YSI 1.0 using y_scripting. 64 | 11/08/07: 65 | Removed millions of defines to reduce pre-processing. 66 | Added pickups. 67 | 03/08/07: 68 | First version. 69 | 70 | \**--------------------------------------------------------------------------**/ 71 | 72 | #if defined _INC_y_timers 73 | #endinput 74 | #endif 75 | #define _INC_y_timers 76 | 77 | // y_uvars 78 | 79 | #if defined USE_Y_TIMERS_V1 80 | #error y_timers version 1 has not worked in years! 81 | #include "y_timers/v1" 82 | #endinput 83 | #endif 84 | 85 | #include "..\YSI_Internal\y_plugins" 86 | 87 | #include "..\YSI_Internal\y_version" 88 | 89 | #include "..\YSI_Storage\y_amx" 90 | #include "..\YSI_Internal\y_shortfunc" 91 | #include "..\YSI_Coding\y_malloc" 92 | #include "..\YSI_Data\y_iterate" 93 | #include "..\YSI_Coding\y_hooks" 94 | #include "..\YSI_Core\y_debug" 95 | 96 | #include "y_timers/impl" 97 | #if defined _YSI_PLUGINS_FIXES_2 98 | //#error V3 99 | #include "y_timers/v3" 100 | #else 101 | #include "y_timers/v2" 102 | #endif 103 | 104 | #if defined YSI_TESTS 105 | #include "..\YSI_Core\y_testing" 106 | #include "y_timers/tests" 107 | #endif 108 | -------------------------------------------------------------------------------- /includes/YSI_Players/y_users/tests.inc: -------------------------------------------------------------------------------- 1 | Test:Player_Existing() 2 | { 3 | new 4 | ret[E_USER_PRELOAD]; 5 | Player_Preload("TestPlayer", ret); 6 | ASSERT(0 == ret[E_USER_PRELOAD_YID]); 7 | ASSERT(Langs_GetLanguage("EN") == ret[E_USER_PRELOAD_LANG]); 8 | ASSERT(0x12345678 == ret[E_USER_PRELOAD_BITS]); 9 | ASSERT(0xAABBCCDD >= ret[E_USER_PRELOAD_DATE]); 10 | P:I("Note that if these tests fail, you will need to"); 11 | P:I(" first connect to the server as \"TestPlayer\"."); 12 | } 13 | 14 | new 15 | gBot = INVALID_PLAYER_ID; 16 | 17 | Test:Player_ChangeLanguage() 18 | { 19 | // Connect the bot here so that it is done way before the PTest is run. 20 | ConnectNPC("TestPlayer", "npcidle"); 21 | } 22 | 23 | public OnPlayerConnect(playerid) 24 | { 25 | new 26 | name[MAX_PLAYER_NAME]; 27 | GetPlayerName(playerid, name, sizeof (name)); 28 | if (!strcmp(name, "TestPlayer")) gBot = playerid; 29 | #if defined Testing_OnPlayerConnect 30 | return Testing_OnPlayerConnect(playerid); 31 | #else 32 | return 1; 33 | #endif 34 | } 35 | 36 | #if defined _ALS_OnPlayerConnect 37 | #undef OnPlayerConnect 38 | #else 39 | #define _ALS_OnPlayerConnect 40 | #endif 41 | #define OnPlayerConnect Testing_OnPlayerConnect 42 | #if defined Testing_OnPlayerConnect 43 | forward Testing_OnPlayerConnect(playerid); 44 | #endif 45 | 46 | PTestInit:Player_ChangeLanguage(playerid) 47 | { 48 | // So that their language can be changed. 49 | Player_ForceLogin(gBot); 50 | } 51 | 52 | PTest:Player_ChangeLanguage(playerid) 53 | { 54 | new 55 | ret[E_USER_PRELOAD]; 56 | // Check their language is English, then change it to Dutch. 57 | Player_Preload("TestPlayer", ret); 58 | ASSERT(Langs_GetLanguage("EN") == ret[E_USER_PRELOAD_LANG]); 59 | Player_ChangeLanguage(gBot, "NL"); 60 | Player_Preload("TestPlayer", ret); 61 | ASSERT(Langs_GetLanguage("NL") == ret[E_USER_PRELOAD_LANG]); 62 | } 63 | 64 | PTestClose:Player_ChangeLanguage(playerid) 65 | { 66 | // Reset the player. 67 | Player_ChangeLanguage(gBot, "EN"); 68 | //Kick(gBot); 69 | } 70 | 71 | PTestInit:Player_ChangePassword(playerid) 72 | { 73 | // So that their password can be changed. 74 | Player_ForceLogin(gBot); 75 | } 76 | 77 | PTest:Player_ChangePassword(playerid) 78 | { 79 | new 80 | ret[E_USER_PRELOAD]; 81 | // Change their password. 82 | Player_Preload("TestPlayer", ret); 83 | ASSERT(!strcmp(ret[E_USER_PRELOAD_PASS], "24954A7C4E607137A70D701986CC3C3140C143E5B5886362A8ACB647B81592CF1F092C65178F6E3FFFC6691B044D2290215058E09BBE029D23D1D67F41640090")); 84 | Player_ChangePassword(gBot, "thisisabadpass"); 85 | Player_Preload("TestPlayer", ret); 86 | ASSERT(!strcmp(ret[E_USER_PRELOAD_PASS], "B506FEEEDFB83EF44A5DC2E00BF1535E58E3B37A044730F2A6718497A224B5455A441F39F9EB91967B38607416A9B85E5DE3CBE3A48E7A77AB5808674EF33822")); 87 | } 88 | 89 | PTestClose:Player_ChangePassword(playerid) 90 | { 91 | // Reset the player. 92 | Player_ChangePassword(gBot, "thisisanOKpass"); 93 | //Kick(gBot); 94 | } 95 | 96 | PTestInit:Player_Preload(playerid) 97 | { 98 | Player_ForceLogin(gBot); 99 | } 100 | 101 | PTest:Player_Preload(playerid) 102 | { 103 | new 104 | //name[MAX_PLAYER_NAME], 105 | ret[E_USER_PRELOAD]; 106 | //GetPlayerName(playerid, name, sizeof (name)); 107 | Player_Preload("TestPlayer", ret); 108 | ASSERT(Player_GetYID(gBot) == ret[E_USER_PRELOAD_YID]); 109 | ASSERT(Langs_GetPlayerLanguage(gBot) == ret[E_USER_PRELOAD_LANG]); 110 | ASSERT(0x12345678 == ret[E_USER_PRELOAD_BITS]); 111 | ASSERT(gettime() >= ret[E_USER_PRELOAD_DATE]); 112 | } 113 | 114 | PTestInit:Player_GetID(playerid) 115 | { 116 | // So that their password can be changed. 117 | Player_ForceLogin(gBot); 118 | } 119 | 120 | PTest:Player_GetID(playerid) 121 | { 122 | ASSERT(Player_GetYID(gBot) == 0); 123 | ASSERT(Player_GetYID(playerid) < 0); 124 | } 125 | -------------------------------------------------------------------------------- /includes/YSI_Internal/y_stripnumbers.inc: -------------------------------------------------------------------------------- 1 | /**--------------------------------------------------------------------------**\ 2 | ===================== 3 | YSI - Strip Numbers 4 | ===================== 5 | Description: 6 | Removes tag overrides which are actually numbers. This allows for: 7 | 8 | uvar g_a[MAX_PLAYERS][E_SOME_ENUM]; 9 | uvar g_b[MAX_PLAYERS][42]; 10 | 11 | Without stripping you would end with code doing "42:0" or getting a tag 12 | mismatch on "E_SOME_ENUM", both of which are problems. 13 | Legal: 14 | Version: MPL 1.1 15 | 16 | The contents of this file are subject to the Mozilla Public License Version 17 | 1.1 (the "License"); you may not use this file except in compliance with 18 | the License. You may obtain a copy of the License at 19 | http://www.mozilla.org/MPL/ 20 | 21 | Software distributed under the License is distributed on an "AS IS" basis, 22 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 23 | for the specific language governing rights and limitations under the 24 | License. 25 | 26 | The Original Code is the YSI master systems include. 27 | 28 | The Initial Developer of the Original Code is Alex "Y_Less" Cole. 29 | Portions created by the Initial Developer are Copyright (C) 2011 30 | the Initial Developer. All Rights Reserved. 31 | 32 | Contributors: 33 | ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice 34 | 35 | Thanks: 36 | JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL. 37 | ZeeX - Very productive conversations. 38 | koolk - IsPlayerinAreaEx code. 39 | TheAlpha - Danish translation. 40 | breadfish - German translation. 41 | Fireburn - Dutch translation. 42 | yom - French translation. 43 | 50p - Polish translation. 44 | Zamaroht - Spanish translation. 45 | Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes 46 | for me to strive to better. 47 | Pixels^ - Running XScripters where the idea was born. 48 | Matite - Pestering me to release it and using it. 49 | 50 | Very special thanks to: 51 | Thiadmer - PAWN, whose limits continue to amaze me! 52 | Kye/Kalcor - SA:MP. 53 | SA:MP Team past, present and future - SA:MP. 54 | 55 | Version: 56 | 1.0 57 | Changelog: 58 | - 59 | Functions: 60 | Public: 61 | - 62 | Core: 63 | - 64 | Stock: 65 | - 66 | Static: 67 | - 68 | Inline: 69 | - 70 | API: 71 | - 72 | Hooks: 73 | - 74 | Callbacks: 75 | - 76 | Definitions: 77 | - 78 | Enums: 79 | - 80 | Macros: 81 | - 82 | Tags: 83 | - 84 | Variables: 85 | Global: 86 | - 87 | Static: 88 | - 89 | Commands: 90 | - 91 | Compile options: 92 | - 93 | Operators: 94 | - 95 | Natives: 96 | - 97 | 98 | \**--------------------------------------------------------------------------**/ 99 | 100 | #if defined _INC_y_stripnumbers 101 | #endinput 102 | #endif 103 | #define _INC_y_stripnumbers 104 | 105 | // This code uses the "@S.:" prefix, where "." is a number or underscore (for 106 | // any other symbol. y_stringise (aka. y_stringize) uses several letters from 107 | // this same set. 108 | #define STRIP_NUMBERS:%0|||%1:%2||| _:@S0:@S1:@S2:@S3:@S4:@S5:@S6:@S7:@S8:@S9:@S_:%0|||%1:%2||| 109 | 110 | #define @S0:@S1:@S2:@S3:@S4:@S5:@S6:@S7:@S8:@S9:@S_:%0|||0%1:%2||| %0[%2] 111 | #define @S1:@S2:@S3:@S4:@S5:@S6:@S7:@S8:@S9:@S_:%0|||1%1:%2||| %0[%2] 112 | #define @S2:@S3:@S4:@S5:@S6:@S7:@S8:@S9:@S_:%0|||2%1:%2||| %0[%2] 113 | #define @S3:@S4:@S5:@S6:@S7:@S8:@S9:@S_:%0|||3%1:%2||| %0[%2] 114 | #define @S4:@S5:@S6:@S7:@S8:@S9:@S_:%0|||4%1:%2||| %0[%2] 115 | #define @S5:@S6:@S7:@S8:@S9:@S_:%0|||5%1:%2||| %0[%2] 116 | #define @S6:@S7:@S8:@S9:@S_:%0|||6%1:%2||| %0[%2] 117 | #define @S7:@S8:@S9:@S_:%0|||7%1:%2||| %0[%2] 118 | #define @S8:@S9:@S_:%0|||8%1:%2||| %0[%2] 119 | #define @S9:@S_:%0|||9%1:%2||| %0[%2] 120 | #define @S_:%0|||%1:%2||| %0[%1:%2] 121 | --------------------------------------------------------------------------------