SA-MP Forums Archive
Whats wrong with this code? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Whats wrong with this code? (/showthread.php?tid=299714)



Whats wrong with this code? - vent - 27.11.2011

pawn Код:
else if(strcmp(x_job,"repair",true) == 0)
            {
                if(RepairOffer[playerid] < 999)
                {
                    if(GetPlayerMoney(playerid) > RepairPrice[playerid])
                    {
                        if(IsPlayerInAnyVehicle(playerid))
                        {
                            if(IsPlayerConnected(RepairOffer[playerid]))
                            {
                                GetPlayerName(RepairOffer[playerid], giveplayer, sizeof(giveplayer));

                                RepairCar[playerid] = GetPlayerVehicleID(playerid);
                                SetVehicleHealth(RepairCar[playerid], 1000.0);
                                format(string, sizeof(string), "* You repaired your car for $%d by Car Mechanic %s.",RepairPrice[playerid],giveplayer);
                                SendClientMessage(playerid, COLOR_WHITE, string);
                                format(string, sizeof(string), "* You fixed %s's car, the $%d has been added to your PayCheck.",sendername,RepairPrice[playerid]);
                                SendClientMessage(RepairOffer[playerid], COLOR_WHITE, string);
                                SafeGivePlayerMoney(playerid, -RepairPrice[playerid]);
                                RepairOffer[playerid] = 999;
                                RepairPrice[playerid] = 0;
                                return 1;
                            }
                            return 1;
                        }
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You can't afford the Repair !");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   No-one offerd you to Repair your Car !");
                    return 1;
                }
            }
            else { return 1; }
        }//not connected
        return 1;
    }
It will crash the pawno.


Re: Whats wrong with this code? - vent - 27.11.2011

nvm, it had a missing bracket.


Re: Whats wrong with this code? - Abreezy - 27.11.2011

It's using "strcmp" thats the biggest issue ^^