SA-MP Forums Archive
Odd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Odd (/showthread.php?tid=381725)



Odd - VladCanarez - 30.09.2012

Well, I have makeadmin and goto commands using ZCMD and sscanf. Anyways... When i go onto my server with a friend, and i'm id 0, somehow. The command doesn't work for me, but for him it works fine, like if i attempt to TP to him, it will TP it back to myself, but when he tp's it just tp's him correctly. Same with demoting, it makes me demote myself, yet he can demote me perfectly. Any type of help that can be said here?


Re: Odd - VladCanarez - 30.09.2012

pawn Код:
CMD:goto(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] >= 1)
        {
            new plo;
            if(!sscanf(params, "u", plo))
                {
                        if (IsPlayerConnected(plo))
                        {
                            new Float:plocx,Float:plocy,Float:plocz;
                                new world = GetPlayerVirtualWorld(plo);
                                new intid = GetPlayerInterior(plo);
                                GetPlayerPos(plo, plocx, plocy, plocz);
                                SetPlayerInterior(playerid, intid);
                                SetPlayerVirtualWorld(playerid, world);
                                if (GetPlayerState(playerid) == 2)
                                {
                                        SetVehiclePos(GetPlayerVehicleID(playerid), plocx, plocy+4, plocz);
                                }
                                else
                                {
                                        SetPlayerPos(playerid,plocx,plocy+2, plocz);
                                }
                                return 1;
                        }
                        else
                        {
                                SendClientMessage(playerid, -1, "Invalid player");
                        }
                }
                else
                {
                    SendClientMessage(playerid, -1, "USAGE: /Goto [playerid/PartOfName]");
                        return 1;
                }
        }
        return 1;
}
And make admin:
pawn Код:
CMD:makeadmin(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 9999)
    {
        new para1,level;
        if(!sscanf(params, "ui", para1, level))
        {
            if(level > 9999 || level < 0)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid admin level!");
                return 1;
            }
            if(IsPlayerConnected(para1))
            {
                new sendername[MAX_PLAYER_NAME];
                new giveplayer[MAX_PLAYER_NAME];
                new string[128];
                sendername = PlayerNameEx(playerid);
                giveplayer = PlayerNameEx(para1);
                if(level == 0)
                {
                    PlayerInfo[para1][pAdmin] = 0;
                    PlayerInfo[para1][pNewbRank] = 0;
                    format(string, sizeof(string),"AdmCmd: %s has removed %s's Admin status.", sendername, giveplayer);
                    print(string);
                    ABroadCast(COLOR_YELLOW2, string, 1);
                    format(string, sizeof(string), "   Your Admin status has been removed by %s.", sendername);
                    SendClientMessage(para1, COLOR_LIGHTRED, string);
                    return 1;
                }
                if(level < PlayerInfo[para1][pAdmin])
                {
                    PlayerInfo[para1][pNewbRank] = 2;
                    format(string, sizeof(string),"AdmCmd: %s has demoted %s to a level %d admin.", sendername, giveplayer, level);
                    ABroadCast(COLOR_YELLOW2, string, 1);
                    format(string, sizeof(string), "   You have been demoted to a level %d admin by %s", level, sendername);
                    SendClientMessage(para1, COLOR_LIGHTRED, string);
                    format(string, sizeof(string), "   You have demoted %s to a level %d admin.", giveplayer,level);
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
                }
                else
                {
                    PlayerInfo[para1][pNewbRank] = 2;
                    format(string, sizeof(string),"AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
                    ABroadCast(COLOR_YELLOW2, string, 1);
                    format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
                    SendClientMessage(para1, COLOR_LIGHTGREEN, string);
                    format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
                }
                PlayerInfo[para1][pAdmin] = level;
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /MakeAdmin [playerid/PartOfName] [Admin Level]");
        }
    }
    return 1;
}



Re: Odd - CmZxC - 30.09.2012

If your sscanf is outdated, update it.
I remember having same bug back when sscanf wasn't updated it would make everything related to player go to ID 0.


Re: Odd - VladCanarez - 30.09.2012

Quote:
Originally Posted by CmZxC
Посмотреть сообщение
If your sscanf is outdated, update it.
I remember having same bug back when sscanf wasn't updated it would make everything related to player go to ID 0.
Thanks, Holy shit. I love you (no homo)
I'll try to rep+ you, but i think i need like 50 posts or some shit