[Help] /cuff or /tie
#1

Hello,

I have a problem. I've readed all the tutorials about how to make a command but I still don't know how to make this one.
I know it's something with TogglePlayerControllable(playerid, toggle); but this is all I got..

Quote:

if(strcmp(cmdtext, "/tie", true) == 0)
{
if(gTeam[giveplayerid] != 4)
{
TogglePlayerControllable(playerid, 0)
SendClientMessage(playerid, COLOR_YELLOW, You are now tied up");
}
return 1;
}



if(strcmp(cmdtext, "/untie", true) == 0)
{
if(gTeam[giveplayerid] != 4)
{
TogglePlayerControllable(playerid, 1)
SendClientMessage(playerid, COLOR_YELLOW, You have been released.");
}
return 1;
}

Reply
#2

What's the problem, it doesnt work in game? It gives you error on compiling?
Reply
#3

i find it alot simpiler with Dcmd and sscanf so heres a dcmd/sscanf version of /tie:

pawn Код:
dcmd_Tie(playerid, params[])
{
    new otherid;
    if (sscanf(params, "d", otherid)) return SendClientMessage(playerid, ERROR_COLOR, "Usage: /Tie [playerid]");
    if(gTeam[playerid] == 4)
    {
        TogglePlayerControllable(otherid, 0)
        SendClientMessage(otherid, COLOR_YELLOW, You are now tied up");
    }
    return 1;
}
Reply
#4

Miokie if I use yours it says:

pawn Код:
C:\Documents and Settings\Joeri\Bureaublad\Pen LS\penls.pwn(20965) : warning 203: symbol is never used: "dcmd_Tie"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:      5680 bytes
Code size:      738344 bytes
Data size:      882996 bytes
Stack/heap size:   16384 bytes; estimated max. usage=4910 cells (19640 bytes)
Total requirements: 1643404 bytes

1 Warning.
Reply
#5

I've made a /tie command now but if I do /tie 12 (for example) it ties myself and not the id I typed.

pawn Код:
if(strcmp(cmd, "/tie", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /tie [player id]");
                return 1;
            }
      TogglePlayerControllable(playerid, 0);
        }
        return 1;
    }
//--------------------------------------------------------------------------------------------------------------
    if(strcmp(cmd, "/untie", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /tie [player id]");
                return 1;
            }
      TogglePlayerControllable(playerid, 1);
        }
        return 1;
    }
Reply
#6

I fixed it I did TogglePlayerControllable(playerid, 0);

But it needed to do TogglePlayerControllable(giveplayerid, 0);

Thanks to all that helped me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)