What it's wrong with this ? - 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)
+--- Thread: What it's wrong with this ? (
/showthread.php?tid=544503)
What it's wrong with this ? -
HY - 02.11.2014
pawn Код:
CMD:get(playerid,params[])
{
if(PlayerInfo[playerid][Admin] >= 1)
{
new ID;
new Float:X;
new Float:Y;
new Float:Z;
new Float:A;
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}AdmUsage: {15FF00}/Get [ID]");
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
SetPlayerPos(ID, X,Y,Z);
SendClientMessage(playerid, -1, "{FF0000}AdmCmd: {15FF00}You teleported to your position specified player !");
SendClientMessage(ID,-1, "{FF0000}AdmCmd: {15FF00}You have been teleported to an Administrator position !");
}
else
{
SendClientMessage(playerid, -1, "{FF0000}ERROR: {15FF00}You are not authorized to use this command !");
}
return 1;
}
- No errors, nothing happen' In-Game ...
Re: What it's wrong with this ? -
DanishHaq - 02.11.2014
Try this instead:
pawn Код:
CMD:get(playerid, params[])
{
if(PlayerInfo[playerid][Admin] == 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {15FF00}You are not authorized to use this command !");
new ID;
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1, "{FF0000}AdmUsage: {15FF00}/Get [ID]");
if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {15FF00}Player not connected !");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(ID, x, y, z);
SendClientMessage(playerid, -1, "{FF0000}AdmCmd: {15FF00}You teleported to your position specified player !");
SendClientMessage(ID, -1, "{FF0000}AdmCmd: {15FF00}You have been teleported to an Administrator position !");
return 1;
}
Re: What it's wrong with this ? -
biker122 - 02.11.2014
If you're using it on yourself, you'll see nothing.
If you're using it on someother player, make sure both of you are in the same interior and virtual world.
You could still add SetPlayerInterior(ID, GetPlayerInterior(playerid)), SetPlayerVirtualWorld(ID, GetPlayerVirtualWorld(playerid)); before setting the ID's position.
Re: What it's wrong with this ? -
HY - 02.11.2014
Quote:
Originally Posted by DanishHaq
Try this instead:
pawn Код:
CMD:get(playerid, params[]) { if(PlayerInfo[playerid][Admin] == 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {15FF00}You are not authorized to use this command !"); new ID; if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1, "{FF0000}AdmUsage: {15FF00}/Get [ID]"); if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {15FF00}Player not connected !"); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); SetPlayerPos(ID, x, y, z); SendClientMessage(playerid, -1, "{FF0000}AdmCmd: {15FF00}You teleported to your position specified player !"); SendClientMessage(ID, -1, "{FF0000}AdmCmd: {15FF00}You have been teleported to an Administrator position !"); return 1; }
|
Works. :P +rep !
Quote:
Originally Posted by biker122
If you're using it on yourself, you'll see nothing.
If you're using it on someother player, make sure both of you are in the same interior and virtual world.
You could still add SetPlayerInterior(ID, GetPlayerInterior(playerid)), SetPlayerVirtualWorld(ID, GetPlayerVirtualWorld(playerid)); before setting the ID's position.
|
Thank you,
DanishHaq code works, but you gave to me an idea !
// EDIT: