01.12.2009, 21:11
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
and the same for /x and /y
please help
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;
}
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; }
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;
}
{ 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; }