SA-MP Forums Archive
/fix problem - 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: /fix problem (/showthread.php?tid=416715)



/fix problem - Ananisiki - 18.02.2013

~~~~~~~~


Re: /fix problem - Jewell - 18.02.2013

pawn Код:
CMD:fix(playerid, params[])
{
    #pragma unused params
    if(isDead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    if(IsPlayerInAnyVehicle(playerid)) {
    SetVehicleHealth(GetPlayerVehicleID(playerid),1000 .0);
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Your Vehicle Has Been Successfully Repaired.");
    return 1;
    }
    else
    {
    return SendClientMessage(playerid, COLOR_RED, "You Must Be In A Vehicle To Use This Command.");
    }
   return 1;
}
You should return the command to avoid unknown command message.


Re: /fix problem - Ananisiki - 18.02.2013

~~~~~~~~


Re: /fix problem - CoaPsyFactor - 18.02.2013

remove last return 1; cus if you can see, it will never go to that part of code, because you have return in if and else


Re: /fix problem - Ananisiki - 19.02.2013

~~~~~~~~


Re: /fix problem - DaRk_RaiN - 19.02.2013

pawn Код:
CMD:fix(playerid, params[])
{
    if(isDead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, COLOR_RED, "You Must Be In A Vehicle To Use This Command.");
    SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Your Vehicle Has Been Successfully Repaired.");
    return 1;
}