Help in dcmd, and GameTextForPlayer
#1

Question 1:

Hey guys, I added a /heal command to LuxAdmin script, heres the code:

pawn Код:
dcmd_heal(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 1)
    {
    SetPlayerHealth(playerid, 100);
    SetGameTextForPlayer(playerid, "You have been healed", 4, 3000);
    }
    return 1;
    }
Then in compiler it says:

pawn Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\GTASAS~1\FILTER~1\LuxAdmin.pwn(12431) : warning 203: symbol is never used: "dcmd_heal"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.

How do I fix it?



Question 2:


I added Game Text for when someone switches class:

Some of them are fine, but I need aqua color for S.W.A.T, pink color for Medics, and dark green for taxi drivers:

Here are the codes for them:

S.W.A.T:

pawn Код:
case 11:
        {
            GameTextForPlayer(playerid, "S.W.A.T", 3000, 3);
        }

Medics:

pawn Код:
case 13, 14:
        {
            GameTextForPlayer(playerid, "Medics", 3000, 3);
        }

Taxi Drivers:

pawn Код:
case 15, 16:
        {
            GameTextForPlayer(playerid, "Taxi Drivers", 3000, 3);
        }

So here are the colors again:


•S.W.A.T = Aqua Color

• Medics = Pink Color

•Taxi Drivers = Dark Green



Please help me! Thanks
Reply
#2

Did you include dcmd in the filterscript?
Reply
#3

Yes...
Reply
#4

HELP ME SOMEONE! PLEASE
Reply
#5

Dude ignore it, it just tell u dat it never used before.

It doesnt harm The script
Reply
#6

Quote:
Originally Posted by Lynet
Посмотреть сообщение
Dude ignore it, it just tell u dat it never used before.

It doesnt harm The script
Idk if that's troll or not but don't listen to this guy lol..

Idk why its giving you the error usually its if a variable is defined but not used.. So im not sure
Reply
#7

You need to have this if you are using dcmd
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Definition
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
dcmd(heal,4,cmdtext);
return 0;
}
Then Your Command Bellow
pawn Код:
dcmd_heal(playerid,params[]) // need to put it so it will not show as undefined and will also read the command
{
    if(AccInfo[playerid][Level] >= 1)
    {
    SetPlayerHealth(playerid, 100);
    SetGameTextForPlayer(playerid, "You have been healed", 4, 3000);
    }
    return 1;
    }
And For Gametext i have no idea for Dark Green And Aqua but! here is blue,green,purple
pawn Код:
case 11:
        {
            GameTextForPlayer(playerid, "~b~S.W.A.T", 3000, 3); //Blue
        }
pawn Код:
case 13, 14:
        {
            GameTextForPlayer(playerid, "~p~Medics", 3000, 3); //Purple
        }
pawn Код:
case 15, 16:
        {
            GameTextForPlayer(playerid, "~g~Taxi Drivers", 3000, 3); //Green
        }
Hope you understand it
PS: I tried to explain it very for all people who doesn't know about it
Reply
#8

You can fix the DCMD warning by adding
pawn Код:
#pragma unused params
at the top of your command, like this:
pawn Код:
dcmd_heal(playerid,params[]) {
    #pragma unused params
    if(AccInfo[playerid][Level] >= 1) {
        SetPlayerHealth(playerid, 100);
        SetGameTextForPlayer(playerid, "You have been healed", 4, 3000);
    }
    return 1;
}
This is typical with DCMD.



About colors, you can use ~p~ for pink as far as I remember, but I don't think you can do the rest.
Either consider changing the team colors or use textdraws - they support any color!
Reply
#9

For the first one, there should be some codes under OnPlayerCommandText if I am thinking properly, and they should have something like this:

pawn Код:
dcmd(command, 7, cmdtext);
So for example, you would add in:
pawn Код:
dcmd(heal, 4, cmdtext);
EDIT: Oh and I know you are able to get the colors for the medic and taxi driver, but I'm not certain about the SWAT yet.

Medic:
Change text to "~p~Medic"

Taxi Driver:
Change text to "~g~Taxi Driver"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)