Nome -
Sti - 04.03.2015
Olб, Eu tentei colocar pra quando o admin criar um vйiculo aparecesse o nome dele, porйm nгo da certo, Nгo aparece nada.
Код:
if( !strcmp( cmd, "/Cv", true ) || !strcmp( cmd, "/cv", true ))
{
if( aInfo[ playerid ][ Admin ] == 1 || aInfo[ playerid ][ Gerente ] == 1 )
{
tmp = strtok( cmdtext, idx );
if( !strlen( tmp ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Uso correto: /Cv [ ID ou Nome ] [ Cor1 ] [ Cor2 ]" );
return 1;
}
if( ParticipandoEvento[ playerid ] == 1 || epDM[ playerid ][ dmParticipando ] == 1 )
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Vocк nгo pode criar veiculos no evento!" );
return 1;
}
new
veiculo = GetVehicleModelID( tmp )
;
if( veiculo == -1 )
{
veiculo = strval( tmp );
if( veiculo < 400 || veiculo > 611 )
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Somente ID de 400 а 611 !" );
return 1;
}
}
tmp = strtok( cmdtext, idx );
if( !strlen( tmp ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Uso correto: /Cv [ ID ou Nome ] [ Cor1 ] [ Cor2 ]" );
return 1;
}
new
cor1 = strval( tmp )
;
tmp = strtok( cmdtext, idx );
if( !strlen( tmp ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Uso correto: /Cv [ ID ou Nome ] [ Cor1 ] [ Cor2 ]" );
return 1;
}
new
cor2 = strval( tmp )
;
new
Float:x, Float:y, Float:z, Float:a
;
GetPlayerPos( playerid, x, y, z );
GetPlayerFacingAngle( playerid, a );
vehid = CreateVehicle( veiculo, x, y, z, a, cor1, cor2, -1 );
LinkVehicleToInterior( vehid, GetPlayerInterior( playerid ));
PutPlayerInVehicle( playerid, vehid, 0 );
new s[50],n[24];
GetPlayerName(playerid, n, 24);
format(s, 50, "Veiculo de %s [%d]", n, playerid);
textdrr = Create3DTextLabel(s, -1, 0.0, 0.0, 0.0, 30.0, 0, 1 );
Attach3DTextLabelToVehicle( textdrr, Vehicle[playerid], 0.0, 0.0, 2.0);
PlayerPlaySound( playerid, 1133, 0.0, 0.0, 0.0 );
format( string, sizeof( string ), "[ NVL Admin ] Veнculo %s criado com sucesso {FF0000}( NГO ESQUEЗA DE EXCLUIR )!", vNome[ GetVehicleModel( vehid ) - 400 ] );
SendClientMessage( playerid, 0x00FF66AA, string );
}
return 1;
}
Re: Nome -
MarlboroBr - 04.03.2015
LOL, o seu comando estб que nem o meu aqui, e o mesmo cуdigo kkk'...
Ai vк se da certo, deixei que nem estб no seu GM:
Obs: ( Para ver o nome do veнculo tente o "/vnome" e para ver o id tente "/vid"
PHP код:
if( !strcmp( cmd, "/criarveiculo", true ) || !strcmp( cmd, "/cv", true ))
{
if( aInfo[ playerid ][ Gerente ] == 1 || aInfo[ playerid ][ Admin ] == 1 )
{
tmp = strtok( cmdtext, idx );
if( !strlen( tmp ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Uso correto: /CriarVeiculo [ ID ou Nome ] [ Cor1 ] [ Cor2 ]" );
return 1;
}
new
veiculo = GetVehicleModelID( tmp )
;
if( veiculo == -1 )
{
veiculo = strval( tmp );
if( veiculo < 400 || veiculo > 611 )
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Somente ID de 400 а 611 !" );
return 1;
}
}
tmp = strtok( cmdtext, idx );
if( !strlen( tmp ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Uso correto: /CriarVeiculo [ ID ou Nome ] [ Cor1 ] [ Cor2 ]" );
return 1;
}
new
cor1 = strval( tmp )
;
tmp = strtok( cmdtext, idx );
if( !strlen( tmp ))
{
SendClientMessage( playerid, COLOR_ERRO, "[ x ] Uso correto: /CriarVeiculo [ ID ou Nome ] [ Cor1 ] [ Cor2 ]" );
return 1;
}
new
cor2 = strval( tmp )
;
new
Float:x, Float:y, Float:z, Float:a
;
GetPlayerPos( playerid, x, y, z );
GetPlayerFacingAngle( playerid, a );
vehid = CreateVehicle( veiculo, x, y, z, a, cor1, cor2, -1 );
LinkVehicleToInterior( vehid, GetPlayerInterior( playerid ));
PutPlayerInVehicle( playerid, vehid, 0 );
PlayerPlaySound( playerid, 1133, 0.0, 0.0, 0.0 );
format( string, sizeof( string ), "[ NVL ADMIN ] Veнculo %s criado com sucesso !", vNome[ GetVehicleModel( vehid ) - 400 ] );
SendClientMessage( playerid, 0x00FF66AA, string );
}
return 1;
}
Re: Nome -
FStralioti - 04.03.2015
https://sampforum.blast.hk/showthread.php?tid=344000
Re : Nome -
Sti - 04.03.2015
Exemplo, Quando vocк criar vai aparecer
[ > ] Carro criado por um admin.
Em Textlabel.
Assim
http://master-pic.de/bild.php/22982,textlabelLYEMN.jpg
Re: Nome -
Cidiei - 04.03.2015
@Edit
Re : Nome -
Sti - 04.03.2015
Alguйm?
Re: Nome -
arakuta - 05.03.2015
Vocк pode criar uma matriz contendo o nome de todos os veнculos:
Por exemplo:
PHP код:
new VehicleName[3][18] =
{
"Landstalker","Bravura","Buffalo"
};
E entгo usar um algoritmo simples, onde a linha que contйm o nome do veнculo й
modelo - 400, portanto modelo 400 estarб na linha 0, 401 na linha 1 e assim por diante.
Pois o menor modelo de veнculo й 400.
PHP код:
new model = 400;
printf("Modelo: %d | Nome: %s",model,VehicleName[model - 400]);
Printarб algo similar a:
Код:
Modelo: 400 | Nome: Landstalker
Sugiro que leia este tуpico sobre matrizes:
https://sampforum.blast.hk/showthread.php?tid=388940
Post que contйm uma matriz com todos os nomes:
https://sampforum.blast.hk/showthread.php?pid=2465504#pid2465504