Dcmd help...
#1

dcmd_dance(playerid,params[])
{
new tmp;
tmp = strval(params);
new dancestyle = tmp;
if(dancestyle < 1 || dancestyle > 4)
{
SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
return 1;
}

if(dancestyle == 1) {
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DAN CE1);
} else if(dancestyle == 2) {
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DAN CE2);
} else if(dancestyle == 3) {
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DAN CE3);
} else if(dancestyle == 4) {
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DAN CE4);
}
return 1;
}
This gives me 1 warning and it does not work... It only stands USAGE: /dance [style 1-4] when i type the command...

C:\Users\Robin\Desktop\Simons server\filterscripts\vactions.pwn(395) : warning 203: symbol is never used: "dancestyle"
Reply
#2

Try this.

pawn Код:
dcmd_dance(playerid,params[])
{
    new tmp = strval(params);
    if(tmp < 1 || tmp > 4)
    {
        SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
        return 1;
    }
    if(tmp == 1)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
    if(tmp == 2)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2);
    if(tmp == 3)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
    if(tmp == 4)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE4);
  return 1;
}
No need to make the variable dancestyle if you're just setting it to tmp. Just use tmp.
Reply
#3

Quote:
Originally Posted by backwardsman97
Try this.

pawn Код:
dcmd_dance(playerid,params[])
{
    new tmp = strval(params);
    if(tmp < 1 || tmp > 4)
    {
        SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
        return 1;
    }
    if(tmp == 1)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
    if(tmp == 2)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2);
    if(tmp == 3)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
    if(tmp == 4)
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE4);
 return 1;
}
No need to make the variable dancestyle if you're just setting it to tmp. Just use tmp.
Tanks i test it now... Im new in dcm

Reply
#4

Yeah takes a little bit to get used to but it's worth it in the end.
Reply
#5

I would have used switch :S

pawn Код:
dcmd_dance(playerid, params[])
{
    switch(params[0])
    {
        default:    SendClientMessage(playerid, 0xFF0000FF, "USAGE: /dance [style 1-4]");
        case '1':   SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE1);
        case '2':   SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE2);
        case '3':   SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE3);
        case '4':   SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE4);
    }
    return true;
}
Reply
#6

Quote:
Originally Posted by backwardsman97
Yeah takes a little bit to get used to but it's worth it in the end.
I know and thanks its works...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)