15.12.2010, 14:57
Of some wierd reason, the server window just closes itself when I perform the command /alarm.
Here is the code of the command:
Any ideas?
Here is the code of the command:
pawn Код:
if (!strcmp(cmdtext, "/alarm", true, 6))
{
new vehicleid = GetClosestVehicle(playerid);
if(IsPlayerInAnyVehicle(playerid) || GetDistanceToVehicle(playerid, vehicleid) <= 10){
new vehfile[128];
format(vehfile, sizeof(vehfile), "vehicles/Vehicle_%d", vehicleid);
new Locked = dini_Int(vehfile, "Locked");
new vehfaction = dini_Int(vehfile, "Faction");
new vehowner = dini_Int(vehfile, "Owner");
new vehjob = dini_Int(vehfile, "Job");
new name[MAX_PLAYER_NAME], usrvehfile[256];
GetPlayerName(playerid, name, sizeof(name));
format(usrvehfile, sizeof(usrvehfile), SERVER_USER_FILE, name);
new Faction = dini_Int(usrvehfile, "Faction");
new usrjob = dini_Int(usrvehfile, "Job");
new AdminLevel = dini_Int(usrvehfile, "AdminLevel");
if(Faction == vehfaction && Faction != 0 || usrjob == vehjob && usrjob != 0 || vehowner == GetPlayerName(playerid) || AdminLevel >= 2){
new loccet;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(alarm != 1){
loccet = 1;
SendClientMessage(playerid, WHITE, "The alarm was toggled on" );
dini_IntSet(vehfile, "Alarm", 1);
SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective);
}else{
loccet = 0;
SendClientMessage(playerid, WHITE, "The alarm was toggled off" );
dini_IntSet(vehfile, "Alarm", 0);
SetVehicleParamsEx(vehicleid, engine, lights, 0, doors, bonnet, boot, objective);
}
}else{
SendClientMessage(playerid, WHITE, "You may only toggle the alarm of a vehicle belonging to you or your faction." );
}
}else{
SendClientMessage(playerid, WHITE, "You have to be in or near the vehicle you want to toggle the alarm of." );
}
return 1;
}
Any ideas?