SA-MP Forums Archive
Admin System Help ! - 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: Admin System Help ! (/showthread.php?tid=361499)



Admin System Help ! - Champ - 21.07.2012

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;
}



Re: Admin System Help ! - Cjgogo - 21.07.2012

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...


Re: Admin System Help ! - RedJohn - 21.07.2012

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;
}



Re: Admin System Help ! - Devilxz97 - 21.07.2012

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 ?


Re: Admin System Help ! - EV007 - 21.07.2012

RedJohn's code is wrong, so is your, devil.


Re: Admin System Help ! - RedJohn - 21.07.2012

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 !


Re: Admin System Help ! - Champ - 21.07.2012

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



Re: Admin System Help ! - Kindred - 21.07.2012

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.