[FS] Sistema De Concessionaria Simples - Vict9r - 28/09/2020
- So estou postando por que tem muita pessoa que ainda não sabe fazer.
COMANDOS: /estacionar /pegarcarro /conce
Código: #include <a_samp>
#include <DOF2>
#include <zcmd>
#include <sscanf2>
#define PATH "CarrosSalvos"
new SVCarPLAYER[MAX_PLAYERS];
new BuyCarCk[MAX_VEHICLES];
public OnFilterScriptInit()
{
print("\n ====================================================================");
print(" | |");
print(" | FilterScript Concessionaria DOF2 Version 0.1 Started... |");
print(" | |");
print(" | * Creator:Vict9r. * |");
print(" | |");
print(" ====================================================================\n");
//========[ Concessionaria ]======||
AddStaticPickup(1274, 1, 2131.4729,-1149.9431,24.2078) ;
Create3DTextLabel("Concessionaria (LS)\n/conce", 0x00FCFCFF, 2131.4729,-1149.9431,24.2078, 30.0, 0);
return 1;
}
public OnFilterScriptExit()
{
DOF2_Exit();
return 1;
}
public OnPlayerConnect(playerid)
{
DestroyVehicle(SVCarPLAYER[playerid]);
SVCarPLAYER[playerid] = 0;
BuyCarCk[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyVehicle(SVCarPLAYER[playerid]);
return 1;
}
CMD:conce(playerid, params[])
{
new item[16];
new DIALOGCONCE[550],string[250];
if(!sscanf(params, "s[550]", item))
{
if(strcmp(item,"462", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, -1, "Voce nao tem R$5000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -5000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(462,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"463", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 10500) return SendClientMessage(playerid, -1, "Voce nao tem R$10500.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -10500);
SVCarPLAYER[playerid] = AddStaticVehicleEx(463,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"468", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 45000) return SendClientMessage(playerid, -1, "Voce nao tem R$45000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -45000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(468,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"410", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 25000) return SendClientMessage(playerid, -1, "Voce nao tem R$25000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -25000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(410,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"412", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 30000) return SendClientMessage(playerid, -1, "Voce nao tem R$30000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -30000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(412,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"415", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 45000) return SendClientMessage(playerid, -1, "Voce nao tem R$45000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -45000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(415,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
SendClientMessage(playerid, -1, "Esse veiculo nao esta disponivel na concessionaria!!");
return 1;
}
format(string,sizeof(string),"{FFFFFF}De /conce [ID DO VEICULO!] para comprar\n\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"462 - Faggio ({00CC00}R$5000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"463 - Freeway ({00CC00}R$10500{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"468 - Sanchez ({00CC00}R$45000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"410 - Manana ({00CC00}R$25000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"412 - Voodoo ({00CC00}R$30000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"415 - Cheetah ({00CC00}R$45000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_MSGBOX, "Model Veiculos", DIALOGCONCE, "OK", "Sair");
return 1;
}
CMD:estacionar(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Você não está em um carro!");
new path[50], SCCarid, Float:PosSC[4];
SCCarid = GetPlayerVehicleID(playerid);
if(BuyCarCk[SCCarid] != playerid) return SendClientMessage(playerid, 0xFF0000FF, "Este carro não é seu, ou não foi comprado!");
path = SaveCarNomePlay(playerid);
if(!DOF2_FileExists(path)) DOF2_CreateFile(path);
GetVehiclePos(SCCarid, PosSC[0],PosSC[1],PosSC[2]);
GetVehicleZAngle(SCCarid, PosSC[3]);
DOF2_SetInt(path,"CarID",GetVehicleModel(GetPlayerVehicleID(playerid)));
DOF2_SetFloat(path,"PosX",PosSC[0]);
DOF2_SetFloat(path,"PosY",PosSC[1]);
DOF2_SetFloat(path,"PosZ",PosSC[2]);
DOF2_SetFloat(path,"PosA",PosSC[3]);
DOF2_SaveFile();
DestroyVehicle(SVCarPLAYER[playerid]);
SVCarPLAYER[playerid] = 0;
BuyCarCk[playerid] = 0;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo estacionado, de /pegarcarro para spawnar ele novamente!");
return 1;
}
CMD:pegarcarro(playerid, params[])
{
if(SVCarPLAYER[playerid] != 0) return SendClientMessage(playerid, 0xFF0000FF, "você ja pegou o seu carro!");
new path[50], SCCarid, Float:PosSC[4];
path = SaveCarNomePlay(playerid);
SCCarid = DOF2_GetInt(path,"CarID");
PosSC[0] = DOF2_GetFloat(path,"PosX");
PosSC[1] = DOF2_GetFloat(path,"PosY");
PosSC[2] = DOF2_GetFloat(path,"PosZ");
PosSC[3] = DOF2_GetFloat(path,"PosA");
DestroyVehicle(SVCarPLAYER[playerid]);
SVCarPLAYER[playerid] = AddStaticVehicleEx(SCCarid,PosSC[0],PosSC[1],PosSC[2],PosSC[3],0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SetPlayerCheckpoint (playerid, PosSC[0],PosSC[1],PosSC[2], 3.0);
SendClientMessage(playerid, 0xFF0000FF, "Seu carro está no local estacionado!");
return 1;
}
SaveCarNomePlay(playerid)
{
new name[24], full[50];
GetPlayerName(playerid,name,sizeof(name));
format(full,sizeof(full),"%s/%s.txt",PATH,name);
return full;
}
RE: [FS] Sistema De Concessionaria Simples - RosaScripter - 28/09/2020
(28/09/2020 20:11)Vict9r Escreveu:
- So estou postando por que tem muita pessoa que ainda não sabe fazer.COMANDOS: /estacionar /pegarcarro /conce
Código: #include <a_samp>
#include <DOF2>
#include <zcmd>
#include <sscanf2>
#define PATH "CarrosSalvos"
new SVCarPLAYER[MAX_PLAYERS];
new BuyCarCk[MAX_VEHICLES];
public OnFilterScriptInit()
{
print("\n ====================================================================");
print(" | |");
print(" | FilterScript Concessionaria DOF2 Version 0.1 Started... |");
print(" | |");
print(" | * Creator:Vict9r. * |");
print(" | |");
print(" ====================================================================\n");
//========[ Concessionaria ]======||
AddStaticPickup(1274, 1, 2131.4729,-1149.9431,24.2078) ;
Create3DTextLabel("Concessionaria (LS)\n/conce", 0x00FCFCFF, 2131.4729,-1149.9431,24.2078, 30.0, 0);
return 1;
}
public OnFilterScriptExit()
{
DOF2_Exit();
return 1;
}
public OnPlayerConnect(playerid)
{
DestroyVehicle(SVCarPLAYER[playerid]);
SVCarPLAYER[playerid] = 0;
BuyCarCk[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyVehicle(SVCarPLAYER[playerid]);
return 1;
}
CMD:conce(playerid, params[])
{
new item[16];
new DIALOGCONCE[550],string[250];
if(!sscanf(params, "s[550]", item))
{
if(strcmp(item,"462", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, -1, "Voce nao tem R$5000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -5000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(462,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"463", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 10500) return SendClientMessage(playerid, -1, "Voce nao tem R$10500.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -10500);
SVCarPLAYER[playerid] = AddStaticVehicleEx(463,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"468", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 45000) return SendClientMessage(playerid, -1, "Voce nao tem R$45000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -45000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(468,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"410", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 25000) return SendClientMessage(playerid, -1, "Voce nao tem R$25000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -25000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(410,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"412", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 30000) return SendClientMessage(playerid, -1, "Voce nao tem R$30000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -30000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(412,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
else if(strcmp(item,"415", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2131.4729,-1149.9431,24.2078)) // 24/7
{
if(GetPlayerMoney(playerid) < 45000) return SendClientMessage(playerid, -1, "Voce nao tem R$45000.");
DestroyVehicle(SVCarPLAYER[playerid]);
GivePlayerMoney(playerid, -45000);
SVCarPLAYER[playerid] = AddStaticVehicleEx(415,2124.9561,-1132.2983,25.4612+5.0,350.3899,0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo Comprado com sucesso!");
return 1;
}
}
SendClientMessage(playerid, -1, "Esse veiculo nao esta disponivel na concessionaria!!");
return 1;
}
format(string,sizeof(string),"{FFFFFF}De /conce [ID DO VEICULO!] para comprar\n\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"462 - Faggio ({00CC00}R$5000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"463 - Freeway ({00CC00}R$10500{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"468 - Sanchez ({00CC00}R$45000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"410 - Manana ({00CC00}R$25000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"412 - Voodoo ({00CC00}R$30000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
format(string,sizeof(string),"415 - Cheetah ({00CC00}R$45000{FFFFFF})\n");
strcat(DIALOGCONCE, string);
ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_MSGBOX, "Model Veiculos", DIALOGCONCE, "OK", "Sair");
return 1;
}
CMD:estacionar(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Você não está em um carro!");
new path[50], SCCarid, Float:PosSC[4];
SCCarid = GetPlayerVehicleID(playerid);
if(BuyCarCk[SCCarid] != playerid) return SendClientMessage(playerid, 0xFF0000FF, "Este carro não é seu, ou não foi comprado!");
path = SaveCarNomePlay(playerid);
if(!DOF2_FileExists(path)) DOF2_CreateFile(path);
GetVehiclePos(SCCarid, PosSC[0],PosSC[1],PosSC[2]);
GetVehicleZAngle(SCCarid, PosSC[3]);
DOF2_SetInt(path,"CarID",GetVehicleModel(GetPlayerVehicleID(playerid)));
DOF2_SetFloat(path,"PosX",PosSC[0]);
DOF2_SetFloat(path,"PosY",PosSC[1]);
DOF2_SetFloat(path,"PosZ",PosSC[2]);
DOF2_SetFloat(path,"PosA",PosSC[3]);
DOF2_SaveFile();
DestroyVehicle(SVCarPLAYER[playerid]);
SVCarPLAYER[playerid] = 0;
BuyCarCk[playerid] = 0;
SendClientMessage(playerid, 0xFF0000FF, "Veiculo estacionado, de /pegarcarro para spawnar ele novamente!");
return 1;
}
CMD:pegarcarro(playerid, params[])
{
if(SVCarPLAYER[playerid] != 0) return SendClientMessage(playerid, 0xFF0000FF, "você ja pegou o seu carro!");
new path[50], SCCarid, Float:PosSC[4];
path = SaveCarNomePlay(playerid);
SCCarid = DOF2_GetInt(path,"CarID");
PosSC[0] = DOF2_GetFloat(path,"PosX");
PosSC[1] = DOF2_GetFloat(path,"PosY");
PosSC[2] = DOF2_GetFloat(path,"PosZ");
PosSC[3] = DOF2_GetFloat(path,"PosA");
DestroyVehicle(SVCarPLAYER[playerid]);
SVCarPLAYER[playerid] = AddStaticVehicleEx(SCCarid,PosSC[0],PosSC[1],PosSC[2],PosSC[3],0,0,-1);
BuyCarCk[SVCarPLAYER[playerid]] = playerid;
SetPlayerCheckpoint (playerid, PosSC[0],PosSC[1],PosSC[2], 3.0);
SendClientMessage(playerid, 0xFF0000FF, "Seu carro está no local estacionado!");
return 1;
}
SaveCarNomePlay(playerid)
{
new name[24], full[50];
GetPlayerName(playerid,name,sizeof(name));
format(full,sizeof(full),"%s/%s.txt",PATH,name);
return full;
}
Faz uma versão mas completa, Como por exemplo: /vender carro, sistema de emplacamento e salvamento de tunning
RE: [FS] Sistema De Concessionaria Simples - Gabrielscripter - 28/09/2020
Muito util victor vlw tava precisando
RE: [FS] Sistema De Concessionaria Simples - Gomes - 28/09/2020
Muito bom e útil, parabéns.
RE: [FS] Sistema De Concessionaria Simples - Sr.Rick - 29/09/2020
boa galera isso ai, otimo codigo!
RE: [FS] Sistema De Concessionaria Simples - ChaRaDa_Fox - 29/09/2020
Como faz pro player trancar o seu carro e destrancar ?
RE: [FS] Sistema De Concessionaria Simples - Vict9r - 30/09/2020
(29/09/2020 21:46)ChaRaDa_Fox Escreveu: Como faz pro player trancar o seu carro e destrancar ?
Código: CMD:trancar(playerid, params[])
{
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
new testcar;
if(sscanf(params, "d", testcar))
{
new counter = 0;
new result;
for(new i; i != MAX_VEHICLES; i++)
{
new dist = ChecarveiculoBORP(5, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, vermelho, "[BORP]{FFFFFF}Nao ha nenhum carro perto de voce!");
}
case 1:
{
GetVehicleParamsEx(result, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(result, engine, lights, alarm, VEHICLE_PARAMS_ON, bonnet, boot, objective);
SendClientMessage(playerid, -1, "[Veiculo]{33CC33}Trancado");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
default:
{
SendClientMessage(playerid, vermelho, "[BORP]{FFFFFF}Foram encontrados mais de um carro nesse local");
}
}
return true;
}
return 1;
}
CMD:destrancar(playerid, params[])
{
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
new testcar;
if(sscanf(params, "d", testcar))
{
new counter = 0;
new result;
for(new i; i != MAX_VEHICLES; i++)
{
new dist = ChecarveiculoBORP(5, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, vermelho, "[BORP]{FFFFFF}Nao ha nenhum carro perto de voce!");
}
case 1:
{
GetVehicleParamsEx(result, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(result, engine, lights, alarm, VEHICLE_PARAMS_OFF, bonnet, boot, objective);
SendClientMessage(playerid, -1, "[Veiculo]{FF0000}Destrancado");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
default:
{
SendClientMessage(playerid, vermelho, "[BORP]{FFFFFF}Foram encontrados mais de um carro nesse local");
}
}
return true;
}
return 1;
}
stock ChecarveiculoBORP(Float:radi, playerid, vehicleid)
{
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, radi, x, y, z))
return 1;
return 0;
}
RE: [FS] Sistema De Concessionaria Simples - Rio - 30/09/2020
ta Top Vict9r +rep
RE: [FS] Sistema De Concessionaria Simples - Gabriel - 30/09/2020
Muito legal mano, bom FS!
RE: [FS] Sistema De Concessionaria Simples - IW_Notscriper - 19/11/2020
Muito bom +rep mais poderia me passar o comando /vendercarro
|