05.01.2010, 06:58
Ok, So i'm trying to get it so this code is reachable
The errors i get
I'm new to scirpting, I'm trying to learn here..How can i make it so this code is reachable after i have commented the stuff that is commented out.
Will you need the whole scirpt or will this do fine.
Edit:
Here is the whole scirpt that i have edited
http://pastebin.com/m68df6441
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[256];
new plname[MAX_PLAYER_NAME];
if(newstate == PLAYER_STATE_DRIVER)
{
new veh = GetPlayerVehicleID(playerid);
//if(Engine[veh] == 0)
{
//TogglePlayerControllable(playerid, 1);
//SendClientMessage(playerid, COLOR_GREY, "The engine is off, use /engine or press SHIFT to start it.");
//if(VehicleInfo[veh][vRentPrice] > 0)
{
GetPlayerName(playerid, plname, sizeof(plname));
//if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 || vRented[veh] == playerid)
{
// format(string, sizeof(string), "--|Welcome to a %s|--", VehicleNames[GetVehicleModel(veh)-400]);
// SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
// return 1;
}
// else
{
//if(vRented[veh] != 255)
{
// TogglePlayerControllable(playerid, );
// format(string, sizeof(string), "~w~This %s if for rent ~n~Price: ~b~$%d ~n~~w~Owner: ~b~%s ~n~~w~use /rent vehicle to rent it.", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vRentPrice], VehicleInfo[veh][vOwner]);
// GameTextForPlayer(playerid, string, 12000, 5);
// return 1;
}
//else
{
if(VehicleInfo[veh][vAlarm] > 0)
{
format(string, sizeof(string), "WARNING: This %s is for %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: the alarm is enabled.");
PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
return 1;
}
else
{
format(string, sizeof(string), "WARNING: This %s is for %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
}
}
if(VehicleInfo[veh][vOwned] == 1)
{
GetPlayerName(playerid, plname, sizeof(plname));
// if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 || vRented[veh] == playerid)
{
format(string, sizeof(string), "--|Welcome back to your %s|--", VehicleNames[GetVehicleModel(veh)-400]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
// else
{
if(VehicleInfo[veh][vAlarm] > 0)
{
format(string, sizeof(string), "Info: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "Info: The Alarm Is On.");
PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
return 1;
}
else
{
format(string, sizeof(string), "Info: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
}
}
//else
{
if(VehicleInfo[veh][vOwned] == 1)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0)
{
format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
else
{
if(VehicleInfo[veh][vAlarm] > 0)
{
format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: the alarm is enabled.");
PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
return 1;
}
else
{
format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
}
}
}
return 1;
}
Код:
C:\Users\name\Desktop\sa-mp server\filterscripts\Vehicles_system.pwn(3088) : warning 225: unreachable code C:\Users\name\Desktop\sa-mp server\filterscripts\Vehicles_system.pwn(3098) : warning 225: unreachable code Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase Header size: 2236 bytes Code size: 144608 bytes Data size: 2759584 bytes Stack/heap size: 16384 bytes; estimated max. usage=4211 cells (16844 bytes) Total requirements: 2922812 bytes 2 Warnings.
Will you need the whole scirpt or will this do fine.
Edit:
Here is the whole scirpt that i have edited
http://pastebin.com/m68df6441