[Help] Pawno crashing.
#1

When I try to compile this code on my GM , pawno crashes -.-, can you see the problem ?

pawn Код:
if(strcmp(cmd, "/fine", true) == 0) {
      new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [Player ID] [Amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [Player ID] [Amount]");
            return 1;
        }
        if(gteam[playerid]==Team_LSPD || gteam[playerid] ==Team_SFPD || gteam[playerid] ==Team_SWAT || gteam[playerid] ==Team_SASP || gteam[playerid] ==Team_SWAT || gteam[playerid] == Team_DCPT || gteam[playerid] == Team_DCP || gteam[playerid]==Team_L1A){
        if (IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            playermoney = GetPlayerMoney(playerid);
            GivePlayerMoney(playerid, 2000); //2000$ goto the stealer
            GivePlayerMoney(giveplayerid, (-2000)); //-2000$ from the loser :P
            format(string, sizeof(string), "You have fined %s (ID:%d) $%d.", giveplayer,giveplayerid, moneys);
            SendClientMessage(playerid, COLOR_GREEN, string);
            format(string, sizeof(string), "You have been fined $%d by Officer %s.", moneys, sendername);
            format(string, sizeof(string), "(INFO) Unit %d has issued %s (ID:%d) a $%d fine.",playerid, giveplayer, giveplayerid, moneys);
            SendMessageToLaw(string);

        } else {
                format(string, sizeof(string), "ID %d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_RED, string);
            }
        return 1;
}
}
    return 1;
}
Reply
#2


I can re-write the code and there won't be any problems.
Reply
#3

There is no problem with the code ?

So it there is no problems, why pawno crashs ? if pawno crashes my gm doesn't work ...

Are you sure there is no problems?
Reply
#4

look at your braces
Reply
#5

pawn Код:
if(!strcmp(cmd,"/fine",true))
{
    new tmp[128];
    tmp=strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [Player ID] [Amount]");
    giveplayerid = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fine [Player ID] [Amount]");
    if(gteam[playerid]!=Team_LSPD || gteam[playerid]!=Team_SFPD || gteam[playerid] !=Team_SWAT || gteam[playerid] !=Team_SASP || gteam[playerid] !=Team_SWAT || gteam[playerid] != Team_DCPT || gteam[playerid] != Team_DCP || gteam[playerid]!=Team_L1A)return 1;
    if(!IsPlayerConnected(giveplayerid)) return false;
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    playermoney = GetPlayerMoney(playerid);
    GivePlayerMoney(playerid, 2000); //2000$ goto the stealer
    GivePlayerMoney(giveplayerid, (-2000)); //-2000$ from the loser :P
    format(string, sizeof(string), "You have fined %s (ID:%d) $%d.", giveplayer,giveplayerid, moneys);
    SendClientMessage(playerid, COLOR_GREEN, string);
    format(string, sizeof(string), "You have been fined $%d by Officer %s.", moneys, sendername);
    format(string, sizeof(string), "(INFO) Unit %d has issued %s (ID:%d) a $%d fine.",playerid, giveplayer, giveplayerid, moneys);
    SendMessageToLaw(string);
    return 1;
}
Quick remade.
If the pawn crashes/gives 26 errors. It means you have less/too many brackets.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)