/z /y /x commands - 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: /z /y /x commands (
/showthread.php?tid=111435)
/z /y /x commands -
[SW]thekillaer - 01.12.2009
how can i make a command that when i type /z 10 it adds 10 to the /z coordinate and when i do /z -10 it subtracts
and the same for /x and /y
please help
Re: /z /y /x commands -
LarzI - 01.12.2009
pawn Код:
dcmd_x(playerid, p)
{
new
Float:x,
Float:y,
Float:z;
if(!strlen(params))
return SendClientMessage(playerid, 0xFFFF00FF, "USAGE: \"/x [positive or negative float]\"");
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x+p, y, z);
return true;
}
Re: /z /y /x commands -
[SW]thekillaer - 01.12.2009
so this would work for /z right?
Код:
dcmd_x(playerid, p)
{
new
Float:x,
Float:y,
Float:z;
if(!strlen(params))
return SendClientMessage(playerid, 0xFFFF00FF, "USAGE: \"/z [positive or negative float]\"");
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+p);
return true;
}
I get this error
C:\PROGRA~1\ROCKST~1\GTASAN~1\GTAU-S~1.WIN\GAMEMO~1\UBERST~1.PWN(949) : warning 203: symbol is never used: "dcmd_x"
Re: /z /y /x commands -
LarzI - 01.12.2009
That's because I've used DCMD
look up
https://sampwiki.blast.hk/wiki/Fast_Commands
or just use this code:
pawn Код:
if(!strcmp(cmdtext, "/x", true))
{
new
Float:x,
Float:y,
Float:z;
if(cmdtext[2] != 32 || cmdtext[3] == EOS)
return SendClientMessage(playerid, 0xFFFF00FF, "USAGE: \"/x [positive or negative float]\"");
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x+floatstr(cmdtext[3]), y, z);
return true;
}
Re: /z /y /x commands -
Niixie - 02.12.2009
Here all three commands are in dcmd:
put under OnPlayerCommandText
Код:
{
dcmd(x, 1, cmdtext);
dcmd(y, 1, cmdtext);
dcmd(z, 1, cmdtext);
}
dcmd_x(playerid, params[])
{
new
Float:x,
Float:y,
Float:z;
if(!strlen(params))
return SendClientMessage(playerid, 0xFFFF00FF, "USAGE: \"/x [positive or negative float]\"");
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x+params, y, z);
return true;
}
dcmd_y(playerid, params[])
{
new
Float:x,
Float:y,
Float:z;
if(!strlen(params))
return SendClientMessage(playerid, 0xFFFF00FF, "USAGE: \"/y [positive or negative float]\"");
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y+params, z);
return true;
}
dcmd_z(playerid, params[])
{
new
Float:x,
Float:y,
Float:z;
if(!strlen(params))
return SendClientMessage(playerid, 0xFFFF00FF, "USAGE: \"/z [positive or negative float]\"");
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+params);
return true;
}
Should work.