Sscanf disconnect and reconnect problem
#1

Before i start the core of the topic, i say i have the newest version of sscanf (include + plugin). Here is the problem:

Player with every id (doesnt matter which) joins for the first time, i do some admin commands on him as test, such as like /get, /goto and shit. They work all.

Player with every id quits, then reconnect, i try again this admin cmds on him, NONE OF THEM WORKS.

How damn is possible?

Lemme re-explain: If a player joins, and i use some admin commands on him such as goto, get, slap, explode etc, the first time the player joined everything works, but if he quits and rejoin, it doesnt.

I keep getting "Enter a valid playerid/name" like the player isn't connected but IT IS!

How i can resolve this? I remember i had again this problem times ago but i don't remember how i fixed it.

Any help is welcome.
Reply
#2

You posted in the scripting help section. Where's the code for people to look at? There's obviously a pattern in your commands...
Reply
#3

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
You posted in the scripting help section. Where's the code for people to look at? There's obviously a pattern in your commands...
The problem affects all commands.
Reply
#4

All admin commands, or just the ones you've tested?
Reply
#5

Could you double check you actually have the latest sscanf version? If I remember, there was a bug on an early version that caused this.

Also, can you provide a command to see?
Reply
#6

Quote:
Originally Posted by -Prodigy-
Посмотреть сообщение
Could you double check you actually have the latest sscanf version? If I remember, there was a bug on an early version that caused this.

Also, can you provide a command to see?
I use the latest sscanf version, i checked 10 minutes ago.

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
All admin commands, or just the ones you've tested?
ALL admin commands that requires a parameter (like playerid or name).
Reply
#7

Post just one command please, just to see if you do something wrong.
Reply
#8

Quote:
Originally Posted by ReVo_
Посмотреть сообщение
Post just one command please, just to see if you do something wrong.
This is the most basic command in my admin commands list:

pawn Код:
CMD:get(playerid, params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if(pInfo[playerid][Admin] >= 2)
    {
    new target;
    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!");
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    if(!IsPlayerInAnyVehicle(target)) SetPlayerPosEx(target, Pos[0] + 2, Pos[1] + 2, Pos[2] + 2);
    else SetVehiclePos(GetPlayerVehicleID(target), Pos[0] + 2, Pos[1] + 2, Pos[2] + 2);
    SetPlayerInterior(target, GetPlayerInterior(playerid));
    if(IsPlayerInAnyVehicle(target)) LinkVehicleToInterior(GetPlayerVehicleID(target), GetPlayerInterior(playerid));
    SetPlayerVirtualWorld(target, GetPlayerVirtualWorld(playerid));
    if(IsPlayerInAnyVehicle(target)) SetVehicleVirtualWorld(GetPlayerVehicleID(target), GetPlayerVirtualWorld(playerid));
    pInfo[target][AdminActions]++;
    }
    return 1;
}
I remember i had this problem before but i forgot how damn i fixed...
Reply
#9

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!");
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)