CMD:vs(playerid, params[])
{
new carName[100];
if(sscanf(params, "s[100]", carName)) return SendClientMessage(playerid, 0xa9c4e4ff, "{1fd80a}[USE]: {e00808}/VS {1fd80a}[NOME DO VEICULO]");
else if(ReturnVehicleID(carName) == INVALID_VEHICLE_ID) return SendClientMessage(playerid, 0xa9c4e4ff, "{fc0a0a}[ERRO]: Veiculo nao encontrado, tente novamente!");
}
new Float:pPos[4], vid;
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
vid = CreateVehicle(ReturnVehicleID(carName), pPos[0], pPos[1], pPos[2] + 1.00, pPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, vid, 0);
}
return 1;
}
new
bool:playerVehicle[MAX_PLAYERS char],
vehicleID_[MAX_PLAYERS]
;
COMMAND:vh(playerid, params[])
{
new vehicleID;
if(!sscanf(params, "d", vehicleID))
{
playerVehicle{playerid} ^= true;
DestroyVehicle(vehicleID_[playerid]);
new Float:playerPos[4];
GetPlayerPos(playerid, playerPos[0], playerPos[1], playerPos[2]);
GetPlayerFacingAngle(playerid, playerPos[3]);
vehicleID_[playerid] = CreateVehicle(vehicleID, playerPos[0], playerPos[1], playerPos[2] + 1.00, playerPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, vehicleID_[playerid], 0);
}
else
return SendClientMessage(playerid, -1, "[ERRO]: Parвmetros incorretos.");
return true;
}
COMMAND:vh(playerid, params[])
{
new vehicleID;
if(!sscanf(params, "d", vehicleID))
{
if(playerVehicle{playerid})
{
DestroyVehicle(vehicleID_[playerid]);
playerVehicle{playerid} = false;
}
new Float:playerPos[4];
GetPlayerPos(playerid, playerPos[0], playerPos[1], playerPos[2]);
GetPlayerFacingAngle(playerid, playerPos[3]);
vehicleID_[playerid] = CreateVehicle(vehicleID, playerPos[0], playerPos[1], playerPos[2] + 1.00, playerPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, vehicleID_[playerid], 0);
playerVehicle{playerid} = true;
}
else
return SendClientMessage(playerid, -1, "[ERRO]: Parвmetros incorretos.");
return true;
}
//topo da GM
new pVehCriado[MAX_PLAYERS];
new bool:pVeh[MAX_PLAYERS];
//OnPlayerDisconect caso queira que o veiculo seja deletado ao desconectar
DestroyVehicle(pVeh[playerid]);
pVehCriado[playerid] = false;
//comando para criar veiculos
CMD:cv(playerid, params[])
{
new Modelo, Color[2], Float:Pos[4];
if(sscanf(params, "ddd", Modelo, Color[0], Color[1]))
return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Use: /CV [Modelo] [Color1] [Color2]"); // se nгo colocar os parametros ou digitar sem colocar algum manda uma msg de erro!
if(Modelo < 400 || Modelo > 611)
return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Veнculo Invalido!");
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); // Pega a posiзгo do player
GetPlayerFacingAngle(playerid, Pos[3]); // Pega o angulo do player
SendClientMessage(playerid, 0xFF8040AA, "| INFO | Veнculo criado com sucesso!");
if(pVehCriado[playerid]) //aqui verifica se o jogador ja criou um veiculo..
{ //caso ja tenha criado ..
DestroyVehicle(pVeh[playerid]);
pVeh[playerid] = CreateVehicle(Modelo, Pos[0], Pos[1], Pos[2], Pos[3], Color[0], Color[1], -1); // Cria o veнculo: -1 = tempo de respawn.
SetVehicleVirtualWorld(pVeh[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, pVeh[playerid], 0); // Colocar o player dentro do veнculo
}
else
{ //caso nгo tenha criado um
pVehCriado[playerid] = true;
pVeh[playerid] = CreateVehicle(Modelo, Pos[0], Pos[1], Pos[2], Pos[3], Color[0], Color[1], -1); // Cria o veнculo: -1 = tempo de respawn.
SetVehicleVirtualWorld(pVeh[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, pVeh[playerid], 0); // Colocar o player dentro do veнculo
}
return 1;
}
//topo da GM
new VehID[MAX_PLAYERS];
new bool:VehCriado[MAX_PLAYERS];
CMD:vs(playerid, params[])
{
new carName[100];
if(sscanf(params, "s[100]", carName)) return SendClientMessage(playerid, 0xa9c4e4ff, "{1fd80a}[USE]: {e00808}/VS {1fd80a}[NOME DO VEICULO]");
if(ReturnVehicleID(carName) == INVALID_VEHICLE_ID) return SendClientMessage(playerid, 0xa9c4e4ff, "{fc0a0a}[ERRO]: Veiculo nao encontrado, tente novamente!");
if(VehCriado[playerid]) //verificar se ja foi criado, caso seja, apagara. e continuara
{
DestroyVehicle(VehID[playerid]);
}
new Float:pPos[4];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
VehID[playerid] = CreateVehicle(ReturnVehicleID(carName), pPos[0], pPos[1], pPos[2] + 1.00, pPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, VehID[playerid], 0);
return 1;
}
Se te ajudei clica na estrela abaixo do meu perfil, nгo tenho nenhuma :/ |