SA-MP Forums Archive
Command help - 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: Command help (/showthread.php?tid=318644)



Command help - BleverCastard - 15.02.2012

Hey guys, can someone help me, If I /setscore, or /goto, it goes to one player, and there names is Carl.

Код:
COMMAND:goto(playerid, params[])
{
	// Setup local variables
	new OtherPlayer, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID;

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/goto", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 1
		if (APlayerData[playerid][PlayerLevel] >= 1)
		{
			// Check if the player has a wanted level of less than 3
			if (GetPlayerWantedLevel(playerid) < 3)
			{
				// Check if the player is not jailed
				if (APlayerData[playerid][PlayerJailed] == 0)
				{
					if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/port <OtherPlayer>\"");
					else
					{
						// Check if that other player is online
						if (IsPlayerConnected(OtherPlayer))
						{
							// Get the location of the other player
							GetPlayerPos(OtherPlayer, x, y, z);
							IntID = GetPlayerInterior(OtherPlayer);
							WorldID = GetPlayerVirtualWorld(OtherPlayer);
							// Port the player to the given location
							SetPlayerVirtualWorld(playerid, WorldID);
							SetPlayerInterior(playerid, IntID);
							SetPlayerPos(playerid, x, y, z + 3.0);
							// Let the player know about it
							format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z + 3.0);
							SendClientMessage(playerid, 0x00FF00FF, PortMsg);
						}
						else
						    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
					}
				}
				else
				    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're in jail");
			}
			else
			    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're wanted");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
EDIT: It happens on every command I.E: /setlevel, /setcash, /sethealth blah blah blah.


Re: Command help - BleverCastard - 15.02.2012

I found the error, its being redirected to Id 0, Help?


Re: Command help - JamesC - 15.02.2012

Update your sscanf to the latest version.


Re: Command help - BleverCastard - 15.02.2012

Is there one released in 2012?


Re: Command help - 2KY - 16.02.2012

Sscanf2.5, yes.

http://2ky.info/scripts/includes/sscanf2_5.inc
http://2ky.info/scripts/plugins/sscanf.dll (windows)
http://2ky.info/scripts/plugins/sscanf.so (linux)