Bugged command
#1

My arrest command is really really really bugged.

BUG

1. When someone is wanted, and they type a invalid command, it arrests them and keeps arresting them for like 50 times then it stops

Please someone take a look, it's really annoying, I tried fixing it, nothing works!

Please ignore the indentation, it always messes up in pastebin

http://pastebin.com/cbgsmJkC
Reply
#2

well you have this part
Код:
#
  if(EscapedConvict[giveplayerid] == 1 && GetPlayerWantedLevel(giveplayerid) >=10){
    for(new i=0; i < MAX_PLAYERS; i++)
  {
which sends a lot of commands regardless of what i equals

also here

Код:
  if(GetPlayerWantedLevel(giveplayerid) >=4 && GetPlayerWantedLevel(giveplayerid) <=5){
    for(new i=0; i < MAX_PLAYERS; i++)
  {
here
Код:
  if(GetPlayerWantedLevel(giveplayerid) >=6 && GetPlayerWantedLevel(giveplayerid) <=8) {
  for(new i=0; i < MAX_PLAYERS; i++)
  {
here
Код:
  if(GetPlayerWantedLevel(giveplayerid) == 9) {
  for(new i=0; i < MAX_PLAYERS; i++)
  {
here
Код:
  if(GetPlayerWantedLevel(giveplayerid) >=10 && GetPlayerWantedLevel(giveplayerid) <=14) {
  for(new i=0; i < MAX_PLAYERS; i++)
  {
here
Код:
  if(GetPlayerWantedLevel(giveplayerid) >=15 && GetPlayerWantedLevel(giveplayerid) <=24) {
  for(new i=0; i < MAX_PLAYERS; i++)
  {
and here
Код:
  if(GetPlayerWantedLevel(giveplayerid) >=25) {
  for(new i=0; i < MAX_PLAYERS; i++)
  {
Reply
#3

Oh, So how can i fix this?
Reply
#4

well for example

pawn Код:
if(EscapedConvict[giveplayerid] == 1 && GetPlayerWantedLevel(giveplayerid) >=10){
    for(new i=0; i < MAX_PLAYERS; i++)
  {
    arrestrank[i] +=1;//here you're looping through every player and giving every player +1 arrestrank, so you might want to add some check to see if they are a cop, not sure what you actually want.
  }
  SetPlayerInterior(giveplayerid,10);
  SetPlayerPos(giveplayerid, 219.7640,110.4339,999.0156);
  SetPlayerFacingAngle(giveplayerid,2.2339);
  format(szstring, sizeof(szstring), "Escaped Convict %s(%d) has been re-arrested and sent to Alcatraz by Officer %s(%d) ",pname,giveplayerid,oname,playerid);
  SendClientMessageToAll(0x00C7FFAA, szstring);
  SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
  format(szstring, sizeof(szstring), "You have been sent to Alcatraz by Officer %s(%d)",oname,playerid);
  SendClientMessage(giveplayerid,0x00C7FFAA, szstring);
  SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from Alcatraz once you have served your sentence");
  SendClientMessage(giveplayerid,0x00C7FFAA,"If Alcatraz life sucks for you... Why not ask a friend to visit you? /reqvisit (id)");
  SendClientMessage(playerid, 0xA9A9A9AA, "|_Suspect Arrested_|");
  format(szstring, sizeof(szstring), "You have sent escaped prisoner %s(%d) to Alcatraz - you receive a $4000 re-capture bonus",pname,giveplayerid);
  SendClientMessage(playerid,0x00C7FFAA, szstring);
  GameTextForPlayer(playerid,"~b~Suspect Arrested",5000,3);
  format(szstring, sizeof(szstring), "Escaped Convict %s(%d) has been re-arrested and sent to Alcatraz by Officer %s(%d)",pname,giveplayerid,oname,playerid);
  printf("%s", szstring);
  SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
  GivePlayerMoney(playerid,4000);
    Jailed[giveplayerid] =1;
    InAlcatraz[giveplayerid] =1;
    StoleCopCarRecent[giveplayerid] =0;
    triedtoescaperecent[giveplayerid] =1;
    ResetPlayerWeapons(giveplayerid);
    JailTime[giveplayerid] =320;
    JailTimeServed[giveplayerid] =0;
    EscapedConvict[giveplayerid] =0;
    SetPlayerWantedLevel(giveplayerid,0);
    oscore = GetPlayerScore(playerid);
    SetPlayerScore(playerid, oscore +1);
    return 1;
  }
Reply
#5

I'm not the best scripter ever, but...


What i'm trying to do is, Make this command only work for cops. Not when someone types an invalid command like /home (which does not exist) and it arrests them.
Reply
#6

oops double post
Reply
#7

oh well in that case it sounds like a brackets error, (you have some brackets in the wrong place)
Reply
#8

Quote:
Originally Posted by cessil
oh well in that case it sounds like a brackets error, (you have some brackets in the wrong place)
If you are able to fix this, with no bugs whats so ever, i can give you the last of my paypal cash which is 2 dollers
Reply
#9

oh
strcmp
should be
!strcmp
Reply
#10

Ok, i did the ! on strcmp still same bug.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)