How to create command /san -
RiChArD_A - 26.01.2013
How can I create I command call /san to sanction a player. What i'll do it's that it will send a player to the coordinates X, Y, Z. Help?
EDIT: And I want it to spawn back in X, Y, Z, after 1 minute...
Re: How to create command /san -
mineralo - 26.01.2013
pawn Код:
if(!strcmp(cmd,"/san",true))
{
new tmp[256];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || !IsNumeric(tmp)) return scm(playerid,-1,"/san <id>");
new id = strval(tmp);
if(!IsPlayerConnected(id)) return scm(playerid,-1,"This Players Isn't Connected !");
SetPlayerPos(id,x,y,z);// change yourself
return 1;
}
Respuesta: Re: How to create command /san -
RiChArD_A - 29.01.2013
Quote:
Originally Posted by mineralo
pawn Код:
if(!strcmp(cmd,"/san",true)) { new tmp[256]; tmp = strtok(cmdtext,idx); if(!strlen(tmp) || !IsNumeric(tmp)) return scm(playerid,-1,"/san <id>"); new id = strval(tmp); if(!IsPlayerConnected(id)) return scm(playerid,-1,"This Players Isn't Connected !"); SetPlayerPos(id,x,y,z);// change yourself return 1; }
|
I use ZCMD

Help me please. I don't know how to pass it to a ZCMD command.
Re: How to create command /san -
Threshold - 29.01.2013
pawn Код:
CMD:san(playerid, params[])
{
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /san [name/id]");
SetPlayerPos(id, X, Y, Z);
//SetPlayerFacingAngle(playerid, Angle); //Optional, but replace 'Angle' with your own float
return 1;
}
Replace X, Y and Z with the appropriate floats.
Respuesta: Re: How to create command /san -
RiChArD_A - 29.01.2013
Quote:
Originally Posted by BenzoAMG
pawn Код:
CMD:san(playerid, params[]) { if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /san [name/id]"); SetPlayerPos(id, X, Y, Z); //SetPlayerFacingAngle(playerid, Angle); //Optional, but replace 'Angle' with your own float return 1; }
Replace X, Y and Z with the appropriate floats.
|
SSCANF again 7_7. has i said no ssanf men
Re: How to create command /san -
Threshold - 29.01.2013
SSCANF is the easiest and fastest option... none of that strtok crap. I'd recommend switching to it ASAP...
Respuesta: How to create command /san -
RiChArD_A - 29.01.2013
Can any one edit the the command please. Thank you
Re: Respuesta: Re: How to create command /san -
Dolph - 29.01.2013
Quote:
Originally Posted by Lauder
SSCANF again 7_7. has i said no ssanf men
|
You never told us anything about sscanf.
Re: How to create command /san -
Mean - 29.01.2013
You don't need sscanf for commands with only one parameter:
pawn Код:
CMD:san(playerid, params[]) {
new id = strval(params);
if(isnull(id)) return SendClientMessage(playerid, -1, "USAGE: /san [id]");
SetPlayerPos(id, X, Y, Z);
//SetPlayerFacingAngle(id, Angle); //Optional, but replace 'Angle' with your own float
return 1;
}
Re: How to create command /san -
Threshold - 29.01.2013
Normally, you might want to make a check if the player is online.
pawn Код:
CMD:san(playerid, params[]) {
new id = strval(params);
if(isnull(id)) return SendClientMessage(playerid, -1, "USAGE: /san [id]");
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "That player is not connected.");
SetPlayerPos(id, X, Y, Z);
//SetPlayerFacingAngle(id, Angle); //Optional, but replace 'Angle' with your own float
return 1;
}
Also, this wouldn't work if you were entering a player's name, you have to enter the ID.