/Heal Command Errors, Can't Understand them or how to fix them
#10

Quote:
Originally Posted by [Fackin'
Pyro ]
You should try using dcmd with sscanf instead of strtok. Much easier. Here is an example of how quick and easy dcmd with sscanf is.

pawn Код:
dcmd_givehealth(playerid, params[])
{
    new health;
    new string[128];
    if(lvl1[playerid] == 1 || lvlf[playerid] == 1)
    {
        if (sscanf(params, "di", id, health))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Usage: \"/givehealth <playerid> <amount>\"");
        } else if (!IsPlayerConnected(id)) {
            SendClientMessage(playerid, COLOR_WHITE, "Player not found");
        } else {
          GetPlayerName(playerid, sendername, sizeof(sendername));
          GetPlayerName(id, giveplayer, sizeof(giveplayer));
            format(string, sizeof(string), "You healed %s with %d health", giveplayer,health);
            SendClientMessage(playerid, COLOR_GREEN2, string);
    } else {
      SendClientMessage(playerid, COLOR_WHITE, "You need to be Admin or to use this command");
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/Fast_Commands
Well, I'm kinda a Scripter Beginner, Learning the Laguage...
and DCMD is kinda complicated for me...
Can you Re-Write it into if(strcmp(cmd, "/heal", true) == 0) ?
I'll appreciate it allot
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)