CMD:car(playerid, params[])
{
new String[128], nomecarro;
new Float:x, Float:y, Float:z;
if(sscanf(params, "s", nomecarro)) return SendClientMessage(playerid, Amarelo, "Use : /v [Nome do carro]");
new vehicle = GetVehicleModelIDFromName(nomecarro);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "Nome incorreto tente novamente !");
if(Veh[playerid][VehId] == -1)
{
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
else
{
DestroyVehicle(Veh[playerid][VehId]);
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
format(String, sizeof(String), "Voce criou um : %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid,Verde, String);
return 1;
}
A variavel tem que contem string para armazenar o nome do veiculo.
Att. DonSpeed |
new String[128], nomecarro[35];
PHP код:
|
CMD:car(playerid, params[])
{
new String[128], nomecarro[35];
new Float:x, Float:y, Float:z;
if(sscanf(params, "s", nomecarro)) return SendClientMessage(playerid, Amarelo, "Use : /v [Nome do carro]");
new vehicle = GetVehicleModelIDFromName(nomecarro);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "Nome incorreto tente novamente !");
if(Veh[playerid][VehId] == -1)
{
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
else
{
DestroyVehicle(Veh[playerid][VehId]);
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
format(String, sizeof(String), "Voce criou um : %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid,Verde, String);
return 1;
}
if(sscanf(params, "s[35]", nomecarro)) return SendClientMessage(playerid, Amarelo, "Use : /v [Nome do carro]");
PHP код:
|