Sscanf disconnect and reconnect problem
#10

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Do all of your admin commands have a similar structure? I'm going to assume that SOMETHING other than the sscanf line in your commands is messing it all up. Post some of the commands for crying out loud- quit being so freaking difficult.

#e:

pawn Код:
if(sscanf(params, "u", target)) return SCM(playerid, -1, "{F70505}Usage: {FFFFFF}/get [playerid]");
    else if(target == INVALID_PLAYER_ID) return SCM(playerid, COLOR_ORANGE, "Enter a valid player ID/name!");
Replace that, with this:

pawn Код:
if(sscanf(params, "u", target)) return SCM(playerid, -1, "{F70505}Usage: {FFFFFF}/get [playerid]");
if(target == INVALID_PLAYER_ID) return SCM(playerid, COLOR_ORANGE, "Enter a valid player ID/name!");
No, not all have this structure, and i like my code style, why i should change lol.

However, another admin commands:

pawn Код:
CMD:goto(playerid, params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if (pInfo[playerid][Admin] >= 1)
    {
    new targetid, string[128];
    if(sscanf(params, "u", targetid)) return SCM(playerid, -1, "{F70505}Usage: {FFFFFF}/goto [PlayerID]");
    if(targetid == INVALID_PLAYER_ID) return SCM(playerid, COLOR_ORANGE, "Enter a valid player ID/name!");
    if(GetPVarInt(playerid,"CmdTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait before using this command again.");
    else
    {
        new pName[24];
        GetPlayerName(targetid,pName,128);
        new aName[24];
        GetPlayerName(playerid,aName,128);
        format(string, sizeof(string), "You succesfully teleported to %s [%d]",pName,targetid);
        SCM(playerid,0xFF0000FF,string);
        SetPlayerInterior(playerid,GetPlayerInterior(targetid));
        new Float:TeleX, Float:TeleY, Float:TeleZ;
        GetPlayerPos(targetid, TeleX, TeleY, TeleZ);
        SetPlayerPosEx(playerid, TeleX, TeleY, TeleZ);
        new msg[128];
        format(msg, sizeof(msg), "0,4** Admin %s (%d) teleported to %s (%d)", aName,playerid, pName, targetid);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
        SetPVarInt(playerid,"CmdTime",GetTickCount()+2000);
        pInfo[targetid][AdminActions]++;
        return true;
    }
    }
    else return 0;
}

CMD:drop(playerid, params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if (pInfo[playerid][Admin] >= 1)
    {
        new pid;
        if(sscanf(params, "u", pid)) return SCM(playerid, -1, "{F70505}Usage: {FFFFFF}/drop [PlayerID]");
        if(!IsPlayerConnected(pid)) return SCM(playerid, red, "ERROR: That player is not online.");
        if(pid == playerid) return SCM(playerid, COLOR_RED, "You can't drop yourself.");
        if(GetPVarInt(playerid,"CmdTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait before using this command again.");
        new Float:x;
        new Float:y;
        new Float:z;
        new msg[250];
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[250];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        GetPlayerPos(pid,x,y,z);
        SetPlayerPosEx(pid,x,y,z+20);
        format(string, sizeof(string), "** Admin %s (%d) dropped %s (%d)", adminname,playerid, paramname, pid);
        SendMessageToAdmins(0xFF0000FF, string);
        SetPVarInt(playerid,"CmdTime",GetTickCount()+2000);
        pInfo[pid][AdminActions]++;

        format(msg, sizeof(msg), "0,4** Admin %s (%d) dropped %s (%d)", adminname,playerid, paramname, pid);
        IRC_GroupSay(gGroupID, IRC_ACHANNEL, msg);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
    }
    else SCM(playerid, red, "Unknown command.");
    return 1;
}

CMD:mute(playerid, params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if (pInfo[playerid][Admin] >= 1)
    {
        new pid;
        new msg[128];
        if(sscanf(params, "us", pid, params[2])) return SCM(playerid, -1, "{F70505}Usage: {FFFFFF}/mute [playerid] [reason]");
        if(pInfo[pid][Muted] == 1) return SCM(playerid,0xFF0000FF,"This player is already muted.");
        if(pid == playerid) return SCM(playerid, COLOR_RED, "You can't mute yourself.");
        if(!IsPlayerConnected(pid)) return SCM(playerid, red, "ERROR: That player is not online.");
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "** Admin %s (%d) muted %s (%d) - (%s)", adminname,playerid, paramname, pid, params[2]);
        SCMTA(0xFF0000FF, string);
        pInfo[pid][Muted] = 1;
        pInfo[pid][AdminActions]++;
        format(msg, sizeof(msg), "0,4** Admin %s (%d) muted %s (%d) - (%s)", adminname,playerid, paramname, pid, params[2]);
        IRC_GroupSay(gGroupID, IRC_ACHANNEL, msg);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
    }
    else SCM(playerid, red, "Unknown command.");
    return 1;
}
Reply


Messages In This Thread
Sscanf disconnect and reconnect problem - by Face9000 - 12.08.2013, 21:36
Re: Sscanf disconnect and reconnect problem - by Scenario - 12.08.2013, 22:02
Re: Sscanf disconnect and reconnect problem - by Face9000 - 13.08.2013, 08:40
Re: Sscanf disconnect and reconnect problem - by Scenario - 13.08.2013, 14:47
Re: Sscanf disconnect and reconnect problem - by -Prodigy- - 13.08.2013, 14:58
Re: Sscanf disconnect and reconnect problem - by Face9000 - 13.08.2013, 17:23
Re: Sscanf disconnect and reconnect problem - by ReVo_ - 13.08.2013, 17:30
Re: Sscanf disconnect and reconnect problem - by Face9000 - 13.08.2013, 17:36
Re: Sscanf disconnect and reconnect problem - by Scenario - 13.08.2013, 17:36
Re: Sscanf disconnect and reconnect problem - by Face9000 - 13.08.2013, 18:13

Forum Jump:


Users browsing this thread: 1 Guest(s)