[HELP]Admin Duty
#1

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;
}
Reply
#2

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?
Reply
#3

hmmm man it dosent work in game
Reply
#4

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

Well first of all, you have to Attach3DTextLabelToPlayer
Reply
#5

EDIT: I'm a noob scripter xD

Look down.
Reply
#6

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
Reply
#7

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

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
Reply
#9

using ladmin
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)