Dcmd help... - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dcmd help... (
/showthread.php?tid=73065)
Dcmd help... -
robanswe - 12.04.2009
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"
Re: Dcmd help... -
Backwardsman97 - 12.04.2009
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.
Re: Dcmd help... -
robanswe - 12.04.2009
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
Re: Dcmd help... -
Backwardsman97 - 12.04.2009
Yeah takes a little bit to get used to but it's worth it in the end.
Re: Dcmd help... -
Nero_3D - 12.04.2009
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;
}
Re: Dcmd help... -
robanswe - 12.04.2009
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...