10.07.2011, 04:36
If your having some trouble with brackets, here's my recommendation.
Count the amount of opening brackets as opposed to the closing ones. There should be a set equal amount.
You have 16 opening brackets and 14 closed. If you had more closed than opening, you would received an error saying "unmatched bracket", but since Pawno crashes, you now know that you have more of { and less of }.
To Solve your problem:
There is now a fixed set of amount of brackets, 16-16.
In the future, might I recommend using the [PAWN] tags instead of the [CODE]
Count the amount of opening brackets as opposed to the closing ones. There should be a set equal amount.
You have 16 opening brackets and 14 closed. If you had more closed than opening, you would received an error saying "unmatched bracket", but since Pawno crashes, you now know that you have more of { and less of }.
To Solve your problem:
pawn Код:
if(strcmp(cmd, "/car", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /car [name");
SendClientMessage(playerid, COLOR_GRAD2, "Available division names: lights,hood,trunk");
return 1;
}
if(strcmp(params, "lights", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
SetVehicleLights(vehicleid, playerid);
}
else if(strcmp(params, "hood", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || IsAPlane(vehicleid) || IsABike(vehicleid))
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
}
SetVehicleHood(vehicleid, playerid);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
new closestcar = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.0))
{
if(GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510 || IsAPlane(closestcar) || IsABike(closestcar))
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
}
SetVehicleHood(closestcar, playerid);
}
}
else if(strcmp(params, "trunk", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510)
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
}
SetVehicleTrunk(vehicleid, playerid);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
new closestcar = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.0))
{
if(GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510)
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
}
SetVehicleTrunk(closestcar, playerid);
}
}
}
}
}
return 1;
}
In the future, might I recommend using the [PAWN] tags instead of the [CODE]