LSPD BUG - need help fast inportent !
#1

Seem to be having problems with the /duty cmd for police when ever some 1 does it Server will crash any idia how to fix guys? thanks
Reply
#2

post the cmd maybe? how the hell are we supposed to know what your cmd does and figure out why does it crash?
Reply
#3

Quote:

//----------------------------------[offduty]-----------------------------------------------


if(strcmp(cmd, "/duty", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerToPoint(3,playerid,-1616.1294,681.1594,7.1875) || PlayerInfo[playerid][pLocal] != 255)
{
if(OnDuty[playerid]==0)
{
new BadgeNum = PlayerInfo[playerid][pBadgeNumber];
if(PlayerInfo[playerid][pRank] == 15) { format(string, sizeof(string), "** Chief %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 14) { format(string, sizeof(string), "** Deputy Chief %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 13) { format(string, sizeof(string), "** Captain %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 12) { format(string, sizeof(string), "** Lieutenant %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 11) { format(string, sizeof(string), "** Vice Head Detective %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 10) { format(string, sizeof(string), "** Vice Detective %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "** FBI Executive Director %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == { format(string, sizeof(string), "** FBI Deputy Director %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Special Agent In Charge %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Special Agent %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Snr. Sergeant %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Sergeant %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Snr. Officer %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Officer %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Cadet %s Badge:%d is now on Duty", sendername,BadgeNum); }
SendRadioMessage(1, TEAM_CYAN_COLOR, string);
format(string, sizeof(string), "* Officer %s took a Badge and a Gun from his locker.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GivePlayerWeapon(playerid, 24, 70);
GivePlayerWeapon(playerid, 3, 0);
OnDuty[playerid] = 1;
}
else if(OnDuty[playerid]==1)
{
new BadgeNum = PlayerInfo[playerid][pBadgeNumber];
if(PlayerInfo[playerid][pRank] == 15) { format(string, sizeof(string), "** Chief %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 14) { format(string, sizeof(string), "** Deputy Chief %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 13) { format(string, sizeof(string), "** Captain %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 12) { format(string, sizeof(string), "** Lieutenant %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 11) { format(string, sizeof(string), "** Vice Head Detective %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 10) { format(string, sizeof(string), "** Vice Detective %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 9) { format(string, sizeof(string), "** FBI Executive Director %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == { format(string, sizeof(string), "** FBI Deputy Director %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == 7) { format(string, sizeof(string), "** Special Agent In Charge %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Special Agent %s is now on Duty", sendername); }
else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Snr. Sergeant %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Sergeant %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Snr. Officer %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Officer %s Badge:%d is now on Duty", sendername,BadgeNum); }
else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Cadet %s Badge:%d is now on Duty", sendername,BadgeNum); }
SendRadioMessage(1, TEAM_CYAN_COLOR, string);
format(string, sizeof(string), "* Officer %s places his Badge and Gun in his locker.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GivePlayerWeapon(playerid, 23, 150);
GivePlayerWeapon(playerid, 5, 0);
OnDuty[playerid] = 0;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not in a locker room !");
return 1;
}
}
else if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
if(JobDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now Off Duty from your Medic Job and will not receive calls anymore.");
JobDuty[playerid] = 0;
Medics -= 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now On Duty with your Medic Job and will receive calls from people in need.");
JobDuty[playerid] = 1;
Medics += 1;
}
}
else if(PlayerInfo[playerid][pJob] == 20)
{
if(JobDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now Off Duty from your Taxi Job and will not receive calls anymore.");
JobDuty[playerid] = 0;
Medics -= 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now On Duty with your Taxi Job and will receive calls from people in need.");
JobDuty[playerid] = 1;
Medics += 1;
}
}
else if(PlayerInfo[playerid][pJob] == 21)
{
if(JobDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now Off Duty from your Pizza Delivery Job and will not receive calls anymore.");
JobDuty[playerid] = 0;
PizzaBoys -= 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now On Duty with your Pizza Delivery Job and will receive calls from people in need.");
JobDuty[playerid] = 1;
PizzaBoys += 1;
}
}
else if(PlayerInfo[playerid][pJob] == 7)
{
if(JobDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now Off Duty from your Car Mechanic Job and will not receive calls anymore.");
JobDuty[playerid] = 0;
Mechanics -= 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now On Duty with your Car Mechanic Job and will receive calls from people in need.");
JobDuty[playerid] = 1;
Mechanics += 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not a Cop !");
}
}
return 1;

Reply
#4

It's easy as 1-2-3!

1) it's, like, 100% GodFather code -> GTFO
2) indentation
3) with a quick look I don't see anything that would make it crash

I dunno really - maybe you get some helpful errors while compiling?
Reply
#5

i will check it out, ill post the error later or tomorow if i not fix this i will first try to fix it or replace the command with another script.
Reply
#6

the error is
run time error 17: "Invalid/Unsupperted P-code file format·
Reply
#7

Do you have a function outside any callback?
Does it give any errors when compiling?
Try recompiling maybe?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)