SA-MP Forums Archive
[HELP]Admin Duty - 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: [HELP]Admin Duty (/showthread.php?tid=300170)



[HELP]Admin Duty - Killer786 - 29.11.2011

look i have made a cmd of aduty when i compile it it complie easly but when i on the game the command dosen't work please help me

Code:
dcmd_duty(playerid,params[]){
    new string[128];
    new aname[MAX_PLAYER_NAME];
    if(!IsPlayerAdmin(playerid)) return 0;
    GetPlayerName(playerid,aname,sizeof(aname));
    format(string,sizeof(string),"Administrator %s is now on Duty",aname,playerid);
    admin[playerid] = Create3DTextLabel("ADMIN ON DUTY[DONT ATTACK]", red, 30.0, 40.0, 50.0, 40.0, 0);
    SendClientMessage(playerid, COLOR_RED, string);
    SetPlayerColor(playerid, 0xFFFF00AA)
    SetPlayerArmour(playerid,999999);
    SetPlayerHealth(playerid,999999);
    SetPlayerSkin(playerid, 217);
    else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}



Re: [HELP]Admin Duty - Thresholdold - 29.11.2011

What doesn't work with the command, is it just the Text Label not appearing on their head?

Or doesn't the command do anything at all?


Re: [HELP]Admin Duty - Killer786 - 29.11.2011

hmmm man it dosent work in game


Re: [HELP]Admin Duty - Thresholdold - 29.11.2011

So nothing works, does it show: Administrator - is on duty ??

Well first of all, you have to Attach3DTextLabelToPlayer


Re: [HELP]Admin Duty - Thresholdold - 29.11.2011

EDIT: I'm a noob scripter xD

Look down.


Re: [HELP]Admin Duty - TaMeD - 29.11.2011

pawn Code:
dcmd_duty(playerid,params[]){
    new string[128];
    new aname[MAX_PLAYER_NAME];
    if(!IsPlayerAdmin(playerid)) return 0;
    else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    GetPlayerName(playerid,aname,sizeof(aname));
    format(string,sizeof(string),"Administrator %s is now on Duty",aname,playerid);
    admin[playerid] = Create3DTextLabel("ADMIN ON DUTY[DONT ATTACK]", red, 30.0, 40.0, 50.0, 40.0, 0);
    SendClientMessage(playerid, COLOR_RED, string);
    SetPlayerColor(playerid, 0xFFFF00AA)
    SetPlayerArmour(playerid,999999);
    SetPlayerHealth(playerid,999999);
    SetPlayerSkin(playerid, 217);
   
    return 1;
}
You can't have an if statement, then code outside of the if statement, then an else statement
You must do if - else - other code


Re: [HELP]Admin Duty - Killer786 - 29.11.2011

warning 203: symbol is never used: "dcmd_duty"
and it doesnt works in game :/


Re: [HELP]Admin Duty - Thresholdold - 29.11.2011

What Admin system are you using? Because if you haven't added this to your dcmd file... then it's useless.
Stuff like dcmd_freeze are all kept in an include file. Make sure that you have added your command to that same file


Re: [HELP]Admin Duty - Killer786 - 29.11.2011

using ladmin


Re: [HELP]Admin Duty - TaMeD - 29.11.2011

I believe for dcmd you have to have extra code to declare the command;

dcmd(name, lengthofname, cmdtext);

So for yours, it would be
dcmd(duty, 4, cmdtext);

I think. I'm not overly familiar with dcmd.

Edit:
https://sampforum.blast.hk/showthread.php?tid=48239
That will help you.

You need to place the
pawn Code:
dcmd(duty, 4, cmdtext);
In your OnPlayerCommandText callback