10.03.2011, 14:19
pawn Код:
/***************************************** - [Random Messages by: Hoxxy] - *****************************************/
/* Hoxxy's InGameTeleport Maker v1.0 */
/* You don't have permission to DELETE or CHANGE credits. */
/* You don't have permission to EDIT my FS, and UPLOAD it as yours. */
/* You don't have permission to publish it on your BLOGS or WEBSITES. */
/* If you want that, send me E-mail or PM on sa-mp.com forum */
/* My E-mail is opanakk@gmail.com, and name is Pooh7 */
/* http://www.sa-mp.com | http://www.nl-gaming.net */
/*************************************************************************************************************************/
#define FILTERSCRIPT
#include <a_samp>
#include <Fini>
#include <sscanf2>
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_BLUE 0x00C2ECFF
#define COLOR_GREEN 0x48E31CFF
#define COLOR_LIGHTGREEN 0x80FF80FF
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_LIGHTYELLOW 0xFFFF80FF
#define MAX_LOCATIONS 30
#define File "Teleports.ini"
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new bool:TeleportForAll;
enum tInfo
{
Location[32],
Float:tX,
Float:tY,
Float:tZ,
};
new TeleportInfo[MAX_LOCATIONS][tInfo];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Ingame teleport maker by Hoxxy LOADED");
print("--------------------------------------\n");
TeleportForAll = true;
LoadTeleports();
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Ingame teleport maker by Hoxxy UNLOADED");
print("----------------------------------\n");
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(makeport, 8, cmdtext);
dcmd(teleport, 8, cmdtext);
dcmd(toggleport, 10, cmdtext);
dcmd(reloadteleports, 15, cmdtext);
dcmd(teleporthelp, 12, cmdtext);
dcmd(tune, 4, cmdtext);
return 0;
}
stock LoadTeleports()
{
if(!Fini_Exists(File))
{
printf("DEBUG: The file %s doesn't exists. Creating...", File);
Fini_Create(File);
printf("DEBUG: File %s is created.", File);
return 1;
}
new location[32], stringfromfile[128], id[3];
Fini_OpenFile(File);
for(new i = 0; i < sizeof(TeleportInfo); i++)
{
format(id, sizeof(id), "%d", i);
strmid(stringfromfile, Fini_GetStr(id), 1, strlen(Fini_GetStr(id)), 255);
if(!strlen(stringfromfile)) break;
sscanf(stringfromfile, "p<|>s[32]fff",
location, TeleportInfo[i][tX], TeleportInfo[i][tY], TeleportInfo[i][tZ]);
strmid(TeleportInfo[i][Location], location, 0, strlen(location), 255);
printf("Teleport Info: %d, %s, %f, %f", i, TeleportInfo[i][Location], TeleportInfo[i][tX], TeleportInfo[i][tY], TeleportInfo[i][tZ]);
}
Fini_CloseFile();
return 1;
}
stock TeleportPlayer(playerid, id)
{
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), TeleportInfo[id][tX], TeleportInfo[id][tY], TeleportInfo[id][tZ]);
else SetPlayerPos(playerid, TeleportInfo[id][tX], TeleportInfo[id][tY], TeleportInfo[id][tZ]);
new string[64];
format(string, sizeof(string), "You have been teleported to {FFFFFF}%s.", TeleportInfo[id][Location]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
return 1;
}
dcmd_makeport(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, " (error) You are not authorized to use this command!");
new teleloc[32], Float:Pos[3], TeleportMaxID = 0, string[128], id[3];
if(sscanf(params, "s[32]", teleloc)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeport [Location name]");
for(new i = 0; i < MAX_LOCATIONS; i++)
{
if(strlen(TeleportInfo[i][Location]) > 0)
{
TeleportMaxID++;
}
}
format(id, sizeof(id), "%d", TeleportMaxID);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(string, sizeof(string), "Location name: {FFFF00}%s {FF9900}| X: {FFFF00}%f {FF9900}| Y: {FFFF00}%f {FF9900}| Z: {FFFF00}%f",
teleloc, Pos[0], Pos[1], Pos[2]);
SendClientMessage(playerid, COLOR_ORANGE, string);
SendClientMessage(playerid, COLOR_ORANGE, "You have added new teleport! Use /teleport.");
strmid(TeleportInfo[TeleportMaxID][Location], teleloc, 0, strlen(teleloc), 255);
TeleportInfo[TeleportMaxID][tX] = Pos[0];
TeleportInfo[TeleportMaxID][tY] = Pos[1];
TeleportInfo[TeleportMaxID][tZ] = Pos[2];
format(string, sizeof(string), "%s|%f|%f|%f", teleloc, Pos[0], Pos[1], Pos[2]);
if(!Fini_Exists(File)) Fini_Create(File);
Fini_OpenFile(File);
Fini_SetStr(id, string);
Fini_SaveFile();
Fini_CloseFile();
return 1;
}
dcmd_teleport(playerid, params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid) && TeleportForAll == false) return SendClientMessage(playerid, COLOR_GRAD2, " (error) You are not authorized to use this command!");
new string[32], var[512];
for(new i; i < sizeof(TeleportInfo); i++)
{
format(string, sizeof(string), "%s\n", TeleportInfo[i][Location]);
strcat(var, string);
}
ShowPlayerDialog(playerid, 2000, DIALOG_STYLE_LIST, "Teleport menu", var, "Teleport!", "Close");
return 1;
}
dcmd_toggleport(playerid, params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, " (error) You are not authorized to use this command!");
if(TeleportForAll == true)
{
TeleportForAll = false;
SendClientMessage(playerid, COLOR_BLUE, "Teleport for all {FFFFFF}disabled.");
return 1;
}
if(TeleportForAll == false)
{
TeleportForAll = true;
SendClientMessage(playerid, COLOR_BLUE, "Teleport for all {FFFFFF}enabled.");
return 1;
}
return 1;
}
dcmd_reloadteleports(playerid, params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, " (error) You are not authorized to use this command!");
LoadTeleports();
SendClientMessage(playerid, COLOR_GREEN, "Teleports reloaded!");
return 1;
}
dcmd_teleporthelp(playerid, params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, " (error) You are not authorized to use this command!");
SendClientMessage(playerid, COLOR_YELLOW, " /makeport - {FFFF80}Will make new teleport location on your current position");
SendClientMessage(playerid, COLOR_YELLOW, " /teleport - {FFFF80}Will show you teleport menu");
SendClientMessage(playerid, COLOR_YELLOW, " /toggleport - {FFFF80}Enable or disable showing teleport menu for all");
SendClientMessage(playerid, COLOR_YELLOW, " /reloadteleports - {FFFF80}Will (re)load teleports");
SendClientMessage(playerid, COLOR_YELLOW, " /teleporthelp - {FFFF80}Will show help menu");
return 1;
}
dcmd_tune(playerid, params[])
{
#pragma unused params
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have to be in vehicle to use this command!");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tuning Menu", "Rims\nColours\nHidraulics\nNitro\nStereo\nRepair", "Choose", "Cancel");
TogglePlayerControllable(playerid, false);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2000 && response)
{
TeleportPlayer(playerid, listitem);
}
new vehicleid = GetPlayerVehicleID(playerid);
if(dialogid == 1)
{
if(response == 1)
{
if(listitem == 0) //Rims
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 1) //Colors
{
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Colours menu", "White\nBlack\nGreen\nBlue\nYellow\nRed", "Choose", "Back");
}
if(listitem == 2) //Hidraulics
{
AddVehicleComponent(vehicleid, 1087);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tuning Menu", "Rims\nColours\nHidraulics\nNitro\nStereo\nRepair", "Choose", "Cancel");
}
if(listitem == 3) //Nitro
{
AddVehicleComponent(vehicleid, 1010);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tuning Menu", "Rims\nColours\nHidraulics\nNitro\nStereo\nRepair", "Choose", "Cancel");
}
if(listitem == 4) //Stereo
{
AddVehicleComponent(vehicleid, 1086);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tuning Menu", "Rims\nColours\nHidraulics\nNitro\nStereo\nRepair", "Choose", "Cancel");
}
if(listitem == 5) //Repair
{
RepairVehicle(vehicleid);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tuning Menu", "Rims\nColours\nHidraulics\nNitro\nStereo\nRepair", "Choose", "Cancel");
}
}
if(response == 0) return TogglePlayerControllable(playerid, true);
}
if(dialogid == 2)
{
if(response == 1)
{
if(listitem == 0)
{
AddVehicleComponent(vehicleid, 1080); //Switch
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 1)
{
AddVehicleComponent(vehicleid, 1074); //Mega
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 2)
{
AddVehicleComponent(vehicleid, 1079); //Cutter
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 3)
{
AddVehicleComponent(vehicleid, 1025); //Offroad
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 4)
{
AddVehicleComponent(vehicleid, 1073); //Shadow
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 5)
{
AddVehicleComponent(vehicleid, 1075); //Rimshine
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 6)
{
AddVehicleComponent(vehicleid, 1076); //Wires
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 7)
{
AddVehicleComponent(vehicleid, 1077); //Classic
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 8)
{
AddVehicleComponent(vehicleid, 1078); //Twist
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 9)
{
AddVehicleComponent(vehicleid, 1081); //Grove
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 10)
{
AddVehicleComponent(vehicleid, 1082); //Import
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 11)
{
AddVehicleComponent(vehicleid, 1083); //Dollar
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 12)
{
AddVehicleComponent(vehicleid, 1084); //Trance
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 13)
{
AddVehicleComponent(vehicleid, 1085); //Atomic
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 14)
{
AddVehicleComponent(vehicleid, 1096); //Ahab
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 15)
{
AddVehicleComponent(vehicleid, 1097); //Virtual
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
if(listitem == 16)
{
AddVehicleComponent(vehicleid, 1098); //Access
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Rims menu", "Switch\nMega\nCutter\nOffroad\nShadow\nRimshine\nWires\nClassic\nTwist\nGrove\nImport\nDollar\nTrance\nAtomic\nAhab\nVirtual\nAccess\n", "Choose", "Back");
}
}
if(response == 0) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tuning Menu", "Rims\nColours\nHidraulics\nNitro\nStereo\nRepair", "Choose", "Cancel");
}
if(dialogid == 3)
{
if(response == 1)
{
if(listitem == 0)
{
ChangeVehicleColor(vehicleid, 1, 1);
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Colours menu", "White\nBlack\nGreen\nBlue\nYellow\nRed", "Choose", "Back");
}
if(listitem == 1)
{
ChangeVehicleColor(vehicleid, 0, 0);
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Colours menu", "White\nBlack\nGreen\nBlue\nYellow\nRed", "Choose", "Back");
}
if(listitem == 2)
{
ChangeVehicleColor(vehicleid, 252, 252);
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Colours menu", "White\nBlack\nGreen\nBlue\nYellow\nRed", "Choose", "Back");
}
if(listitem == 3)
{
ChangeVehicleColor(vehicleid, 158, 158);
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Colours menu", "White\nBlack\nGreen\nBlue\nYellow\nRed", "Choose", "Back");
}
if(listitem == 4)
{
ChangeVehicleColor(vehicleid, 6, 6);
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Colours menu", "White\nBlack\nGreen\nBlue\nYellow\nRed", "Choose", "Back");
}
if(listitem == 5)
{
ChangeVehicleColor(vehicleid, 170, 170);
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Colours menu", "White\nBlack\nGreen\nBlue\nYellow\nRed", "Choose", "Back");
}
}
if(response == 0) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Tuning Menu", "Rims\nColours\nHidraulics\nNitro\nStereo\nRepair", "Choose", "Cancel");
}
return 0;
}