[Ajuda] Autotuning o que hб de errado ?
#1

Boa noite fiz sistema de auto tuning e gostaria de saber o que hб de errado, o cуdigo funciona assim, o Player entra no carro, e quando ele da um click do mouse, o carro й completamente tunado. aqui estб o cуdigo abaixo ...

Porem se ele digita /autotuningoff eu queria que quando ele desse o click nгo tunasse o carro, apenas soltasse nox como ta ai na programaзгo ... porem independente se ele digita autotuningoff ou nгo, o carro eh tunado a 1 click ...

PHP Code:
CMD:autotuning(playerid)
{
AutotuningVIP == 1;
SendClientMessage(playeridRoxo"| VIP | Autotuning ativado !");
return 
1;
}
CMD:autotuningoff(playerid)
{
AutotuningVIP == 0;
SendClientMessage(playeridRoxo"| VIP | Autotuning desativado !");
return 
1;

PHP Code:
new bool:AutotuningVIP;
hook OnPlayerKeyStateChange(playeridnewkeysoldkeys)
    {
if(
IsPlayerVIP(playerid))
if(
IsPlayerInAnyVehicle(playerid))
{
new 
nos GetPlayerVehicleID(playerid);
if(
Nitro(nos) && (oldkeys || oldkeys 4))
    {
RemoveVehicleComponent(nos1010);
AddVehicleComponent(nos1010);
RepairVehicle(GetPlayerVehicleID(playerid));
{
if(
AutotuningVIP 1// AutoTuning
            
{
                new 
idcarro;
                
idcarro GetPlayerVehicleID(playerid);
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 562)
                {
                    
AddVehicleComponent(idcarro,1046);
                    
AddVehicleComponent(idcarro,1171);
                    
AddVehicleComponent(idcarro,1149);
                    
AddVehicleComponent(idcarro,1035);
                    
AddVehicleComponent(idcarro,1147);
                    
AddVehicleComponent(idcarro,1036);
                    
AddVehicleComponent(idcarro,1040);
                    
ChangeVehiclePaintjob(idcarro1);
                    
ChangeVehicleColor(idcarro00);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 560)
                {
                    
AddVehicleComponent(idcarro,1028);
                    
AddVehicleComponent(idcarro,1169);
                    
AddVehicleComponent(idcarro,1141);
                    
AddVehicleComponent(idcarro,1032);
                    
AddVehicleComponent(idcarro,1138);
                    
AddVehicleComponent(idcarro,1026);
                    
AddVehicleComponent(idcarro,1027);
                    
ChangeVehiclePaintjob(idcarro2);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 565)
                {
                    
AddVehicleComponent(idcarro,1046);
                    
AddVehicleComponent(idcarro,1153);
                    
AddVehicleComponent(idcarro,1150);
                    
AddVehicleComponent(idcarro,1054);
                    
AddVehicleComponent(idcarro,1049);
                    
AddVehicleComponent(idcarro,1047);
                    
AddVehicleComponent(idcarro,1051);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro2);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 559)
                {
                    
AddVehicleComponent(idcarro,1065);
                    
AddVehicleComponent(idcarro,1160);
                    
AddVehicleComponent(idcarro,1159);
                    
AddVehicleComponent(idcarro,1067);
                    
AddVehicleComponent(idcarro,1162);
                    
AddVehicleComponent(idcarro,1069);
                    
AddVehicleComponent(idcarro,1071);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro1);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 561)
                {
                    
AddVehicleComponent(idcarro,1064);
                    
AddVehicleComponent(idcarro,1155);
                    
AddVehicleComponent(idcarro,1154);
                    
AddVehicleComponent(idcarro,1055);
                    
AddVehicleComponent(idcarro,1158);
                    
AddVehicleComponent(idcarro,1056);
                    
AddVehicleComponent(idcarro,1062);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro2);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 558)
                {
                    
AddVehicleComponent(idcarro,1089);
                    
AddVehicleComponent(idcarro,1166);
                    
AddVehicleComponent(idcarro,1168);
                    
AddVehicleComponent(idcarro,1088);
                    
AddVehicleComponent(idcarro,1164);
                    
AddVehicleComponent(idcarro,1090);
                    
AddVehicleComponent(idcarro,1094);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro2);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 575)
                {
                    
AddVehicleComponent(idcarro,1044);
                    
AddVehicleComponent(idcarro,1174);
                    
AddVehicleComponent(idcarro,1176);
                    
AddVehicleComponent(idcarro,1042);
                    
AddVehicleComponent(idcarro,1099);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro0);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 534)
                {
                    
AddVehicleComponent(idcarro,1126);
                    
AddVehicleComponent(idcarro,1179);
                    
AddVehicleComponent(idcarro,1180);
                    
AddVehicleComponent(idcarro,1122);
                    
AddVehicleComponent(idcarro,1101);
                    
AddVehicleComponent(idcarro,1125);
                    
AddVehicleComponent(idcarro,1123);
                    
AddVehicleComponent(idcarro,1100);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro2);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 536)
                {
                    
AddVehicleComponent(idcarro,1104);
                    
AddVehicleComponent(idcarro,1182);
                    
AddVehicleComponent(idcarro,1184);
                    
AddVehicleComponent(idcarro,1108);
                    
AddVehicleComponent(idcarro,1107);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro1);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 567)
                {
                    
AddVehicleComponent(idcarro,1129);
                    
AddVehicleComponent(idcarro,1189);
                    
AddVehicleComponent(idcarro,1187);
                    
AddVehicleComponent(idcarro,1102);
                    
AddVehicleComponent(idcarro,1133);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
                    
ChangeVehiclePaintjob(idcarro2);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
                {
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,1087);
                    
AddVehicleComponent(idcarro,1081);
                    
AddVehicleComponent(idcarro,1139);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 400)
                {
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,1087);
                    
AddVehicleComponent(idcarro,1018);
                    
AddVehicleComponent(idcarro,1013);
                    
AddVehicleComponent(idcarro,1081);
                    
AddVehicleComponent(idcarro,1086);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 401)
                {
                    
AddVehicleComponent(idcarro,1086);
                    
AddVehicleComponent(idcarro,1139);
                    
AddVehicleComponent(idcarro,1081);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,1087);
                    
AddVehicleComponent(idcarro,1012);
                    
AddVehicleComponent(idcarro,1013);
                    
AddVehicleComponent(idcarro,1042);
                    
AddVehicleComponent(idcarro,1043);
                    
AddVehicleComponent(idcarro,1018);
                    
AddVehicleComponent(idcarro,1006);
                    
AddVehicleComponent(idcarro,1007);
                    
AddVehicleComponent(idcarro,1017);
                }
                if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 576)
                {
                    
ChangeVehiclePaintjob(idcarro,2);
                    
AddVehicleComponent(idcarro,1191);
                    
AddVehicleComponent(idcarro,1193);
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,1018);
                    
AddVehicleComponent(idcarro,1081);
                    
AddVehicleComponent(idcarro,1087);
                    
AddVehicleComponent(idcarro,1134);
                    
AddVehicleComponent(idcarro,1137);
                }
                else
                {
                    
AddVehicleComponent(idcarro,1010);
                    
AddVehicleComponent(idcarro,rodawire);
                    
AddVehicleComponent(idcarro,suspensao);
    }
    }
    }
    }
    }
 return 
1;

Reply
#2

Vocк estб fazendo.
Para definir valores, usa apenas um =.
Para comparar, usa-se dois =.

A bool deveria ser playerid.
Reply
#3

Muito obrigado, resolveu, sу por duvida a bool no caso deveria ser

new bool:AutotuningVIP[MAX_PLAYERS] por que? qual eh a diferenзa da atual para essa?
Reply
#4

Quote:
Originally Posted by Ryuzaki07
View Post
Muito obrigado, resolveu, sу por duvida a bool no caso deveria ser

new bool:AutotuningVIP[MAX_PLAYERS] por que? qual eh a diferenзa da atual para essa?
https://sampwiki.blast.hk/wiki/Scripting_Basics#Arrays
Reply
#5

Vocк deixando apenas:
AutotuningVIP

Й uma variavel Global, se um player usar o comando /autotuning, vai ativar ou desativar o autotunning para todos os players do servidor.

Para se tornar uma variavel para um player, vc deve usar:
AutotuningVIP[MAX_PLAYERS]
Na definiзгo global dela.

Mas o que й isso?
Nome da variavel [TAMANHO DA ARRAY]

Entгo se cada player pode estar em um status diferente do outro, vc deve setar o tamanho para MAX_PLAYERS.

E sempre que for checar a variavel vc usa:
AutotuningVIP[playerid]


Agora, se sua ideia й por exemplo:
O Administrador decide se o autotune de todos os players estб ligado ou nгo, ai vc deixa sу: AutotuningVIP mesmo.

Ou se vocк quer que cada player possa desligar o autotune para sн mesmo:
AutotuningVIP[playerid]

Sacou?
Reply
#6

Opa saquei, tinha lido isso ontem mesmo, mas obrigado por reforзar. Sua resposta me surgiram outras ideias ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)