15.01.2015, 10:24
when i try to get id 0 ex /getid 0 error is id number 2 comes this is a bug how to fix it i am using zcmd and sscanf2
CMD:gethere(playerid, params[]) { new giveplayerid; if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]"); new Float:plocx,Float:plocy,Float:plocz; if (IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) { SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator."); return 1; } if (PlayerInfo[playerid][pAdmin] >= 2) { if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING) { SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone."); return 1; } GetPlayerPos(playerid, plocx, plocy, plocz); Streamer_UpdateEx(giveplayerid, plocx, plocy, plocz); SetPVarInt(playerid, "BeingTeleported", 1); SetPlayerVirtualWorld(giveplayerid, PlayerInfo[playerid][pVW]); PlayerInfo[giveplayerid][pLocal] = PlayerInfo[playerid][pLocal]; if (GetPlayerState(giveplayerid) == 2) { TelePos[giveplayerid][0] = 0.0; TelePos[giveplayerid][1] = 0.0; new tmpcar = GetPlayerVehicleID(giveplayerid); SetVehiclePos(tmpcar, plocx, plocy+4, plocz); LinkVehicleToInterior(GetPlayerVehicleID(giveplayerid), GetPlayerInterior(playerid)); SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid)); SetVehicleVirtualWorld(GetPlayerVehicleID(giveplayerid), GetPlayerVirtualWorld(playerid)); SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid)); } else { SetPlayerPos(giveplayerid,plocx,plocy+2, plocz); SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid)); SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid)); } SendClientMessageEx(giveplayerid, COLOR_GRAD1, " You have been teleported!"); } else { SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); } } else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified."); return 1; }
CMD:gethere(playerid, params[])
{
new giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");
new str[128]; format(str, sizeof(str), "giveplayerid = %d", giveplayerid), SendClientMessage(playerid, -1, str);//For debugging, remove if worked
if (!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
if (PlayerInfo[playerid][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING) return SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
new Float:plocx,Float:plocy,Float:plocz;
GetPlayerPos(playerid, plocx, plocy, plocz);
Streamer_UpdateEx(giveplayerid, plocx, plocy, plocz);
SetPVarInt(playerid, "BeingTeleported", 1);
SetPlayerVirtualWorld(giveplayerid, PlayerInfo[playerid][pVW]);
PlayerInfo[giveplayerid][pLocal] = PlayerInfo[playerid][pLocal];
if (GetPlayerState(giveplayerid) == 2)
{
TelePos[giveplayerid][0] = 0.0;
TelePos[giveplayerid][1] = 0.0;
new tmpcar = GetPlayerVehicleID(giveplayerid);
SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
LinkVehicleToInterior(GetPlayerVehicleID(giveplayerid), GetPlayerInterior(playerid));
SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(GetPlayerVehicleID(giveplayerid), GetPlayerVirtualWorld(playerid));
SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
}
else
{
SetPlayerPos(giveplayerid,plocx,plocy+2, plocz);
SetPlayerInterior(giveplayerid, GetPlayerInterior(playerid));
SetPlayerVirtualWorld(giveplayerid, GetPlayerVirtualWorld(playerid));
}
return SendClientMessageEx(giveplayerid, COLOR_GRAD1, "You have been teleported!");
}
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");
if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");
dcmd_tptome(playerid, params[])
{
new pID, Float:adminx, Float:adminy, Float:adminz;
if(PlayerInfo[playerid][pAdmin]==0) return SendClientMessage(playerid, COLOR_WHITE,"Server: Unrecognized command, type /commands to see the commands available for you.");
if(PlayerInfo[playerid][pAdmin]==1) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This command is unavailable for your admin rank.");
if(admduty[playerid]==0) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: You must be on duty to use this command.");
if(sscanf(params, "u", pID)) return SendClientMessage(playerid, COLOR_ADMINBLUE, "Correct usage: /tptome [name/id]");
if(playerid==pID) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: The requested player is you.");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This player is not connected.");
if(life[pID]==0) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This player has not spawned.");
if(PlayerInfo[pID][pAdmin]==10) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: You cannot teleport AmalM to your location.");
GetPlayerPos(playerid, adminx, adminy, adminz);
SetPlayerVirtualWorld(pID,GetPlayerVirtualWorld(playerid));
SetPlayerInterior(pID,GetPlayerInterior(playerid));
if(IsPlayerInAnyVehicle(pID))
{
new vehicleid=GetPlayerVehicleID(pID);
SetVehiclePos(vehicleid, adminx, adminy+2, adminz);
}
else
{
SetPlayerPos(pID, adminx, adminy+2, adminz);
}
SendClientMessage(playerid, COLOR_ADMINBLUE, "The requested player has been teleported to your location successfully.");
SendClientMessage(pID, COLOR_ORANGE, "An admin has teleported you to his position.");
return 1;
}