SA-MP Forums Archive
Onadminduty - 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: Onadminduty (/showthread.php?tid=379561)



Onadminduty - Biess - 22.09.2012

pawn Код:
public OnPlayerText(playerid, text[])
}
    if(IsOnAdminDuty[playerid] == 1) {
    new
        blahsdwqe123[128]
        ,namwe123e[24]
    ;
    GetPlayerName(playerid, namwe123e, 24);
    format(blahsdwqe123, sizeof blahsdwqe123, "Admin %s: %s", namwe123e, text);
    return SendClientMessageToAll(COLOR_PINK, blahsdwqe123), 0;
}
I need this for ZCMD under onplayertext

pawn Код:
CMD:aduty(playerid,params[]) // Onduty
{
    if(PInfo[playerid][Level] < 1)
    {
        SendClientMessage(playerid,-4,"ERROR: You are not allowed to use this command!");
        return 1;
    }
    if(IsOnAdminDuty[playerid] == false)
    {
        IsOnAdminDuty[playerid] = true;
        new pname[24],dstring[124];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(dstring,sizeof(dstring),"Administrator %s is now on duty.",pname);
        SendClientMessageToAll(RED,dstring);
        SetPlayerHealth(playerid,99999);
        SetPlayerArmour(playerid,99999);
        SetPlayerSkin(playerid,217);
    }
    return 1;
}
Aduty CMD

I had it working on ladmin but now i need it inside my own gamemode ZCMD


Re: Onadminduty - Red_Dragon. - 22.09.2012

Okay, I understood the first part, but what happens then? you didn't say any problems that you have


Re: Onadminduty - Biess - 22.09.2012

pawn Код:
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(473) : error 029: invalid expression, assumed zero
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(473 -- 474) : warning 215: expression has no effect
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(474) : error 001: expected token: ";", but found "if"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(479) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(481) : error 010: invalid function or declaration
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(1459) : warning 203: symbol is never used: "blahsdwqe123"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(1459) : warning 203: symbol is never used: "namwe123e"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Sorry forget to add the errors


Re: Onadminduty - Red_Dragon. - 22.09.2012

remove "GetPlayername" Because it is already defined


Re: Onadminduty - Biess - 22.09.2012

Done
pawn Код:
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(473) : error 029: invalid expression, assumed zero
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(473 -- 474) : warning 215: expression has no effect
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(474) : error 001: expected token: ";", but found "if"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(479) : error 021: symbol already defined: "format"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(480) : error 010: invalid function or declaration
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(1458) : warning 203: symbol is never used: "blahsdwqe123"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(1458) : warning 203: symbol is never used: "namwe123e"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



Re: Onadminduty - [HK]Ryder[AN] - 22.09.2012

Remove
pawn Код:
return 1;
from
pawn Код:
if(PInfo[playerid][Level] < 1)
    {
        SendClientMessage(playerid,-4,"ERROR: You are not allowed to use this command!");
        return 1;
    }



Re: Onadminduty - antonio112 - 22.09.2012

pawn Код:
public OnPlayerText(playerid, text[])
}
    if(IsOnAdminDuty[playerid])
    {
        new str[128], plyName[24];
        GetPlayerName(playerid, plyName, sizeof plyName);
        format(str, sizeof str, "Admin %s: %s", plyName, text);
        SendClientMessageToAll(COLOR_PINK, str);
    }
    return 0;
}
And the /adminduty command:
pawn Код:
CMD:aduty(playerid,params[]) // Onduty
{
    if(PInfo[playerid][Level] < 1)
        return SendClientMessage(playerid,-4,"ERROR: You are not allowed to use this command!");
    if(IsOnAdminDuty[playerid] == false)
    {
        IsOnAdminDuty[playerid] = true;
        new pname[24],dstring[124];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(dstring,sizeof(dstring),"Administrator %s is now ON DUTY.",pname);
        SendClientMessageToAll(RED,dstring);
        SetPlayerHealth(playerid,99999);
        SetPlayerArmour(playerid,99999);
        SetPlayerSkin(playerid,217);
    }
    else
    {
        IsOnAdminDuty[playerid] = false;
        new pname[24],dstring[124];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(dstring,sizeof(dstring),"Administrator %s is now OFF DUTY.",pname);
        SendClientMessageToAll(RED,dstring);
        SetPlayerHealth(playerid,100);
        SetPlayerArmour(playerid,0);
        SetPlayerSkin(playerid,1);
    }
    return 1;
}
This should work.


Re: Onadminduty - Biess - 22.09.2012

Quote:
Originally Posted by antonio112
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
}
    if(IsOnAdminDuty[playerid])
    {
        new str[128], plyName[24];
        GetPlayerName(playerid, plyName, sizeof plyName);
        format(str, sizeof str, "Admin %s: %s", plyName, text);
        SendClientMessageToAll(COLOR_PINK, str);
    }
    return 0;
}
And the /adminduty command:
pawn Код:
CMD:aduty(playerid,params[]) // Onduty
{
    if(PInfo[playerid][Level] < 1)
        return SendClientMessage(playerid,-4,"ERROR: You are not allowed to use this command!");
    if(IsOnAdminDuty[playerid] == false)
    {
        IsOnAdminDuty[playerid] = true;
        new pname[24],dstring[124];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(dstring,sizeof(dstring),"Administrator %s is now ON DUTY.",pname);
        SendClientMessageToAll(RED,dstring);
        SetPlayerHealth(playerid,99999);
        SetPlayerArmour(playerid,99999);
        SetPlayerSkin(playerid,217);
    }
    else
    {
        IsOnAdminDuty[playerid] = false;
        new pname[24],dstring[124];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(dstring,sizeof(dstring),"Administrator %s is now OFF DUTY.",pname);
        SendClientMessageToAll(RED,dstring);
        SetPlayerHealth(playerid,100);
        SetPlayerArmour(playerid,0);
        SetPlayerSkin(playerid,1);
    }
    return 1;
}
This should work.
pawn Код:
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(473) : error 029: invalid expression, assumed zero
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(473 -- 474) : warning 215: expression has no effect
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(474) : error 001: expected token: ";", but found "if"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(477) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(481) : error 010: invalid function or declaration
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(1122) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(1445) : warning 203: symbol is never used: "plyName"
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(1445) : warning 203: symbol is never used: "str"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



Re: Onadminduty - antonio112 - 22.09.2012

Where did you define the "IsOnAdminDuty" ?

I found the problem. This will work:

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsOnAdminDuty[playerid])
    {
        new str[128], plyName[24];
        GetPlayerName(playerid, plyName, sizeof plyName);
        format(str, sizeof str, "Admin %s: %s", plyName, text);
        SendClientMessageToAll(COLOR_PINK, str);
    }
    return 0;
}
And the /adminduty command:
pawn Код:
CMD:aduty(playerid,params[]) // Onduty
{
    if(PInfo[playerid][Level] < 1)
        return SendClientMessage(playerid,-4,"ERROR: You are not allowed to use this command!");
    if(IsOnAdminDuty[playerid] == false)
    {
        IsOnAdminDuty[playerid] = true;
        new pname[24],dstring[124];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(dstring,sizeof(dstring),"Administrator %s is now ON DUTY.",pname);
        SendClientMessageToAll(RED,dstring);
        SetPlayerHealth(playerid,99999);
        SetPlayerArmour(playerid,99999);
        SetPlayerSkin(playerid,217);
    }
    else
    {
        IsOnAdminDuty[playerid] = false;
        new pname[24],dstring[124];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(dstring,sizeof(dstring),"Administrator %s is now OFF DUTY.",pname);
        SendClientMessageToAll(RED,dstring);
        SetPlayerHealth(playerid,100);
        SetPlayerArmour(playerid,0);
        SetPlayerSkin(playerid,1);
    }
    return 1;
}
This should work.


Re: Onadminduty - Biess - 22.09.2012

new bool:IsOnAdminDuty[MAX_PLAYERS] = false;