Admin System Help !
#1

How i can add if player is not connect then. when admin type /disarm [id] then it says ( player is not connected ) ?

pawn Код:
YCMD:disarm(playerid, params[], help)
{
        #pragma unused help
        if(P_Data[playerid][pAdmin] < 4) return SCM(playerid, COLOR_RED, "You need to be admin level 4 to use this!");
        new
            pplayerid,string[64];
        if(sscanf(params, "u",pplayerid)) return SCM(playerid, COLOR_RED, "Usage: /disarm [Player ID/Player Name]");
        format(string,sizeof(string),""COL_RED"Admin "COL_WHITE"%s "COL_RED"has disarm you",GetName(playerid));
        SCM(pplayerid,-1,string);
        format(string,sizeof(string),""COL_RED"You'r disarm player "COL_WHITE"%s",GetName(pplayerid));
        SCM(playerid,-1,string);
        ResetPlayerWeapons(pplayerid);
        return 1;
}
Reply
#2

pawn Код:
YCMD:disarm(playerid, params[], help)
{
        #pragma unused help
        if(P_Data[playerid][pAdmin] < 4) return SCM(playerid, COLOR_RED, "You need to be admin level 4 to use this!");
        new
            pplayerid,string[64];
        if(sscanf(params, "u",pplayerid)) return SCM(playerid, COLOR_RED, "Usage: /disarm [Player ID/Player Name]");
        if(!IsPlayerConnected(pplayerid)) return SCM(playerid,COLOR_RED,"Player is not connected!");
        format(string,sizeof(string),""COL_RED"Admin "COL_WHITE"%s "COL_RED"has disarm you",GetName(playerid));
        SCM(pplayerid,-1,string);
        format(string,sizeof(string),""COL_RED"You'r disarm player "COL_WHITE"%s",GetName(pplayerid));
        SCM(playerid,-1,string);
        ResetPlayerWeapons(pplayerid);
        return 1;
}
There you go...
Reply
#3

Try this:
pawn Код:
YCMD:disarm(playerid, params[], help)
{
        #pragma unused help
        if(P_Data[playerid][pAdmin] < 4) return SCM(playerid, COLOR_RED, "You need to be admin level 4 to use this!");
        new pplayerid,string[64];
        if(sscanf(params, "u",pplayerid)) return SCM(playerid, COLOR_RED, "Usage: /disarm [Player ID/Player Name]");
        if(!IsPlayerConnected(playerid)) return SCM(playerid, COLOR_RED, "Player not connected");
        format(string,sizeof(string),""COL_RED"Admin "COL_WHITE"%s "COL_RED"has disarm you",GetName(playerid));
        SCM(pplayerid,-1,string);
        format(string,sizeof(string),""COL_RED"You'r disarm player "COL_WHITE"%s",GetName(pplayerid));
        SCM(playerid,-1,string);
        ResetPlayerWeapons(pplayerid);
        return 1;
}
Reply
#4

pawn Код:
YCMD:disarm(playerid, params[], help)
{
        #pragma unused help
        if(P_Data[playerid][pAdmin] < 4) return SCM(playerid, COLOR_RED, "You need to be admin level 4 to use this!");
        new pplayerid,string[64];
        if(sscanf(params, "u",pplayerid)) return SCM(playerid, COLOR_RED, "Usage: /disarm [Player ID/Player Name]");
        if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:Player not connected!");
        format(string,sizeof(string),""COL_RED"Admin "COL_WHITE"%s "COL_RED"has disarm you",GetName(playerid));
        SCM(pplayerid,-1,string);
        format(string,sizeof(string),""COL_RED"You'r disarm player "COL_WHITE"%s",GetName(pplayerid));
        SCM(playerid,-1,string);
        ResetPlayerWeapons(pplayerid);
        return 1;
}
lol same ?
Reply
#5

RedJohn's code is wrong, so is your, devil.
Reply
#6

Quote:
Originally Posted by Devilxz97
Посмотреть сообщение
pawn Код:
YCMD:disarm(playerid, params[], help)
{
        #pragma unused help
        if(P_Data[playerid][pAdmin] < 4) return SCM(playerid, COLOR_RED, "You need to be admin level 4 to use this!");
        new pplayerid,string[64];
        if(sscanf(params, "u",pplayerid)) return SCM(playerid, COLOR_RED, "Usage: /disarm [Player ID/Player Name]");
        if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:Player not connected!");
        format(string,sizeof(string),""COL_RED"Admin "COL_WHITE"%s "COL_RED"has disarm you",GetName(playerid));
        SCM(pplayerid,-1,string);
        format(string,sizeof(string),""COL_RED"You'r disarm player "COL_WHITE"%s",GetName(pplayerid));
        SCM(playerid,-1,string);
        ResetPlayerWeapons(pplayerid);
        return 1;
}
lol same ?
Lol, post at same time !
Reply
#7

thank you guys I just forgot that line
pawn Код:
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:Player not connected!");
Reply
#8

Quote:
Originally Posted by Champ
Посмотреть сообщение
thank you guys I just forgot that line
pawn Код:
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:Player not connected!");
DO NOT use that code, use the first posters code.

That checks if YOU are logged in when you make the command, not the other player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)