Problem With Admin Script DCMD. - 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: Problem With Admin Script DCMD. (
/showthread.php?tid=236083)
Problem With Admin Script DCMD. -
Manuwar - 06.03.2011
Hi Guys, i have a problem with goto code.
Код:
dcmd_goto(playerid,params[])
{
new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /goto <ID> ");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
format(str,sizeof(str),"Admin %s has teleported to %s",n,on);
SendClientMessageToAll(ORANGE,str);
new Float:x, Float:y, Float:z;
GetPlayerPos(id, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
return 1;
}
Any errors or Warnings, but don't Work. What's wrong in this code? Thank's ^^
P.S: I added dcmd(goto,4,cmdtext); in OnPlayerCommandText.
Re: Problem With Admin Script DCMD. -
Hashski - 06.03.2011
pawn Код:
dcmd_goto(playerid,params[])
{
new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /goto <ID> ");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
format(str,sizeof(str),"Admin %s has teleported to %s",n,on);
SendClientMessageToAll(ORANGE,str);
new Float:x, Float:y, Float:z;
GetPlayerPos(id, x, y, z);
SetPlayerPos(id, x+1, y+1, z);
return 1;
}
You was tele'ing yourself to your own location, not to the other player.
Re: Problem With Admin Script DCMD. -
Manuwar - 06.03.2011
Thanks! Is Working now