18.03.2012, 16:21
(
Последний раз редактировалось Jeffrey_Hatrix Jeffrey_; 23.03.2012 в 17:46.
)

Hey users from SA:MP Fуrum,
I'm new here and become here to show to you my Filter Script - Cars Machine,
this script is util to save Cars and Load then when your script does GMX.
Features:
• Create File Vehicle;
• Delete File Vehicle;
• Choose File Vehicle Color;
• Teleport to File Vehicle;
• Respawn File Vehicle;
• All structure system in Dialog;
ScreensShoots:





PS: Tips and reviews are welcome
(Find bugs? report then please...)
[FilterScript] Download: Cars Machine (amx) Cars Machine (pwn)
[FilterScript] source:
pawn Код:
/*
| |
| Script updated by: Jeffrey_Hatrix, thanks to Willian_Luigi |
| to orginal Cars Machine at pastebin.com/HnBePeCp |
| |
*/
#include <a_samp>
#include <SII>
#include <ZCMD>
#define filterScriptUser
#define callCarsDialog 1
#define msgbox DIALOG_STYLE_MSGBOX
#define input DIALOG_STYLE_INPUT
#define list DIALOG_STYLE_LIST
forward wii_CreateCars(playerid, carro, Float:x_, Float:y_, Float:z_, Float:a_);
forward LOAD_CAR();
new Global[128];
enum DATA_CAR {
file,
u,
id,
c_,
c2_,
Float:x,
Float:y,
Float:z,
Float:a
};
new Approppriately[DATA_CAR];
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case callCarsDialog:
if(response)
{
ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
return 1;
}
case 2:
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, 3, input, "Cars GUI","\nType a id of a vehicle to create and save\n\n", "Confirm", "Back");
return 1;
}
else if(listitem == 1)
{
ShowPlayerDialog(playerid, 4, input, "Cars GUI","\nType the id of File to delete the car.\n\n", "Confirm", "Back");
return 1;
}
else if(listitem == 2)
{
ShowPlayerDialog(playerid, 7, list, "Cars GUI - COLORS", "\nColor 1\nColor 2\n\n", "Confirm", "Back");
return 1;
}
else if(listitem == 3)
{
ShowPlayerDialog(playerid, 10, input, "Cars GUI - X", "\nType the id File to teleport.\n\n", "Confirm", "Back");
return 1;
}
else if(listitem == 4)
{
ShowPlayerDialog(playerid, 13, input, "Cars GUI - Spawn", "\nType the id File to respawn\n\n", "Confirm", "Cancel");
return 1;
}
}
case 3:
if(response)
{
if(IsPlayerInAnyVehicle(playerid))
return ShowPlayerDialog(playerid, 2, list, "ERROR, ALREADY IN A VEHICLE", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
GetPlayerPos(playerid, Approppriately[x], Approppriately[y], Approppriately[z]);
GetPlayerFacingAngle(playerid, Approppriately[a]);
new cc_ = strval(inputtext);
SetTimerEx("wii_CreateCars", 5000, false, "ddffff", playerid, cc_, Approppriately[x], Approppriately[y], Approppriately[z], Approppriately[a]);
format(Global, 60, "(WAIT 5 SECONDS) - File car created, id of car: %d", cc_);
ShowPlayerDialog(playerid, 6, msgbox, "Sucessful", Global, "Continue", "Back");
TogglePlayerControllable(playerid, 0);
SetPlayerPos(playerid, Approppriately[x]+2, Approppriately[y], Approppriately[z]);
return 1;
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 4:
if(response)
{
new cc_ = strval(inputtext);
format(Global, 30, "Cars/%d.ini", cc_);
if(!INI_Exist(Global)) return ShowPlayerDialog(playerid, 5, msgbox, "ERROR", "The id from File car doesn't exist, try again.\n\n", "Try", "Cancel");
INI_Remove(Global);
format(Global, 45, "File car id[%d] deleted with successful!", cc_);
ShowPlayerDialog(playerid, 5, msgbox, "Cars GUI", Global, "Delete other", "Cancel");
DestroyVehicle(cc_);
return 1;
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 5:
if(response)
{
ShowPlayerDialog(playerid, 4, input, "Cars GUI","\nType the ID File for delete the car\n\n", "Confirm", "Back");
return 1;
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 6:
if(!response) return ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 7:
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, 8, input, "COR 1", "\nType the id of File car\n\n", "Confirm", "Cancel");
return 1;
}
else if(listitem == 2)
{
ShowPlayerDialog(playerid, 9, input, "COR 2", "\nType the id of File car\n\n", "Confirm", "Cancel");
return 1;
}
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 8:
if(response)
{
Approppriately[id] = strval(inputtext);
format(Global, 30, "Cars/%d.ini", Approppriately[id]);
if(!INI_Exist(Global))
return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID ID", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
ShowPlayerDialog(playerid, 11, input, "COR 1", "\nType the value of color 1 ( 0 - 128 )\n\n", "Confirm", "Cancel");
return 1;
}
case 9:
if(response)
{
Approppriately[id] = strval(inputtext);
format(Global, 30, "Cars/%d.ini", Approppriately[id]);
if(!INI_Exist(Global))
return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID ID", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
ShowPlayerDialog(playerid, 12, input, "COR 2", "\nType the value of color 2 ( 0 - 128 )\n\n", "Confirm", "Cancel");
return 1;
}
case 10:
if(response)
{
Approppriately[id] = strval(inputtext);
format(Global, 30, "Cars/%d.ini", Approppriately[id]);
if(!INI_Exist(Global))
return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID ID", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
PutPlayerInVehicle(playerid, Approppriately[id], 0);
ShowPlayerDialog(playerid, 2, list, "Cars GUI - Teleport successful.", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
return 1;
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 11:
if(response)
{
if(128 > Approppriately[c_] < 0)
return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID VALUE", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
Approppriately[c_] = strval(inputtext);
format(Global, 30, "Cars/%d.ini", Approppriately[id]);
INI_Open(Global);
INI_WriteInt("Info Cor 1", Approppriately[c_]);
INI_Save();
INI_Close();
ChangeVehicleColor(Approppriately[id], Approppriately[c_], Approppriately[c2_]);
return 1;
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 12:
if(response)
{
if(128 > Approppriately[c2_] < 0)
return ShowPlayerDialog(playerid, 2, list, "ERROR, INVALID VALUE", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
Approppriately[c2_] = strval(inputtext);
format(Global, 30, "Cars/%d.ini", Approppriately[id]);
INI_Open(Global);
INI_WriteInt("Info Cor 2", Approppriately[c2_]);
INI_Save();
INI_Close();
ChangeVehicleColor(Approppriately[id], Approppriately[c_], Approppriately[c2_]);
return 1;
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
case 13:
if(response)
{
Approppriately[id] = strval(inputtext);
format(Global, 30, "Cars/%d.ini", Approppriately[id]);
if(!INI_Exist(Global))
return ShowPlayerDialog(playerid, 2, list, "ERROR, ID INVБLIDO", "\nCriar carro\nDeletar carro\nModificar cores\nIr atй carro \"x\"\nRespawn carro \"x\"\n\n", "Confirm", "Cancel");
SetVehicleToRespawn(Approppriately[id]);
ShowPlayerDialog(playerid, 2, list, "VEНCULO RESPAWNADO", "\nCriar carro\nDeletar carro\nModificar cores\nIr atй carro \"x\"\nRespawn carro \"x\"\n\n", "Confirm", "Cancel");
return 1;
}
else ShowPlayerDialog(playerid, 2, list, "Cars GUI", "\nCreate car\nDelete car\nChoose colors\nTeleport to car \"x\"\nRespawn car \"x\"\n\n", "Confirm", "Cancel");
default: return false;
}
return 1;
}
CMD:carsmachine(playerid) {
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "You're not an admin Rcon !");
ShowPlayerDialog(playerid, callCarsDialog, msgbox, "Introduction", "[FS] - by Willian_Luigi, updated by: Jeffrey_Hatrix\n\n", "Continue", "");
return 1;
}
/*
CMD:ac(playerid, params[]) {
new id_;
if(sscanf(params, "d", id_))
return SendClientMessage(playerid, -1, "Approppriately Use: /ac [id file]");
format(Global, 20, "Cars/%d.ini", id_);
if(!INI_Exist(Global))
return SendClientMessage(playerid, -1, "ID inexistente");
INI_Remove(Global);
format(Global, 30, "Arquivo carro id %d deletado!", id_);
return 1;
}
CMD:cc(playerid, params[]) {
new car;
if(sscanf(params,"d", car))
return SendClientMessage(playerid, -1, "Approppriately Use: /cc [ID]");
if(IsPlayerInAnyVehicle(playerid)) {
GetVehiclePos(GetPlayerVehicleID(playerid), Approppriately[x], Approppriately[y], Approppriately[z]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), Approppriately[a]);
}
else {
GetPlayerPos(playerid, Approppriately[x], Approppriately[y], Approppriately[z]);
GetPlayerFacingAngle(playerid, Approppriately[a]);
}
if(611 > car > 400)
return (SetTimerEx("wii_CreateCars", 5000, false, "ddffff",playerid, car, Approppriately[x], Approppriately[y], Approppriately[z], Approppriately[a]));
SendClientMessage(playerid, -1, "Carro criado com sucesso.");
return 1;
}*/
public wii_CreateCars(playerid, carro, Float:x_, Float:y_, Float:z_, Float:a_) {
TogglePlayerControllable(playerid, 1);
Approppriately[file] ++;
Approppriately[c_] = random(128);
Approppriately[c2_] = random(128);
new ff = CreateVehicle(carro, x_, y_, z_, a_, Approppriately[c_], Approppriately[c2_], 9999999);
PutPlayerInVehicle(playerid, ff , 0);
format(Global, 30, "Cars/%d.ini", Approppriately[file]);
INI_Open(Global);
INI_WriteInt("Info Car ID", carro);
INI_WriteInt("Info Car ID GAME", Approppriately[file]);
INI_WriteFloat("Info Float x", Approppriately[x]);
INI_WriteFloat("Info Float y", Approppriately[y]);
INI_WriteFloat("Info Float z", Approppriately[z]);
INI_WriteFloat("Info Angle", Approppriately[a]);
INI_WriteInt("Info Cor 1", Approppriately[c_]);
INI_WriteInt("Info Cor 2", Approppriately[c2_]);
INI_Save();
INI_Close();
strdel(Global, 0, 128);
INI_Open("Carros/MaxVehicles");
INI_WriteInt("Veiculos Criados", Approppriately[file]);
INI_Save();
INI_Close();
return 1;
}
public LOAD_CAR() {
INI_Open("Cars/MaxVehicles");
Approppriately[id] = INI_ReadInt("Veiculos Criados");
new n = 1;
while(n != -1) {
format(Global, 30, "Cars/%d.ini", n);
if(!fexist(Global)) break;
INI_Open(Global);
Approppriately[id] = INI_ReadInt("Info Car ID GAME");
Approppriately[u] = INI_ReadInt("Info Car ID");
Approppriately[x] = INI_ReadFloat("Info Float x");
Approppriately[y] = INI_ReadFloat("Info Float y");
Approppriately[z] = INI_ReadFloat("Info Float z");
Approppriately[a] = INI_ReadFloat("Info Angle");
Approppriately[c_] = INI_ReadInt("Info Cor 1");
Approppriately[c2_] = INI_ReadInt("Info Cor 2");
AddStaticVehicleEx(Approppriately[u], Approppriately[x], Approppriately[y], Approppriately[z], Approppriately[a], Approppriately[c_], Approppriately[c2_], 9999999);
n++;
}
return 1;
}
#if defined filterScriptUser
public OnFilterScriptInit() {
LOAD_CAR();
print("\n--------------------------------------\n");
print("FilterScript vehicleCreator.");
print("Atual update 1.0 from Jeffrey_Hatrix, thanks to Willian_Luigi");
printf("Veнculos carregados: %d", Approppriately[id]);
return print("\n--------------------------------------\n");
}
#else
#error Run this like a FilterScript, By:Willian_Luigi
#endif
Credits:
Jeffrey_Hatrix, FilterScript
Willian_Luigi, FilterScript idea
Zeex, ZCMD
Slick, SII
Jeffrey_Hatrix, FilterScript
Willian_Luigi, FilterScript idea
Zeex, ZCMD
Slick, SII