#1

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
Reply
#2

Code please
Reply
#3

Код:
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;
}
Reply
#4

help please help
Reply
#5

pawn Код:
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!");
}
I added a debug to show you which "playerid" you typed.
Reply
#6

i think should i update sscanf and zcmd ?
Reply
#7

Try changing this"
PHP код:
if(sscanf(params"u"giveplayerid)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /gethere [playerid]"); 
to this:
PHP код:
if(sscanf(params"i"giveplayerid)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /gethere [playerid]"); 
Also, I have the same code in my script. I'll post it here. If you want, you can edit it and use it.
PHP код:
dcmd_tptome(playeridparams[])
{
    new 
pIDFloat:adminxFloat:adminyFloat:adminz;
    if(
PlayerInfo[playerid][pAdmin]==0) return SendClientMessage(playeridCOLOR_WHITE,"Server: Unrecognized command, type /commands to see the commands available for you.");
    if(
PlayerInfo[playerid][pAdmin]==1) return SendClientMessage(playeridCOLOR_ADMINBLUE"ERROR: This command is unavailable for your admin rank.");
    if(
admduty[playerid]==0) return SendClientMessage(playeridCOLOR_ADMINBLUE"ERROR: You must be on duty to use this command.");
    if(
sscanf(params"u"pID)) return SendClientMessage(playeridCOLOR_ADMINBLUE"Correct usage: /tptome [name/id]");
    if(
playerid==pID) return SendClientMessage(playeridCOLOR_ADMINBLUE"ERROR: The requested player is you.");
    if(!
IsPlayerConnected(pID)) return SendClientMessage(playeridCOLOR_ADMINBLUE"ERROR: This player is not connected.");
    if(
life[pID]==0) return SendClientMessage(playeridCOLOR_ADMINBLUE"ERROR: This player has not spawned.");
    if(
PlayerInfo[pID][pAdmin]==10) return SendClientMessage(playeridCOLOR_ADMINBLUE"ERROR: You cannot teleport AmalM to your location.");
    
GetPlayerPos(playeridadminxadminyadminz);
    
SetPlayerVirtualWorld(pID,GetPlayerVirtualWorld(playerid));
    
SetPlayerInterior(pID,GetPlayerInterior(playerid));
    if(
IsPlayerInAnyVehicle(pID))
    {
        new 
vehicleid=GetPlayerVehicleID(pID);
        
SetVehiclePos(vehicleidadminxadminy+2adminz);
    }
    else
    {
        
SetPlayerPos(pIDadminxadminy+2adminz);
    }
    
SendClientMessage(playeridCOLOR_ADMINBLUE"The requested player has been teleported to your location successfully.");
    
SendClientMessage(pIDCOLOR_ORANGE"An admin has teleported you to his position.");
    return 
1;

Reply
#8

its always best to have the up to date ones :P out of date plugins/includes may cause problems or cause somethings not to work
Reply
#9

I don't think old versions have any issues like this, but you should update them once there's an update of-course.
Reply
#10

yes let me update zcmd ad sscanf
Reply
#11

new version have this bugs i thnk sscanf got this bug
Reply
#12

now new bug i cant set player as faction leader when i try to set him a leader for ex player id 1 want to be a fac leader it set player id 3 as a leader
Reply
#13

Try changing "u" in sscanf to "i".
Reply
#14

ok bro
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)