11.06.2014, 16:13
(
Последний раз редактировалось PabLoHenriique; 11.06.2014 в 18:23.
)
Olв pessoal que curte jogar um samp, hoje quero ser rapido e direto. Estou com um grande e unico sistema de concessionбria mais ele esta incompleto falta as 'scriptfiles' e mais sei lб oque, quero ajuda de vocкs para consertar este sistema legal de concessionбria pois ela nгo tem os veiculos na concessionбria pareзe atй uma concessionбria fantasma o cliente vai lб comprar um veiculo mais cada o produto? e desejo ajuda de vocкs, й um otima sistema de concessionбria й unico, nгo fico brabo se alguem pegar este sistema pois nгo vou conseguir consertarr entгo vou presisar de ajuda.
Код HTML:
enum cInfo
{
cModel,
Float:cLocationx,
Float:cLocationy,
Float:cLocationz,
Float:cAngle,
cColorOne,
cColorTwo,
cOwner[MAX_PLAYER_NAME],
cDescription[MAX_PLAYER_NAME],
cValue,
cLicense,
cRegistration,
cOwned,
cLock,
ownedvehicle,
};
new CarInfo[504][cInfo];
public OnPlayerRename(name[],string[],playerid)
{
{
if (ckey != 255 && strcmp(playername,CarInfo[ckey][cOwner],true) == 0)
{
strmid(CarInfo[ckey][cOwner],name,0,strlen(name),255);
}
OnPropUpdate();
}
}
public CheckOwner(playerid)
{
if(IsPlayerConnected(playerid))
{
for(new i = 1; i < sizeof(CarInfo); i++)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
if(strcmp(playername,CarInfo[i][cOwner],true)==0)
{
PlayerInfo[i][pCarro] = i;
return i;
}
}
}
return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
for(new i = 1; i < sizeof(CarInfo); i++)
{
if(newcar == CarInfo[i][ownedvehicle])
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new tgt[256];
if(CarInfo[i][cOwned]==0)
{
TogglePlayerControllable(playerid,0);
format(string,sizeof(string),"~g~Dono: %s~w~~n~Veiculo: %s~n~Preco: %d~n~~r~/auto comprar~n~~w~ou /sair",CarInfo[i][cOwner],CarInfo[i][cDescription],CarInfo[i][cValue]);
GameTextForPlayer(playerid,string,10000,5);
return 1;
}
if(strcmp(playername,CarInfo[i][cOwner],true) == 0)
{
format(tgt,sizeof(tgt),"Bem - Vindo ao seu veiculo %s , modelo: %s",CarInfo[i][cOwner],CarInfo[CheckOwner(playerid)][cDescription]);
SendClientMessage(playerid,COLOR_YELLOW,tgt);
return 1;
}
else
{
format(tgt,sizeof(tgt),"DONO: %s Modelo: %s",CarInfo[i][cOwner],CarInfo[i][cDescription]);
SendClientMessage(playerid,COLOR_YELLOW,tgt);
SendClientMessage(playerid,COLOR_WHITE,"Este carro nao e seu!");
RemovePlayerFromVehicle(playerid);
Descongelar(playerid);
}
}
}
}
public LoadCar()
{
new arrCoords[13][64];
new strFromFile2[256];
new File: file = fopen("Carros.cfg", io_read);
if (file)
{
new idx = 0;
while (idx < sizeof(CarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
CarInfo[idx][cModel] = strval(arrCoords[0]);
CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
CarInfo[idx][cColorOne] = strval(arrCoords[5]);
CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
CarInfo[idx][cValue] = strval(arrCoords[9]);
CarInfo[idx][cLicense] = strval(arrCoords[10]);
CarInfo[idx][cOwned] = strval(arrCoords[11]);
CarInfo[idx][cLock] = strval(arrCoords[12]);
printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
idx++;
}
}
return 1;
}
public SaveCars()
{
new idx;
new File: file2;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d\n",
CarInfo[idx][cModel],
CarInfo[idx][cLocationx],
CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],
CarInfo[idx][cColorOne],
CarInfo[idx][cColorTwo],
CarInfo[idx][cOwner],
CarInfo[idx][cDescription],
CarInfo[idx][cValue],
CarInfo[idx][cLicense],
CarInfo[idx][cOwned],
CarInfo[idx][cLock]);
if(idx == 0)
{
file2 = fopen("Carros.cfg", io_write);
}
else
{
file2 = fopen("Carros.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
public OnGameModeInit()
{
for(new i = 0; i < sizeof(CarInfo); i++)//Spawn carro para comprar
{
CarInfo[i][ownedvehicle] = CreateVehicle(CarInfo[i][cModel],CarInfo[i][cLocationx],CarInfo[i][cLocationy],CarInfo[i][cLocationz],CarInfo[i][cAngle],CarInfo[i][cColorOne],CarInfo[i][cColorTwo],300000);
}
SetTimer("CheckOwner",5000,1);
}
//--------------------------------------------------------------------//
if(strcmp(tmp,"comprar",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(SBizzInfo[23][sbProdutos] == 0)
{
GameTextForPlayer(playerid,"~r~Falta Produto na empresa",5000,1);
return 1;
}
for(new i = 0; i < sizeof(CarInfo); i++)
{
if(CarInfo[i][ownedvehicle] == vehid)
{
if(PlayerInfo[playerid][pCarro]!=255)
{
SendClientMessage(playerid,COLOR_WHITE, "Vocк ja possui um carro!");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessage(playerid,COLOR_WHITE, "Vocк precisa ter nivel 3 para ter um carro!");
return 1;
}
if(CarInfo[i][cOwned]==1)
{
SendClientMessage(playerid,COLOR_WHITE, "Este carro ja tem dono!");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[i][cValue])
{
PlayerInfo[playerid][pCarro] = i;
CarInfo[i][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[i][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoneyEx(playerid,-CarInfo[i][cValue]);
GameTextForPlayer(playerid,"Parabens Pelo Seu carro",5000,3);
SendClientMessage(playerid,COLOR_WHITE, "Duvidas use /auto manual");
TogglePlayerControllable(playerid,1);
SBizzInfo[23][sbTill] += CarInfo[i][cValue];
SBizzInfo[23][sbProdutos]--;
SaveCars();
OnPropUpdate();
OnPlayerUpdate(playerid);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_WHITE, "Vocк nao tem dinheiro suficiente!");
return 1;
}
}
}
}
return 1;
}
if(strcmp(tmp,"vender",true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pCarro] == 255)
{
SendClientMessage(playerid,COLOR_WHITE,"Vocк nгo tem um veiculo!");
return 1;
}
if(Concessionaria(playerid))
{
if(PlayerInfo[playerid][pCarro] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pCarro]][cOwner], true) == 0)
{
new carro = PlayerInfo[playerid][pCarro];
CarInfo[carro][cOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[carro][cOwner], "Concessionaria", 0, strlen("Concessionaria"), 999);
GivePlayerMoneyEx(playerid,CarInfo[carro][cValue]/2);
SBizzInfo[23][sbTill] -= CarInfo[carro][cValue]/2;
format(string, sizeof(string), "~w~Parabens, Voce vendeu o carro por: ~n~~g~%d", CarInfo[carro][cValue]/2);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
PlayerInfo[playerid][pCarro] = 255;
SaveCars();
OnPropUpdate();
OnPlayerUpdate(playerid);
return 1;
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"Voce tem que estar na concessionaria para vender o seu veiculo!");
return 1;
}
}
return 1;
}
//--------------------------------------------------------------------//
if(strcmp(cmd,"/AdmVcarro",true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid,playername,sizeof(playername));
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GRAD1,"USE: /AdmVcarro [ID do carro]");
return 1;
}
new carro = strval(tmp);
if(PlayerInfo[playerid][pAdmin] >= 1300)
{
CarInfo[carro][cOwned] = 0;
strmid(CarInfo[carro][cOwner],"Concessionaria",0,strlen("Concessionaria"),255);
format(string,sizeof(string),"~w~Voce vendeu o carro");
GameTextForPlayer(playerid,string,10000,3);
OnPropUpdate();
return 1;
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"Vocк nгo й um administrador!");
}
}
return 1;
}