#1

Код:
zcmd(play3d,playerid,params[]) 
{
new tmp[128];
new idx;
tmp = strtok(params, idx);
if(!params[0]) 
{
return SendClientMessage(playerid, WHITE, "/play3d (id)");
}
textid = Create3DTextLabel("123",0xFFFFFFFF,0.0,0.0,0.0,40.0,0);
Attach3DTextLabelToPlayer(textid, strval(tmp), 0.0, 0.0, -0.4);
return 1;
}
Why this not work ?
Reply
#2

I would use dcmd, as zcmd doesn't really have any documentation.

pawn Код:
dcmd_play3d(playerid,params[])
{
  if(!strlen(params)) return SendClientMessage(playerid, BIALY, "/play3d (id)");
  if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, BIALY, "Player not connected");
  textid = Create3DTextLabel("123",0xFFFFFFFF,0.0,0.0,0.0,40.0,0);
  Attach3DTextLabelToPlayer(textid, strval(params), 0.0, 0.0, -0.4);
  return 1;
}
Reply
#3

Quote:
Originally Posted by Mikep.
I would use dcmd, as zcmd doesn't really have any documentation.

pawn Код:
dcmd_play3d(playerid,params[])
{
  if(!strlen(params)) return SendClientMessage(playerid, BIALY, "/play3d (id)");
  if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, BIALY, "Player not connected");
  textid = Create3DTextLabel("123",0xFFFFFFFF,0.0,0.0,0.0,40.0,0);
  Attach3DTextLabelToPlayer(textid, strval(params), 0.0, 0.0, -0.4);
  return 1;
}
Styll don't work only work Player not connected
Reply
#4

What did you type?
Reply
#5

If you attach the 3dtextlabel to yourself you wont be able to see it and it will work like the nametag.
Reply
#6

zcmd is nearly the same as dcmd, but easier.
The only difference for script is that with dcmd you need to add a line under OnPlayerCommandText in order to use dcmd_xxx while with zcmd you do only zcmd(xxx,playerid,params[]) anywhere you want. But there is a big difference in core since zcmd doesn't go though all the commands and search until it finds the right one, but it simply calls it directly.

However about your code. I recommend you to start using sscanf because it's a lot easier. However you will need sscanf function which you can get here: https://sampwiki.blast.hk/wiki/Sscanf
Btw, when using zcmd you can easily use isnull(params) instead of !strlen(params) or !params[0].

Your command would look like this:
pawn Код:
zcmd(play3d,playerid,params[])
{
new targetid;
if(sscanf(params,"u",targetid)) SendClientMessage(playerid, WHITE, "/play3d (id)");
else if(targetid == INVALID_PLAYER_ID) SendClientMessage(playerid, BIALY, "Player not connected");
else
{
  textid = Create3DTextLabel("123",0xFFFFFFFF,0.0,0.0,0.0,40.0,0);
  Attach3DTextLabelToPlayer(textid, targetid, 0.0, 0.0, -0.4);
}
return 1;
}
Reply
#7

Quote:
Originally Posted by Y_Leѕѕ
Quote:
Originally Posted by Mikep.
I would use dcmd, as zcmd doesn't really have any documentation.
Firstly, there's more than enough documentation in the zcmd topic.

Secondly, please don't encourage people to use older methods, it's the same as when dcmd first came out and people told other people to use strtok/strcmp instead as it was easier (a claim I have never believed). zcmd is fsater and simpler than dcmd - dcmd served its purpose well for a long time, but has been surpassed.

Thirdly, I was thinking about updating the fast commands wiki page to cover zcmd instead of dcmd, but I'm working on a little something first that will also need to go on there.
Are You working on new version of commands ?

I think your publication should be translated into different languages.
Just like your application YSI
Unfortunately, not everyone understands well UK

Quote:

I try to listen to the advice of ******.
He is an authority on programming

Reply
#8

Quote:
Originally Posted by Y_Leѕѕ
And no, I'm working on a new version of sscanf which should be far more powerful and much faster.
Can I sscanf use on zcmd ?
Reply
#9

Quote:
Originally Posted by Y_Leѕѕ
Of course you can, it works on any strings at all - you cuold use it for reading files if you wanted, or anything else.
I'm sorry that I move on again ...
looking at how to use sscanf for files. But none of that (I think) did not.
Reply
#10

Quote:
Originally Posted by Y_Leѕѕ
Quote:
Originally Posted by Mikep.
I would use dcmd, as zcmd doesn't really have any documentation.
Firstly, there's more than enough documentation in the zcmd topic.

Secondly, please don't encourage people to use older methods, it's the same as when dcmd first came out and people told other people to use strtok/strcmp instead as it was easier (a claim I have never believed). zcmd is fsater and simpler than dcmd - dcmd served its purpose well for a long time, but has been surpassed.

Thirdly, I was thinking about updating the fast commands wiki page to cover zcmd instead of dcmd, but I'm working on a little something first that will also need to go on there.
Though I havn't used zcmd, I read the topic and it looked like it's easier to add a command in dcmd then zcmd, *less code wise.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)