03.04.2011, 11:23
Bem Eu Estou Criando Um Gamemode Com Base No Thug 2.6 So Que O /Trancar Nao Funfa e Os Carros Das Casas Nгo Trancam de Jeito Nenhum,E Outra Eles Nascem Sem Trancar
Agradeзo Desde Jб
Agradeзo Desde Jб
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, "Voce nгo tem um carro.");
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;
gCarLock[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 = gCarLock[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 ~r~Fechado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
LockCar(carid);
}
else if(PlayerInfo[playerid][pPHouseCarkey] == carid)
{
GameTextForPlayer(playerid, "~w~Veiculo da casa ~r~Fechado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[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 ~g~Aberto", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
UnLockCar(carid);
}
if (PlayerInfo[playerid][pPHouseCarkey] == carid)
{
GameTextForPlayer(playerid, "~w~Veiculo da casa ~g~aberto", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
UnLockCar(carid);
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, "/chave", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]) || PlayerToPoint(3, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
{
if(PlayerInfo[playerid][pPHousekey] == i)
{
if(HouseInfo[i][hLock] == 1)
{
HouseInfo[i][hLock] = 0;
GameTextForPlayer(playerid, "~w~Porta ~g~Aberto", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(HouseInfo[i][hLock] == 0)
{
HouseInfo[i][hLock] = 1;
GameTextForPlayer(playerid, "~w~Porta ~r~Fechado", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~ Vocк nгo tem a chave", 5000, 6);
return 1;
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(3, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) || PlayerToPoint(3, playerid,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
{
if(PlayerInfo[playerid][pPbiskey] == i)
{
if(BizzInfo[i][bLocked] == 1)
{
BizzInfo[i][bLocked] = 0;
GameTextForPlayer(playerid, "~w~Empresa ~g~Aberto", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(BizzInfo[i][bLocked] == 0)
{
BizzInfo[i][bLocked] = 1;
GameTextForPlayer(playerid, "~w~Empresa ~r~Fechada", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~Vocк nгo tem a chave", 5000, 6);
return 1;
}
}
}
for(new i = 0; i < sizeof(SBizzInfo); i++)
{
if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
{
if(PlayerInfo[playerid][pPbiskey] == i+100)
{
if(SBizzInfo[i][sbLocked] == 1)
{
SBizzInfo[i][sbLocked] = 0;
GameTextForPlayer(playerid, "~w~Empresa ~g~Aberta", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(SBizzInfo[i][sbLocked] == 0)
{
SBizzInfo[i][sbLocked] = 1;
GameTextForPlayer(playerid, "~w~Empresa ~r~Fechada", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~Voce nгo tem a chave", 5000, 6);
return 1;
}
}
}
}
return 1;
}
public OnGameModeInit()
{
for(new i=0; i<MAX_VEHICLES; i++)
{
gCarLock[i] = 1;
}
return 1;
}
public OnGameModeInit()
{
if(PlayerInfo[playerid][pPHousekey] >= 1)
{
gCarLock[playerid] = 1;
return 1;
}
return 1;
}
public OnGameModeInit()
{
for(new i=0; i<MAX_VEHICLES; i++)
{
if(PlayerInfo[i][pPHousekey] >= 1)
{
gCarLock[i] = 1;
return 1;
}
}
return 1;
}