/setpos help +REP -
YoussefHammad - 14.08.2015
Script
Код:
CMD:setpos(playerid,params[])
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"<!>You are not authorized to use this command!");
new Float:x,Float:y,Float:z;
if(sscanf(params,"uii",x,y,z))return SendClientMessage(playerid,COL_GREEN,"USAGE: /setpos [x] [y] [z]");
SetPlayerPos(playerid,x,y,z);
return 1;
}
the cmd is supposed to work like the following: i write the x/y/z position and i get teleported there , i tested it with /setpos 0 0 0 and it worked , but when i do anything other than 0 0 0 i still teleport to 0 0 0 any help ?
Thanks
Re: /setpos help +REP -
iTakelot - 14.08.2015
Try: :P
PHP код:
command(setpos, playerid, params[]) {
new Float:x, Float:y, Float:z, PortMsg[128];
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"<!>You are not authorized to use this command!");
if (sscanf(params, "fff", x, y, z))return SendClientMessage(playerid, 0xFF0000AA, "Use: /setpos [x] [y] [z]");
SetPlayerPos(playerid, x, y, z);
format(PortMsg, 128, "Vocк foi teleportado para a posiзгo: %4.2f, %4.2f, %4.2f", x, y, z);
SendClientMessage(playerid, 0x00FF00FF, PortMsg);
return 1;
}
Re: /setpos help +REP -
jlalt - 14.08.2015
:b
PHP код:
CMD:setpos(playerid,params[])
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"<!>You are not authorized to use this command!");
new Float:x, Float:y, Float:z;
new tmp[128], tmp2[128], tmp3[128];
new Index; tmp = strtok(params,Index); tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
if(sscanf(params,"uii",x,y,z))return SendClientMessage(playerid,COL_GREEN,"USAGE: /setpos [x] [y] [z]");
x = strval(tmp); y = strval(tmp2); z = strval(tmp3);
SetPlayerPos(playerid,x,y,z);
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Re: /setpos help +REP -
UnDetectable - 14.08.2015
Код:
CMD:setpos(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000FF,"<!>You are not authorized to use this command!");
new Float:x,Float:y,Float:z, Index, tmp[256], tmp2[256], tmp3[256], str[256];
tmp = strtok(params, Index);
tmp2 = strtok(params, Index);
tmp3 = strtok(params, Index);
if(isnull(tmp) || isnull(tmp2) || isnull(tmp3)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /setpos [x] [y] [z]");
x = strval(tmp);
y = strval(tmp2);
z = strval(tmp3);
if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
else SetPlayerPos(playerid,x,y,z);
format(str,sizeof(str),"You have teleported to %f, %f, %f", x,y,z);
SendClientMessage(playerid, 0xFF0000FF, str);
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Re: /setpos help +REP -
YoussefHammad - 14.08.2015
Thanks , +Repped
Re : /setpos help +REP -
nicolaskettler - 14.08.2015
dude wtf: could have been made lot easier :
PHP код:
CMD:setpos(playerid, params[])
{
new Pos[3];
if(sscanf(params, "fff", Pos[0], Pos[1], Pos[2])) return SendClientMessage(playerid, COLOR_WHITE, "** /setpos x y z"));
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
return 1;
}