[Tutorial] Creating a /sethp command
#3

Adding to what Abagail said you should also indent because the final command shouldn't look like:
pawn Code:
CMD:sethp(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
    new Float:Health;
    new PID;
    if(sscanf(params, "ud", PID, Health)) return SendClientMessage(playerid, -1, "USAGE: /sethp [playerid] [health]");
    if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, -1, "Player is not connected");
    SetPlayerHealth(PID, Health);
    }
    else
    {
    SendClientMessage(playerid, -1, "You are not authorized to use this command!");
    }
    return 1;
}
It should look like this with the proper indentation and with abagail's adjustment:
pawn Code:
CMD:sethp(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new Float:Health;
        new PID;
        if(sscanf(params, "ud", PID, Health)) return SendClientMessage(playerid, -1, "USAGE: /sethp [playerid] [health]");
        if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, -1, "Player is not connected");
        SetPlayerHealth(PID, Health);
    }
    else SendClientMessage(playerid, -1, "You are not authorized to use this command!");
    return 1;
}
Reply


Messages In This Thread
Creating a /sethp command - by DaleWestbrook - 16.06.2014, 07:36
Re: Creating a /sethp command - by Abagail - 16.06.2014, 12:18
Re: Creating a /sethp command - by NewerthRoleplay - 16.06.2014, 13:53
Re: Creating a /sethp command - by SKAzini - 17.06.2014, 13:38
Re: Creating a /sethp command - by AndreiWow - 18.11.2014, 18:06

Forum Jump:


Users browsing this thread: 1 Guest(s)