[Help]Small Issue
#1

I'm developing a /drag command for my roleplay server and it works good. The only problem is that the script cancels itself when the variable is played? I'll explain...


pawn Код:
enum CopDrag // Group variables for copdrag.
{
    Cop, // If this group variable is set to 1 that means the cop is dragging someone.
    Crim, // If this group variable is set it means the criminal is being dragged.
    CopPlayer[MAX_PLAYERS], // This is sets a variable on the cop to the id of the player they are dragging.
    CrimPlayer[MAX_PLAYERS], // This sets a variable on the criminal to the id of the cop that is dragging them.
};
new Drag[MAX_PLAYERS][CopDrag];
This is the Enum I made.


pawn Код:
DragStop(copid, crimid)
{
    Drag[copid][Cop] = 0;
    Drag[crimid][Crim] = 0;
    Drag[copid][CopPlayer] = INVALID_PLAYER_ID;
    Drag[crimid][CrimPlayer] = INVALID_PLAYER_ID;
    KillTimer(DragTimer[crimid]);
}
This is the function I made.

My problem is when I use them in a command. For example...
pawn Код:
CMD:unfreeze(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");


        if(IsPlayerConnected(giveplayerid))
        {
            DeletePVar(giveplayerid, "IsFrozen");
            TogglePlayerControllable(giveplayerid, 1);
            DragStop(Drag[giveplayerid][CrimPlayer], giveplayerid); // Script stops here!
            format(string, sizeof(string), "AdmCmd: %s was unfrozen by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
            ABroadCast(COLOR_LIGHTRED,string,2);
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "Invalid player specified.");
        }

    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}
The script stops where I played my function "DragStop". So it will unfreeze the player but the part where it shows the text won't play. It says "unknown command". I thought it was an issue with the way I made the function but it turned out not to be because I tried doing this:
pawn Код:
CMD:unfreeze(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unfreeze [playerid]");


        if(IsPlayerConnected(giveplayerid))
        {
            DeletePVar(giveplayerid, "IsFrozen");
            TogglePlayerControllable(giveplayerid, 1);
            Drag[Drag[giveplayerid][CrimPlayer]][Cop] = 0;
            Drag[giveplayerid][Crim] = 0;
            Drag[giveplayerid][CopPlayer] = INVALID_PLAYER_ID;
            Drag[Drag[giveplayerid][CopPlayer]][CrimPlayer] = INVALID_PLAYER_ID;
            KillTimer(DragTimer[Drag[giveplayerid][CrimPlayer]]);
            format(string, sizeof(string), "AdmCmd: %s was unfrozen by %s.",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
            ABroadCast(COLOR_LIGHTRED,string,2);
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "Invalid player specified.");
        }

    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}
Instead of using a function I used the variables and still the same result. Now I believe it is a problem with the way I made the enum that is cancelling the script?
Reply


Messages In This Thread
[Help]Small Issue - by ChrisCro - 26.05.2012, 00:11
Re: [Help]Small Issue - by Catalyst- - 26.05.2012, 00:53
Re: [Help]Small Issue - by ChrisCro - 26.05.2012, 01:11
Re: [Help]Small Issue - by Catalyst- - 26.05.2012, 01:33
Re: [Help]Small Issue - by ChrisCro - 26.05.2012, 03:31

Forum Jump:


Users browsing this thread: 4 Guest(s)