Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*===================================================================================================*\
- ||===================================================================================================||
- || ________ ________ ___ _ ______ ______ ________ ||
- || \ | _____| | ____ | | \ | | | _ \ | _ \ | ____ | / ||
- || ======== \ | |_____ | |____| | | |\ \ | | | | | | | |_| / | |____| | / ======== ||
- || | | _____ | | ____ | | | \ \| | | | | | | _ \ | ____ | | ||
- || ======== / ______| | | | | | | | \ \ | | |_| | | | \ \ | | | | \ ======== ||
- || / |________| |_| |_| |_| \__| |______/ |_| \_| |_| |_| \ ||
- || ||
- ||===================================================================================================||
- || Created on the 10th of June 2008 by =>Sandra<= ||
- || Do NOT remove any credits!! ||
- \*===================================================================================================*/
- #include <a_samp>
- new PawnFunctions[][] =
- {
- "acos", "AddMenuItem", "AddPlayerClass", "AddPlayerClassEx", "AddStaticPickup", "AddStaticVehicle", "AddStaticVehicleEx",
- "AddVehicleComponent", "AllowAdminTeleport", "AllowInteriorWeapons", "AllowPlayerTeleport", "ApplyAnimation", "asin",
- "atan", "atan2", "AttachObjectToPlayer", "AttachPlayerObjectToPlayer", "AttachTrailerToVehicle",
- "Ban", "BanEx",
- "CallLocalFunction", "CallRemoteFunction", "ChangeVehicleColor", "ChangeVehiclePaintJob", "ClearAnimations", "CreateExplosion",
- "CreateMenu", "CreateObject", "CreatePickup", "CreatePlayerObject", "CreateVehicle",
- "DestroyMenu", "DestroyObject", "DestroyPickup", "DestroyPlayerObject", "DestroyVehicle", "DetachTrailerFromVehicle",
- "DisableInteriorEnterExits", "DisableMenu", "DisableMenuRow", "DisablePlayerCheckpoint", "DisablePlayerRaceCheckpoint",
- "EnableStuntBonusForAll", "EnableStuntBonusForPlayer", "EnableTirePopping", "EnableZoneNames",
- "fclose", "fexists", "fopen", "fread", "fremove", "fwrite", "ForceClassSelection", "format",
- "GameModeExit", "GameTextForAll", "GameTextForPlayer", "GangZoneCreate", "GangZoneDestroy", "GangZoneFlashForAll, ", "GangZoneFlashForPlayer",
- "GangZoneHideForAll", "GangZoneHideForPlayer", "GangZoneShowForAll", "GangZoneShowForPlayer", "GangZoneStopFlashForAll", "GangZoneStopFlashForPlayer",
- "GetMaxPlayers", "GetObjectPos", "GetObjectRot", "GetPlayerAmmo", "GetPlayerArmour", "GetPlayerColor", "GetPlayerFacingAngle", "GetPlayerHealth",
- "GetPlayerInterior", "GetPlayerIp", "GetPlayerKeys", "GetPlayerMenu", "GetPlayerMoney", "GetPlayerName", "GetPlayerObjectPos", "GetPlayerObjectRot",
- "GetPlayerPing", "GetPlayerPos", "GetPlayerPos", "GetPlayerScore", "GetPlayerSkin", "GetPlayerSpecialAction", "GetPlayerState", "GetPlayerTeam", "GetPlayerTime",
- "GetPlayerVehicleID", "GetPlayerVirtualWorld", "GetPlayerWantedLevel", "GetPlayerWeapon", "GetPlayerWeaponData", "GetServerVarAsBool",
- "GetServerVarAsInt", "GetServerVasAsString", "GetVehicleHealth", "GetVehicleModel", "GetVehiclePos", "GetVehicleTrailer",
- "GetVehicleVirtualWorld", "GetVehicleZAngle", "GetWeaponName", "getdate", "gettime", "GivePlayerMoney", "GivePlayerWeapon",
- "HideMenuForPlayer",
- "IsPlayerAdmin", "IsPlayerConnected", "IsPlayerInAnyVehicle", "IsPlayerInCheckpoint", "IsPlayerInRaceCheckpoint",
- "IsTrailerAttachedToVehicle", "IsValidMenu", "IsValidObject", "IsValidPlayerObject",
- "Kick", "KilTimer",
- "LimitGlobalChatRadius", "LinkVehicleToInterior",
- "MoveObject", "MovePlayerObject",
- "PlayerPlaySound", "PlayerSpectatePlayer", "PlayerSpectateVehicle", "print", "printf", "PutPlayerInVehicle",
- "random", "RemovePlayerFromVehicle", "RemovePlayerMapIcon", "RemoveVehicleComponent", "ResetPlayerMoney", "ResetPlayerWeapons",
- "SendClientMessage", "SendClientMessageToAll", "SendDeathMessage", "SendPlayerMessageToAll", "SendPlayerMessageToPlayer",
- "SendRconCommand", "SetCameraBehindPlayer", "SetDeathDropAmount", "SetDisabledWeapons", "SetGameModeText", "SetGravity",
- "SetMenuColumnHeader", "SetNameTagDrawDistance", "SetObjectPos", "SetObjectRot", "SetPlayerAmmo", "SetPlayerArmour",
- "SetPlayerCameraLookAt", "SetPlayerCameraPos", "SetPlayerCheckpoint", "SetPlayerColor", "SetPlayerDisabledWeapons",
- "SetPlayerFacingAngle", "SetPlayerHealth", "SetPlayerInterior", "SetPlayerMapIcon", "SetPlayerMarkerForPlayer", "SetPlayerName",
- "SetPlayerObjectPos", "SetPlayerObjectRot", "SetPlayerPos", "SetPlayerPosFindZ", "SetPlayerRaceCheckpoint", "SetPlayerScore",
- "SetPlayerSkin", "SetPlayerSpecialAction", "SetPlayerTeam", "SetPlayerTime", "SetPlayeVirtualWorld", "SetPlayerWantedLevel",
- "SetPlayerWeather", "SetPlayerWorldBounds", "SetSpawnInfo", "SetTeamCount", "SetTimer", "SetTimerEx", "SetVehicleHealth",
- "SetVehicleNumberPlate", "SetVehicleParamsForPlayer", "SetVehiclePos", "SetVehicleToRespawn", "SetVehicleVirtualWorld",
- "SetVehicleZAngle", "SetWeater", "SetWorldTime", "ShowMenuForPlayer", "ShowNameTags", "ShowPlayerMarkers", "ShowPlayerNameTagForPlayer", "SpawnPlayer", "StopObject",
- "StopPlayerObject", "strcmp", "strlen", "strmid", "strval", "strfind", "strins",
- "TextDrawAlignment", "TextDrawBackgroundColor", "TextDrawBoxColor", "TextDrawColor", "TextDrawCreate", "TextDrawDestroy", "TextDrawFont",
- "TextDrawHideForAll", "TextDrawHideForPlayer", "TextDrawLetterSize", "TextDrawSetOutline", "TextDrawProportional", "TextDrawSetShadow",
- "TextDrawSetString", "TextDrawShowForAll", "TextDrawShowForPlayer", "TextDrawTextSize", "TextDrawUseBox", "GetTickCount", "TogglePlayerClock", "TogglePlayerControllable",
- "UsePlayerPedAnims"
- };
- new FunctionCounts[sizeof(PawnFunctions)];
- new OtherFunctions[][] =
- {
- "#define", "{", "}"
- };
- new OtherFunctionCounts[sizeof(OtherFunctions)];
- new TotalLines;
- public OnFilterScriptInit()
- {
- print("--------------------------------------");
- print(" Script-Debug by =>Sandra<= ");
- print(" succesfully loaded! ");
- print(" ");
- print(" Type /debug to start ");
- print("--------------------------------------");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("--------------------------------------");
- print(" Script-Debug by =>Sandra<= ");
- print(" succesfully unloaded! ");
- print("--------------------------------------");
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- if(strcmp(cmd, "/debug", true)==0)
- {
- TotalLines = 0;
- CountScriptLines();
- printf("Analyzing %d lines... Please Wait...", TotalLines);
- for(new func; func<sizeof(OtherFunctionCounts); func++)
- {
- OtherFunctionCounts[func] = 0;
- }
- CountBracketsAndDefines();
- CountFunctions();
- print("\n\n\n\n");
- print(" ________________________________________________________________");
- print("| ScriptDebug by =>Sandra<= |");
- print("| Debug Results: |");
- print("| _______________________________________________________________|");
- printf("| Total Lines: %5d |", TotalLines);
- printf("| Total Opening brackets: %5d |", OtherFunctionCounts[1]);
- printf("| Total Closing brackets: %5d |", OtherFunctionCounts[2]);
- printf("| Total Defines: %5d |", OtherFunctionCounts[0]);
- if( OtherFunctionCounts[1] != OtherFunctionCounts[2])
- {
- print("| _______________________________________________________________|");
- print("| Warning: The amount of opening brackets and closing brackets |");
- print("| does not match! |");
- }
- print("| _______________________________________________________________|");
- print("| |");
- print("| PawnFunctions: Times Used: |");
- print("|________________________________________________________________|");
- for(new func; func<sizeof(PawnFunctions); func++)
- {
- if(FunctionCounts[func] > 0)
- {
- printf(" %30s %dx",PawnFunctions[func], FunctionCounts[func]);
- }
- }
- print("| _______________________________________________________________|");
- print("| Debugging Done! |");
- print(" ________________________________________________________________");
- print("\n\n\n\n");
- return 1;
- }
- if(strcmp(cmd, "/searchfunction", true, 15)==0)
- {
- TotalLines = 0;
- CountScriptLines();
- if(!strlen(cmd[14]))
- {
- print("Error: Use /findfunction [Function]");
- return 1;
- }
- printf("Searching for \"%s\"... Please Wait...", cmd[16]);
- new entry[256], count, lines[999], newfunc[32];
- new File:scriptfile = fopen("ScriptDebug.txt", io_read);
- if (scriptfile)
- {
- format(newfunc, 32, "%s(", cmd[16]);
- for(new id; id<TotalLines; id++)
- {
- fread(scriptfile, entry);
- for(new i; i<strlen(entry); i++)
- {
- if(strfind(entry[i], newfunc, true)==0)
- {
- count++;
- lines[count-1] = (id+1);
- }
- }
- }
- }
- printf("\n__________________________________________\n");
- if(count == 0)
- {
- printf("\"%s\" is not found in your script!", cmd[16], count);
- }
- else
- {
- printf("\"%s\" is found %dx in your script", cmd[16], count);
- printf("You can find this function on these lines:");
- new str[256];
- for(new i; i<count; i++)
- {
- if(i == 0)
- {
- format(str, 256, "%d", lines[i]);
- }
- else
- {
- format(str, 256, "%s, %d", str, lines[i]);
- }
- }
- print(str);
- }
- printf("__________________________________________\n\n\n");
- return 1;
- }
- return 0;
- }
- stock CountScriptLines()
- {
- new entry[256];
- new File: scriptfile = fopen("ScriptDebug.txt", io_read);
- while(fread(scriptfile, entry, 256))
- {
- TotalLines++;
- }
- fclose(scriptfile);
- }
- stock CountFunctions()
- {
- new entry[256], newfunc[64];
- new File: scriptfile = fopen("ScriptDebug.txt", io_read);
- if (scriptfile)
- {
- for(new id; id<TotalLines; id++)
- {
- fread(scriptfile, entry);
- for(new func; func < sizeof(PawnFunctions); func++)
- {
- format(newfunc, 64, "%s(", PawnFunctions[func]);
- for(new i; i<strlen(entry); i++)
- {
- if(strfind(entry[i], newfunc, true)==0)
- {
- FunctionCounts[func]++;
- }
- }
- }
- }
- }
- fclose(scriptfile);
- }
- CountBracketsAndDefines()
- {
- new entry[256];
- new File:scriptfile = fopen("ScriptDebug.txt", io_read);
- if (scriptfile)
- {
- for(new id; id<TotalLines; id++)
- {
- fread(scriptfile, entry);
- for(new func; func<sizeof(OtherFunctions); func++)
- {
- for(new i; i<strlen(entry); i++)
- {
- if(strfind(entry[i], OtherFunctions[func], true)==0)
- {
- OtherFunctionCounts[func]++;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement