freeze/unfreeze command
#1

Before you say it i have looked around, no luck what i want is a /freeze command for strcmp and it works like
/freeze [id] and for the victims screen in big words It goes "Freeze Mofo!" And Ofc they cant move until /unfreeze so any help for /freeze and /unfreeze?
Reply
#2

TogglePlayerControllable();
Reply
#3

You wan't /freeze and /unfreeze commands on strcmp? why not in sscanf.. it's better than strcmp. Think.. : >
Reply
#4

I only understand strcmp
Reply
#5

i dont get sscanf also iPleao i dont get how to add the ID part to that.
crap double post.
Reply
#6

Try this, not tested.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/freeze", true) == 0)
    {
        new tmp[32];
        tmp = strtok(cmdtext, idx);
        TogglePlayerControllable( strval(tmp), false );
        GameTextForPlayer( strval(tmp), "~r~Frozen!", 2000, 3);
        return 1;
    }
     
    if(strcmp(cmd, "/unfreeze", true) == 0)
    {
        new tmp[32];
        tmp = strtok(cmdtext, idx);
        TogglePlayerControllable( strval(tmp), true );
        GameTextForPlayer( strval(tmp), "~g~Unfrozen!", 2000, 3);
        return 1;
    }
   
    return 0;
}

//Place this at the end of your script.
//If you have one, no need then.
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)