<html>
<head>
<script type="text/javascript">
<!--
function slcChange()
{
switch (parseInt(document.getElementById("slc").options[document.getElementById("slc").selectedIndex].value))
{
case 1:
document.getElementById("fnc").value += "OnGameModeInit,";
document.getElementById("prm").value += ";";
break;
case 2:
document.getElementById("fnc").value += "OnGameModeExit,";
document.getElementById("prm").value += ";";
break;
case 3:
document.getElementById("fnc").value += "OnFilterScriptInit,";
document.getElementById("prm").value += ";";
break;
case 4:
document.getElementById("fnc").value += "OnFilterScriptExit,";
document.getElementById("prm").value += ";";
break;
case 5:
document.getElementById("fnc").value += "OnPlayerConnect,";
document.getElementById("prm").value += "playerid;";
break;
case 6:
document.getElementById("fnc").value += "OnPlayerDisconnect,";
document.getElementById("prm").value += "playerid, reason;";
break;
case 7:
document.getElementById("fnc").value += "OnPlayerSpawn,";
document.getElementById("prm").value += "playerid;";
break;
case 8:
document.getElementById("fnc").value += "OnPlayerDeath,";
document.getElementById("prm").value += "playerid, killerid, reason;";
break;
case 9:
document.getElementById("fnc").value += "OnVehicleSpawn,";
document.getElementById("prm").value += "vehicleid;";
break;
case 10:
document.getElementById("fnc").value += "OnVehicleDeath,";
document.getElementById("prm").value += "vehicleid, killerid;";
break;
case 11:
document.getElementById("fnc").value += "OnPlayerText,";
document.getElementById("prm").value += "playerid, text[];";
break;
case 12:
document.getElementById("fnc").value += "OnPlayerCommandText,";
document.getElementById("prm").value += "playerid, cmdtext[];";
break;
case 13:
document.getElementById("fnc").value += "OnPlayerRequestClass,";
document.getElementById("prm").value += "playerid, classid;";
break;
case 14:
document.getElementById("fnc").value += "OnPlayerEnterVehicle,";
document.getElementById("prm").value += "playerid, vehicleid, ispassenger;";
break;
case 15:
document.getElementById("fnc").value += "OnPlayerExitVehicle,";
document.getElementById("prm").value += "playerid, vehicleid;";
break;
case 16:
document.getElementById("fnc").value += "OnPlayerStateChange,";
document.getElementById("prm").value += "playerid, newstate, oldstate;";
break;
case 17:
document.getElementById("fnc").value += "OnPlayerEnterCheckpoint,";
document.getElementById("prm").value += "playerid;";
break;
case 18:
document.getElementById("fnc").value += "OnPlayerLeaveCheckpoint,";
document.getElementById("prm").value += "playerid;";
break;
case 19:
document.getElementById("fnc").value += "OnPlayerEnterRaceCheckpoint,";
document.getElementById("prm").value += "playerid;";
break;
case 20:
document.getElementById("fnc").value += "OnPlayerLeaveRaceCheckpoint,";
document.getElementById("prm").value += "playerid;";
break;
case 21:
document.getElementById("fnc").value += "OnRconCommand,";
document.getElementById("prm").value += "cmd[];";
break;
case 22:
document.getElementById("fnc").value += "OnPlayerRequestSpawn,";
document.getElementById("prm").value += "playerid;";
break;
case 23:
document.getElementById("fnc").value += "OnObjectMoved,";
document.getElementById("prm").value += "objectid;";
break;
case 24:
document.getElementById("fnc").value += "OnPlayerObjectMoved,";
document.getElementById("prm").value += "playerid, objectid;";
break;
case 25:
document.getElementById("fnc").value += "OnPlayerPickUpPickup,";
document.getElementById("prm").value += "playerid, pickupid;";
break;
case 26:
document.getElementById("fnc").value += "OnVehicleMod,";
document.getElementById("prm").value += "playerid, vehicleid, componentid;";
break;
case 27:
document.getElementById("fnc").value += "OnEnterExitModShop,";
document.getElementById("prm").value += "playerid, enterexit, interiorid;";
break;
case 28:
document.getElementById("fnc").value += "OnVehiclePaintjob,";
document.getElementById("prm").value += "playerid, vehicleid, paintjobid;";
break;
case 29:
document.getElementById("fnc").value += "OnVehicleRespray,";
document.getElementById("prm").value += "playerid, vehicleid, color1, color2;";
break;
case 30:
document.getElementById("fnc").value += "OnVehicleDamageStatusUpdate,";
document.getElementById("prm").value += "vehicleid, playerid;";
break;
case 31:
document.getElementById("fnc").value += "OnUnoccupiedVehicleUpdate,";
document.getElementById("prm").value += "vehicleid, playerid, passenger_seat;";
break;
case 32:
document.getElementById("fnc").value += "OnPlayerSelectedMenuRow,";
document.getElementById("prm").value += "playerid, row;";
break;
case 33:
document.getElementById("fnc").value += "OnPlayerExitedMenu,";
document.getElementById("prm").value += "playerid;";
break;
case 34:
document.getElementById("fnc").value += "OnPlayerInteriorChange,";
document.getElementById("prm").value += "playerid, newinteriorid, oldinteriorid;";
break;
case 35:
document.getElementById("fnc").value += "OnPlayerKeyStateChange,";
document.getElementById("prm").value += "playerid, newkeys, oldkeys;";
break;
case 36:
document.getElementById("fnc").value += "OnRconLoginAttempt,";
document.getElementById("prm").value += "ip[], password[], success;";
break;
case 37:
document.getElementById("fnc").value += "OnPlayerUpdate,";
document.getElementById("prm").value += "playerid;";
break;
case 38:
document.getElementById("fnc").value += "OnPlayerStreamIn,";
document.getElementById("prm").value += "playerid, forplayerid;";
break;
case 39:
document.getElementById("fnc").value += "OnPlayerStreamOut,";
document.getElementById("prm").value += "playerid, forplayerid;";
break;
case 40:
document.getElementById("fnc").value += "OnVehicleStreamIn,";
document.getElementById("prm").value += "vehicleid, forplayerid;";
break;
case 41:
document.getElementById("fnc").value += "OnVehicleStreamOut,";
document.getElementById("prm").value += "vehicleid, forplayerid;";
break;
case 42:
document.getElementById("fnc").value += "OnDialogResponse,";
document.getElementById("prm").value += "playerid, dialogid, response, listitem, inputtext[];";
break;
case 43:
document.getElementById("fnc").value += "OnPlayerTakeDamage,";
document.getElementById("prm").value += "playerid, issuerid, Float:amount, weaponid;";
break;
case 44:
document.getElementById("fnc").value += "OnPlayerClickPlayer,";
document.getElementById("prm").value += "playerid, clickedplayerid, source;";
break;
}
}
-->
</script>
<title>ALS Hook generator</title>
</head><body>
<form method="get">
functions to hook (comma separated): <input name="funcs" id="fnc" type="text" value="<?=htmlspecialchars($_GET['funcs']);?>" size="100"><br>
parameters of hooked functions [separated by semicolon (;)]: <input name="params" id="prm" type="text" value="<?=htmlspecialchars($_GET['params']);?>" size="100"><br>
your library prefix (will be truncated to 10chars): <input name="prefix" type="text" value="<? echo ($_GET['prefix']) ? htmlspecialchars($_GET['prefix']) : 'myinc';?>" size="10" maxlength="10"><br>
<select id="slc" onchange="javascript:slcChange();">
<option value="0">--- inbuilt callbacks ---</option>
<option value="1">OnGameModeInit()</option>
<option value="2">OnGameModeExit()</option>
<option value="3">OnFilterScriptInit()</option>
<option value="4">OnFilterScriptExit()</option>
<option value="5">OnPlayerConnect(playerid)</option>
<option value="6">OnPlayerDisconnect(playerid, reason)</option>
<option value="7">OnPlayerSpawn(playerid)</option>
<option value="8">OnPlayerDeath(playerid, killerid, reason)</option>
<option value="9">OnVehicleSpawn(vehicleid)</option>
<option value="10">OnVehicleDeath(vehicleid, killerid)</option>
<option value="11">OnPlayerText(playerid, text[])</option>
<option value="12">OnPlayerCommandText(playerid, cmdtext[])</option>
<option value="13">OnPlayerRequestClass(playerid, classid)</option>
<option value="14">OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)</option>
<option value="15">OnPlayerExitVehicle(playerid, vehicleid)</option>
<option value="16">OnPlayerStateChange(playerid, newstate, oldstate)</option>
<option value="17">OnPlayerEnterCheckpoint(playerid)</option>
<option value="18">OnPlayerLeaveCheckpoint(playerid)</option>
<option value="19">OnPlayerEnterRaceCheckpoint(playerid)</option>
<option value="20">OnPlayerLeaveRaceCheckpoint(playerid)</option>
<option value="21">OnRconCommand(cmd[])</option>
<option value="22">OnPlayerRequestSpawn(playerid)</option>
<option value="23">OnObjectMoved(objectid)</option>
<option value="24">OnPlayerObjectMoved(playerid, objectid)</option>
<option value="25">OnPlayerPickUpPickup(playerid, pickupid)</option>
<option value="26">OnVehicleMod(playerid, vehicleid, componentid)</option>
<option value="27">OnEnterExitModShop(playerid, enterexit, interiorid)</option>
<option value="28">OnVehiclePaintjob(playerid, vehicleid, paintjobid)</option>
<option value="29">OnVehicleRespray(playerid, vehicleid, color1, color2)</option>
<option value="30">OnVehicleDamageStatusUpdate(vehicleid, playerid)</option>
<option value="31">OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat)</option>
<option value="32">OnPlayerSelectedMenuRow(playerid, row)</option>
<option value="33">OnPlayerExitedMenu(playerid)</option>
<option value="34">OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)</option>
<option value="35">OnPlayerKeyStateChange(playerid, newkeys, oldkeys)</option>
<option value="36">OnRconLoginAttempt( ip[], password[], success )</option>
<option value="37">OnPlayerUpdate(playerid)</option>
<option value="38">OnPlayerStreamIn(playerid, forplayerid)</option>
<option value="39">OnPlayerStreamOut(playerid, forplayerid)</option>
<option value="40">OnVehicleStreamIn(vehicleid, forplayerid)</option>
<option value="41">OnVehicleStreamOut(vehicleid, forplayerid)</option>
<option value="42">OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])</option>
<option value="43">OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)</option>
<option value="44">OnPlayerClickPlayer(playerid, clickedplayerid, source)</option>
</select><br>
<input type="checkbox" <? if ($_GET['genfunc']) echo "checked"; ?> name="genfunc"> Generate public functions<br>
<input type="checkbox" <? if ($_GET['genforward']) echo "checked"; ?> name="genforward"> Generate forward lines<br>
<input type="submit" value="generate hook code"><hr>
<?php
if ($_GET['funcs'] && $_GET['prefix'])
{
$prfx = htmlspecialchars(substr($_GET['prefix'], 0, 10));
$fs = array_map("htmlspecialchars", explode(',', $_GET['funcs']));
$prms = array_map("htmlspecialchars", explode(';', $_GET['params']));
$rws = count($fs) * 13;
print('<textarea readonly="1" cols="128" rows="'.$rws.'">');
if ($_GET['genfunc'])
{
foreach ($fs as $ln => $vl)
{
if (!$vl) continue;
echo("public {$vl}({$prms[$ln]})".PHP_EOL);
echo("{".PHP_EOL." return 1;".PHP_EOL."}".PHP_EOL.PHP_EOL);
}
}
foreach ($fs as $ln => $vl)
{
if (!$vl) continue;
echo("#if defined _ALS_$vl".PHP_EOL);
echo(" #undef $vl".PHP_EOL);
echo("#else".PHP_EOL);
echo(" #define _ALS_$vl".PHP_EOL);
echo("#endif".PHP_EOL);
echo("#define $vl {$prfx}_{$vl}".PHP_EOL);
if ($_GET['genforward']) echo("forward {$prfx}_{$vl}({$prms[$ln]});".PHP_EOL.PHP_EOL);
}
print('</textarea>');
}
?>
</form>
</body>
#if defined _ALS_cat
#undef cat
#else
#define _ALS_cat
#endif
#define cat myinc_cat
forward myinc_cat(123);
- You can now choose from the inbuilt callbacks from a drop-down list. It includes all callbacks from a_samp.inc, and it fills the callback names and parameters in automatically. - You have the option to control which is going to be generated. You can (de)select generating forward() and public() lines! - Added anti XSS (Cross-Site-Scripting) attack code. - Fixed some english grammar problem. |
Pretty legit, i'll be using this
I'll make a program soon for this in C# lolzor: pawn Код:
|