dcmd_goto(playerid,params[]) { new pName[24], str[128]; GetPlayerName(playerid, pName, sizeof(pName)); format(str, sizeof(str),PlayerFile,pName); if(!(dini_Int(str, "AdminLevel") >= 1)) { SendClientMessage(playerid, COLOR_RED, "Admins Only!"); return 1; } new player, name[24]; if(sscanf(params,"u",player)) { SendClientMessage(playerid, COLOR_RED, "USAGE: /goto [playerid]"); return 1; } if(!IsPlayerConnected(player)) { SendClientMessage(playerid, COLOR_RED, "Invalid Player ID."); return 1; } if(dini_Int(str, "AdminLevel") >= 1) { new Float:X,Float:Y,Float:Z,pint,name2[24],string[40],string2[39]; GetPlayerName(player,name2,sizeof(name2)); GetPlayerPos(player,X,Y,Z); GetVehiclePos(player,X,Y,Z); pint = GetPlayerInterior(player); SetPlayerPos(playerid,X+1,Y,Z); SetPlayerInterior(playerid,pint); format(string,sizeof(string),"You have teleported to %s",name2); format(string2,sizeof(string2),"%s has teleported to you",name); SendClientMessage(playerid,COLOR_RED,string); SendClientMessage(player,COLOR_RED,string2); } return 1; }
dcmd_goto(playerid,params[]) { if (dUserINT(PlayerName(playerid)).("admin")>=1) { if(!strlen(params)) return SendClientMessage(playerid,COLOR_ROJOCLARO,"USAGE: /goto <id>"); new id; id = strval(params); if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) { new string[256],Name[24],ActionName[24],Float:X,Float:Y,Float:Z; GetPlayerName(playerid,Name,24); GetPlayerName(id,ActionName,24); new Interior = GetPlayerInterior(id); SetPlayerInterior(playerid,Interior); SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id)); GetPlayerPos(id,X,Y,Z); if(IsPlayerInAnyVehicle(playerid)) { SetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z); LinkVehicleToInterior(GetPlayerVehicleID(playerid),Interior); } else SetPlayerPos(playerid,X,Y,Z); format(string,256,"You have gone to %s",ActionName); return SendClientMessage(playerid,COLOR_ROJOCLARO,string); } else return SendClientMessage(playerid,COLOR_ROJOCLARO,"You can't teleport to yourself or to a disconected user"); } return 1; }
Originally Posted by Fabio11
Try the Mine:
Код:
dcmd_goto(playerid,params[]) { if (dUserINT(PlayerName(playerid)).("admin")>=1) { if(!strlen(params)) return SendClientMessage(playerid,COLOR_ROJOCLARO,"USAGE: /goto <id>"); new id; id = strval(params); if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) { new string[256],Name[24],ActionName[24],Float:X,Float:Y,Float:Z; GetPlayerName(playerid,Name,24); GetPlayerName(id,ActionName,24); new Interior = GetPlayerInterior(id); SetPlayerInterior(playerid,Interior); SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id)); GetPlayerPos(id,X,Y,Z); if(IsPlayerInAnyVehicle(playerid)) { SetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z); LinkVehicleToInterior(GetPlayerVehicleID(playerid),Interior); } else SetPlayerPos(playerid,X,Y,Z); format(string,256,"You have gone to %s",ActionName); return SendClientMessage(playerid,COLOR_ROJOCLARO,string); } else return SendClientMessage(playerid,COLOR_ROJOCLARO,"You can't teleport to yourself or to a disconected user"); } return 1; } |
Originally Posted by dice7
try strval instead of sscanf
|
if(!(dini_Int(str, "AdminLevel") >= 1))
dcmd_goto(playerid,params[])
{
if(IsPlayerAdmin(playerid)) //your valid check
{
if(sscanf(params,"u",params[0])) SendClientMessage(playerid, COLOR_RED, "USAGE: /goto [playerid]");
else if(params[0] == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "Invalid Player ID.");
else
{
new Float:pos[3],pname[MAX_PLAYER_NAME],string[128]; GetPlayerPos(params[0],pos[0],pos[1],pos[2]); SetPlayerPos(playerid,pos[0]+2,pos[1]+2,pos[2]);
GetPlayerName(playerid,pname,sizeof(pname); format(string,sizeof(string),"%s has teleported to you",pname); SendClientMessage(params[0],COLOR_RED,string);
GetPlayerName(params[0],pname,sizeof(pname); format(string,sizeof(string),"You have teleported to %s",pname); SendClientMessage(playerid,COLOR_RED,string);
}
}
else SendClientMessage(playerid, COLOR_RED, "Admins Only!");
return 1;
}