Debug it. Go in-game, use it before and after you enter a vehicle and show me the server_log.txt
pawn Код:
CMD:neon(playerid, params[])
{
print("DEBUG_cmd_neon");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You are not the driver!");
NeonOnOff(playerid, GetPlayerVehicleID(playerid));
return 1;
}
stock NeonOnOff(playerid, vehid)
{
printf("PlayerVehicleInfo[playerid][vehid][pvNeon] = %d", PlayerVehicleInfo[playerid][vehid][pvNeon]);
switch(PlayerVehicleInfo[playerid][vehid][pvNeon])
{
case 1:
{
if(neon[vehid] == INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "red1", CreateObject(18647,0,0,0,0,0,0));
SetPVarInt(playerid, "red2", CreateObject(18647,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "red1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(GetPVarInt(playerid, "red2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
return 1;
}
else if(neon[vehid] != INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "red1", CreateObject(18647,0,0,0,0,0,0));
SetPVarInt(playerid, "red2", CreateObject(18647,0,0,0,0,0,0));
DestroyObject(GetPVarInt(playerid, "red1"));
DestroyObject(GetPVarInt(playerid, "red2"));
neon[vehid] = INVALID_OBJECT_ID;
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
return 1;
}
}
case 2:
{
if(neon[vehid] == INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
SetPVarInt(playerid, "green2", CreateObject(18649,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "green1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(GetPVarInt(playerid, "green2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
return 1;
}
else if(neon[vehid] != INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
SetPVarInt(playerid, "green2", CreateObject(18649,0,0,0,0,0,0));
DestroyObject(GetPVarInt(playerid, "green1"));
DestroyObject(GetPVarInt(playerid, "green2"));
neon[vehid] = INVALID_OBJECT_ID;
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
return 1;
}
}
case 3:
{
if(neon[vehid] == INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
SetPVarInt(playerid, "blue2", CreateObject(18648,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "blue1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(GetPVarInt(playerid, "blue2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
return 1;
}
else if(neon[vehid] != INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
SetPVarInt(playerid, "blue2", CreateObject(18648,0,0,0,0,0,0));
DestroyObject(GetPVarInt(playerid, "blue1"));
DestroyObject(GetPVarInt(playerid, "blue2"));
neon[vehid] = INVALID_OBJECT_ID;
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
return 1;
}
}
case 4:
{
if(neon[vehid] == INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
SetPVarInt(playerid, "pink2", CreateObject(18651,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "pink1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(GetPVarInt(playerid, "pink2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
return 1;
}
else if(neon[vehid] != INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
SetPVarInt(playerid, "pink2", CreateObject(18651,0,0,0,0,0,0));
DestroyObject(GetPVarInt(playerid, "pink1"));
DestroyObject(GetPVarInt(playerid, "pink2"));
neon[vehid] = INVALID_OBJECT_ID;
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
return 1;
}
}
case 5:
{
if(neon[vehid] == INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
SetPVarInt(playerid, "yellow2", CreateObject(18650,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "yellow1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(GetPVarInt(playerid, "yellow2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
return 1;
}
else if(neon[vehid] != INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
SetPVarInt(playerid, "yellow2", CreateObject(18650,0,0,0,0,0,0));
DestroyObject(GetPVarInt(playerid, "yellow1"));
DestroyObject(GetPVarInt(playerid, "yellow2"));
neon[vehid] = INVALID_OBJECT_ID;
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
return 1;
}
}
case 6:
{
if(neon[vehid] == INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
SetPVarInt(playerid, "white2", CreateObject(18652,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "white1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(GetPVarInt(playerid, "white2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
return 1;
}
else if(neon[vehid] != INVALID_OBJECT_ID)
{
SetPVarInt(playerid, "neon", 1);
SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
SetPVarInt(playerid, "white2", CreateObject(18652,0,0,0,0,0,0));
DestroyObject(GetPVarInt(playerid, "white1"));
DestroyObject(GetPVarInt(playerid, "white2"));
neon[vehid] = INVALID_OBJECT_ID;
SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
return 1;
}
}
}
return 1;
}