#define MAX_VEHICLES (1500) #define totalveiculos 703 // Carros Normais #define totalveiculosh 704 // Carros Normais + 1 #define totalveiculosc 944 // Carros Normais + CARROS DAS CASAS #define CAR_AMOUNT 945 // TODOS OS CARROS + 1
Se voce acha q й o comando /trancar entao manda o comando nao as defines...
ps: й BUG e nгo BU'L'G |
Se voce acha q й o comando /trancar entao manda o comando nao as defines...
ps: й BUG e nгo BU'L'G |
if(strcmp(cmd, "/trancar", true) == 0) { if(IsPlayerConnected(playerid)) { new carid; if (gTeam[playerid] == 2 || gTeam[playerid] == 1) { if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255) { SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem um carro de casa/alugado."); return 1; } else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPHousekey]+totalveiculos) { if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] > 0) { gLastDriver[HireCar[playerid]] = 300; VTrancado[HireCar[playerid]] = 0; UnLockCar(HireCar[playerid]); } HireCar[playerid] = gLastCar[playerid]; } } if (PlayerInfo[playerid][pPHousekey] == 255) { if(HireCar[playerid] == 0) { SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro."); return 1; } } carid = PlayerInfo[playerid][pPHousekey]+totalveiculosh; if(HireCar[playerid] > 0 && !SwitchKey[playerid]) { carid = HireCar[playerid]; } //new driver = gLastDriver[carid]; new lockstatus = VTrancado[carid]; new Float:cx,Float:cy,Float:cz; GetVehiclePos(carid, cx, cy, cz); switch (lockstatus) { case 0: { if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255) { SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro"); return 1; } if(HireCar[playerid] == carid && !SwitchKey[playerid]) { GameTextForPlayer(playerid, "~w~Veiculo Alugado ~n~~r~Fechado", 5000, 6); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); VTrancado[carid] = 1; LockCar(carid); } else if(PlayerInfo[playerid][pPHouseCarkey] == carid) { GameTextForPlayer(playerid, "~w~Veiculo da Casa ~n~~r~Fechado", 5000, 6); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); VTrancado[carid] = 1; LockCar(carid); return 1; } } case 1: { if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255) { SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro"); return 1; } if(HireCar[playerid] == carid && !SwitchKey[playerid]) { GameTextForPlayer(playerid, "~w~Veiculo Alugado~g~Aberto", 5000, 6); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); VTrancado[carid] = 0; UnLockCar(carid); SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); } if (PlayerInfo[playerid][pPHouseCarkey] == carid) { GameTextForPlayer(playerid, "~w~Veiculo da Casa ~n~~g~Aberto", 5000, 6); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); VTrancado[carid] = 0; UnLockCar(carid); SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); return 1; } } default: { SendClientMessage(playerid, COLOR_GRAD2, "Erro"); } } if(carid == 256) { SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro!"); } } return 1; } |
if(!strcmp(cmd, "/trancar", true))
{
for(new i; i != MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(3.0, playerid, i);
if(dist)
{
if(HireCar[playerid] == i && VTrancado[i] == 0)
{
GameTextForPlayer(playerid, "~w~Veiculo Alugado ~n~~r~Fechado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 1;
LockCar(carid);
}
else if(PlayerInfo[playerid][pPHouseCarkey] == i && VTrancado[i] == 0)
{
GameTextForPlayer(playerid, "~w~Veiculo da Casa ~n~~r~Fechado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 1;
LockCar(carid);
return 1;
}
else if(HireCar[playerid] == i && VTrancado[i] == 1)
{
GameTextForPlayer(playerid, "~w~Veiculo Alugado ~n~~g~Destrancado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 0;
UnLockCar(carid);
}
else if(PlayerInfo[playerid][pPHouseCarkey] == i && VTrancado[i] == 0)
{
GameTextForPlayer(playerid, "~w~Veiculo da Casa ~n~~g~Destrancado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 0;
UnLockCar(carid);
return 1;
}
else return SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem as chaves deste veiculo");
}
else return SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo esta proximo de nenhum veiculo");
return 1;
}
pawn Код:
Fiz agr sem testar qq coisa avisa |
if(strcmp(cmd, "/trancar", true) == 0)
{
if(IsPlayerConnected(playerid)) {
new carid;
if (gTeam[playerid] == 2 || gTeam[playerid] == 1) {
if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255) {
SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem um carro de casa/alugado.");
return true;
}
else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPHousekey]+totalveiculos) {
if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] > 0) {
gLastDriver[HireCar[playerid]] = 300;
VTrancado[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
}
HireCar[playerid] = gLastCar[playerid];
}
}
if (PlayerInfo[playerid][pPHousekey] == 255) {
if(HireCar[playerid] == 0) {
SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro.");
return true;
}
}
carid = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
if(HireCar[playerid] > 0 && !SwitchKey[playerid]) {
carid = HireCar[playerid];
}
new driver = gLastDriver[carid];
new lockstatus = VTrancado[carid];
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(carid, cx, cy, cz);
switch (lockstatus) {
case 0:
{
if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255) {
SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
return true;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid]) {
GameTextForPlayer(playerid, "~w~Veiculo Alugado ~n~~r~Fechado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 1;
LockCar(carid);
}
else if(PlayerInfo[playerid][pPHouseCarkey] == carid) {
GameTextForPlayer(playerid, "~w~Veiculo da Casa ~n~~r~Fechado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 1;
LockCar(carid);
return true;
}
}
case 1:
{
if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255) {
SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
return true;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid]) {
GameTextForPlayer(playerid, "~w~Veiculo Alugado~g~Aberto", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 0;
UnLockCar(carid);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
}
if (PlayerInfo[playerid][pPHouseCarkey] == carid) {
GameTextForPlayer(playerid, "~w~Veiculo da Casa ~n~~g~Aberto", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
VTrancado[carid] = 0;
UnLockCar(carid);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
return true;
}
}
default:
{
SendClientMessage(playerid, COLOR_GRAD2, "Erro");
}
}
if(carid == 256) {
SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro!");
}
return true;
}
return true;
}