Код:
if(newstate == 2)
{
for(new i = 0; i < sizeof(CarInfo); i++)
{
new newcar = GetPlayerVehicleID(playerid);
if(newcar == CarInfo[i][ownedvehicle])
{
if(CarInfo[i][cOwned]==0)
{
TogglePlayerControllable(playerid, 0);
CarOffered[playerid]=1;
format(gstring,sizeof(gstring),"~w~Carro: %s~n~Preco: ~g~%d~n~~w~/veiculo comprar para comprar",CarInfo[i][cDescription],CarInfo[i][cValue]);
GameTextForPlayer(playerid,gstring,1000,5);
SendClientMessage(playerid, COLOR_GRAD2, "USE: /sair para sair do carro!");
}
if(CarInfo[i][cOwned]==1)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(strcmp(playername,CarInfo[i][cOwner],true)==0)
{
format(gstring,sizeof(gstring),"Vocк entrou no seu carro ele tem %d de grana no porta luva. Use: /retirargrana para pegar.",CarInfo[i][cGrana]);
SendClientMessage(playerid, COLOR_GREY, gstring);
TogglePlayerControllable(playerid, 1);
}
else
{
format(gstring,sizeof(gstring),"Vocк pagou %d para andar no veiculo de %s",granacarro,CarInfo[i][cOwner]);
SendClientMessage(playerid, COLOR_GREY, gstring);
CarInfo[i][cGrana] += granacarro;
GivePlayerMoney(playerid, -granacarro);
}
}
}
}
}
Код:
if(strcmp(tmp, "comprar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pVIP] >= 1 && PlayerInfo[playerid][pSocio] >= 1)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк nгo й um jogador VIP/Socio");
return 1;
}
for(new i = 0; i < sizeof(CarInfo); i++)
{
if(CarInfo[i][ownedvehicle] == vehid)
{
if(PlayerInfo[playerid][pCarKey] != 0 && PlayerInfo[playerid][pVIP] < 1 && PlayerInfo[playerid][pSocio] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Sу pode ter 1 carro vip !");
return 1;
}
if(PlayerInfo[playerid][pCarKey2] != 0 && PlayerInfo[playerid][pSocio] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Sу pode ter 2 carros vip's !");
return 1;
}
if(CarInfo[i][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Este carro VIP/Socio jб tem dono");
return 1;
}
if(PlayerInfo[playerid][pCarKey] == 0)
{
if(GetPlayerMoney(playerid) >= CarInfo[i][cValue])
{
PlayerInfo[playerid][pCarKey] = i+totalveiculosc;
PlayerInfo[playerid][pVeiculo] = i;
CarInfo[i][cOwned] = 1;
CarOffered[playerid]=0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[i][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[i][cValue]);
GameTextForPlayer(playerid, "~w~Parabens~n~Voce comprou esse Carro VIP!", 5000, 3);
PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD2, "parabens pela sua compra !");
SendClientMessage(playerid, COLOR_GRAD2, "USE: /veiculo ajuda para ver os comandos");
TogglePlayerControllable(playerid, 1);
SaveCars();
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo tem dinheiro para isso!");
}
return 1;
}
if(PlayerInfo[playerid][pCarKey2] == 0)
{
if(PlayerInfo[playerid][pSocio] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "Apenas Sуcios podem ter dois carros vips.");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[i][cValue])
{
PlayerInfo[playerid][pCarKey2] = i+totalveiculosc;
PlayerInfo[playerid][pVeiculo2] = i;
CarInfo[i][cOwned] = 1;
CarOffered[playerid]=0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[i][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[i][cValue]);
GameTextForPlayer(playerid, "~w~Parabens~n~Voce comprou esse Carro Socio!", 5000, 3);
PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GRAD2, "parabens pela sua compra !");
SendClientMessage(playerid, COLOR_GRAD2, "USE: /veiculo ajuda para ver os comandos");
TogglePlayerControllable(playerid, 1);
SaveCars();
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo tem dinheiro para isso!");
}
return 1;
}
}
}
}
return 1;
}
Acho que й isso
nгo manjo muito, estou aprendendo ainda!