[17:50:56] sscanf warning: 'z' is deprecated, consider using 'S' instead. [17:50:56] sscanf warning: No default value fo
#1

code:
pawn Code:
command(movelocation, playerid, params[])
{
    new Location[128];
    if(sscanf(params, "z", Location))
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /movelocation [usage]");
            SendClientMessage(playerid, GREY, "Prison, Jail, Spawn, LockerPos, Hospital, ArrestPos, BankInt, BankExt, OwnedCarSpawn");
            SendClientMessage(playerid, GREY, "LockerPos2, Harvest1, Harvest2, Harvest3, Harvest4, Harvest5, VipClubPos, VipLockerPos");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            if(strcmp(Location, "Prison", true) == 0)
            {
                GetPlayerPos(playerid, Prison1X, Prison1Y, Prison1Z);
                Prison1Int = GetPlayerInterior(playerid);
                Prison1World = GetPlayerVirtualWorld(playerid);
               
                dini_FloatSet("Assets.ini", "Prison1X", Prison1X);
                dini_FloatSet("Assets.ini", "Prison1Y", Prison1Y);
                dini_FloatSet("Assets.ini", "Prison1Z", Prison1Z);
                dini_IntSet("Assets.ini", "Prison1Int", Prison1Int);
                dini_IntSet("Assets.ini", "Prison1World", Prison1World);
               
                SendClientMessage(playerid, WHITE, "You have successfully re-located the Prison location.");
            }
            else if(strcmp(Location, "Harvest1", true) == 0)
            {
                GetPlayerPos(playerid, Harvest1X, Harvest1Y, Harvest1Z);

                dini_FloatSet("Assets.ini", "Harvest1X", Harvest1X);
                dini_FloatSet("Assets.ini", "Harvest1Y", Harvest1Y);
                dini_FloatSet("Assets.ini", "Harvest1Z", Harvest1Z);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the Harvest1 location.");
            }
            else if(strcmp(Location, "Harvest2", true) == 0)
            {
                GetPlayerPos(playerid, Harvest2X, Harvest2Y, Harvest2Z);

                dini_FloatSet("Assets.ini", "Harvest2X", Harvest2X);
                dini_FloatSet("Assets.ini", "Harvest2Y", Harvest2Y);
                dini_FloatSet("Assets.ini", "Harvest2Z", Harvest2Z);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the Harvest2 location.");
            }
            else if(strcmp(Location, "Harvest3", true) == 0)
            {
                GetPlayerPos(playerid, Harvest3X, Harvest3Y, Harvest3Z);

                dini_FloatSet("Assets.ini", "Harvest3X", Harvest3X);
                dini_FloatSet("Assets.ini", "Harvest3Y", Harvest3Y);
                dini_FloatSet("Assets.ini", "Harvest3Z", Harvest3Z);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the Harvest3 location.");
            }
            else if(strcmp(Location, "Harvest4", true) == 0)
            {
                GetPlayerPos(playerid, Harvest4X, Harvest4Y, Harvest4Z);

                dini_FloatSet("Assets.ini", "Harvest4X", Harvest4X);
                dini_FloatSet("Assets.ini", "Harvest4Y", Harvest4Y);
                dini_FloatSet("Assets.ini", "Harvest4Z", Harvest4Z);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the Harvest4 location.");
            }
            else if(strcmp(Location, "Harvest5", true) == 0)
            {
                GetPlayerPos(playerid, Harvest5X, Harvest5Y, Harvest5Z);

                dini_FloatSet("Assets.ini", "Harvest5X", Harvest5X);
                dini_FloatSet("Assets.ini", "Harvest5Y", Harvest5Y);
                dini_FloatSet("Assets.ini", "Harvest5Z", Harvest5Z);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the Harvest5 location.");
            }
            else if(strcmp(Location, "OwnedCarSpawn", true) == 0)
            {
                GetPlayerPos(playerid, OwnedCarSpawnX, OwnedCarSpawnY, OwnedCarSpawnZ);

                dini_FloatSet("Assets.ini", "OwnedCarSpawnX", OwnedCarSpawnX);
                dini_FloatSet("Assets.ini", "OwnedCarSpawnY", OwnedCarSpawnY);
                dini_FloatSet("Assets.ini", "OwnedCarSpawnZ", OwnedCarSpawnZ);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the Owned Car Spawn location.");
            }
            else if(strcmp(Location, "BankExt", true) == 0)
            {
                GetPlayerPos(playerid, BankExtX, BankExtY, BankExtZ);
               
                DestroyDynamicPickup(BankPickupID);
                BankPickupID = CreateDynamicPickup(1239, 23, BankExtX, BankExtY, BankExtZ, 0, -1, -1, 150.0);
               
                dini_FloatSet("Assets.ini", "BankExtX", BankExtX);
                dini_FloatSet("Assets.ini", "BankExtY", BankExtY);
                dini_FloatSet("Assets.ini", "BankExtZ", BankExtZ);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the BankExt location.");
            }
            else if(strcmp(Location, "DropCar", true) == 0)
            {
                GetPlayerPos(playerid, DropCarX, DropCarY, DropCarZ);

                dini_FloatSet("Assets.ini", "DropCarX", DropCarX);
                dini_FloatSet("Assets.ini", "DropCarY", DropCarY);
                dini_FloatSet("Assets.ini", "DropCarZ", DropCarZ);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the DropCar location.");
            }
            else if(strcmp(Location, "BankInt", true) == 0)
            {
                GetPlayerPos(playerid, BankIntX, BankIntY, BankIntZ);
                BankIntID = GetPlayerInterior(playerid);

                dini_FloatSet("Assets.ini", "BankIntX", BankIntX);
                dini_FloatSet("Assets.ini", "BankIntY", BankIntY);
                dini_FloatSet("Assets.ini", "BankIntZ", BankIntZ);
                dini_IntSet("Assets.ini", "BankIntID", BankIntID);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the BankInt location.");
            }
            else if(strcmp(Location, "ArrestPos", true) == 0)
            {
                GetPlayerPos(playerid, ArrestPosX, ArrestPosY, ArrestPosZ);
               
                DestroyDynamicPickup(ArrestPosPickup);

                dini_FloatSet("Assets.ini", "ArrestPosX", ArrestPosX);
                dini_FloatSet("Assets.ini", "ArrestPosY", ArrestPosY);
                dini_FloatSet("Assets.ini", "ArrestPosZ", ArrestPosZ);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the ArrestPos location.");

                ArrestPosPickup = CreateDynamicPickup(1239, 23, ArrestPosX, ArrestPosY, ArrestPosZ, 0, -1, -1, 150.0);
            }
            else if(strcmp(Location, "Jail", true) == 0)
            {
                GetPlayerPos(playerid, Prison2X, Prison2Y, Prison2Z);
                Prison2Int = GetPlayerInterior(playerid);
                Prison2World = GetPlayerVirtualWorld(playerid);

                dini_FloatSet("Assets.ini", "Prison2X", Prison2X);
                dini_FloatSet("Assets.ini", "Prison2Y", Prison2Y);
                dini_FloatSet("Assets.ini", "Prison2Z", Prison2Z);
                dini_IntSet("Assets.ini", "Prison2Int", Prison2Int);
                dini_IntSet("Assets.ini", "Prison2World", Prison2World);
               
                SendClientMessage(playerid, WHITE, "You have successfully re-located the Jail location.");
            }
            else if(strcmp(Location, "Hospital", true) == 0)
            {
                GetPlayerPos(playerid, HospitalSpawnX, HospitalSpawnY, HospitalSpawnZ);
                HospitalInt = GetPlayerInterior(playerid);

                dini_FloatSet("Assets.ini", "HospitalSpawnX", HospitalSpawnX);
                dini_FloatSet("Assets.ini", "HospitalSpawnY", HospitalSpawnY);
                dini_FloatSet("Assets.ini", "HospitalSpawnZ", HospitalSpawnZ);
                dini_IntSet("Assets.ini", "HospitalInt", HospitalInt);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the Hospital.");
            }
            else if(strcmp(Location, "LockerPos2", true) == 0)
            {
                GetPlayerPos(playerid, LockerPos2X, LockerPos2Y, LockerPos2Z);
                LockerPos2Int = GetPlayerInterior(playerid);

                dini_FloatSet("Assets.ini", "LockerPos2X", LockerPos2X);
                dini_FloatSet("Assets.ini", "LockerPos2Y", LockerPos2Y);
                dini_FloatSet("Assets.ini", "LockerPos2Z", LockerPos2Z);
                dini_IntSet("Assets.ini", "LockerPos2Int", LockerPos2Int);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the LockerPos2 location.");
            }
            else if(strcmp(Location, "LockerPos", true) == 0)
            {
                GetPlayerPos(playerid, LockerPosX, LockerPosY, LockerPosZ);
                LockerPosInt = GetPlayerInterior(playerid);

                dini_FloatSet("Assets.ini", "LockerPosX", LockerPosX);
                dini_FloatSet("Assets.ini", "LockerPosY", LockerPosY);
                dini_FloatSet("Assets.ini", "LockerPosZ", LockerPosZ);
                dini_IntSet("Assets.ini", "LockerPosInt", LockerPosInt);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the LockerPos location.");
            }
            else if(strcmp(Location, "Spawn", true) == 0)
            {
                GetPlayerPos(playerid, SpawnX, SpawnY, SpawnZ);

                SpawnInt = GetPlayerInterior(playerid);
                SpawnWorld = GetPlayerVirtualWorld(playerid);

                dini_FloatSet("Spawn.ini", "SpawnX", SpawnX);
                dini_FloatSet("Spawn.ini", "SpawnY", SpawnY);
                dini_FloatSet("Spawn.ini", "SpawnZ", SpawnZ);
                dini_IntSet("Spawn.ini", "SpawnInt", SpawnInt);
                dini_IntSet("Spawn.ini", "SpawnWorld", SpawnWorld);
                SendClientMessage(playerid, WHITE, "You have successfully re-located the Spawn location.");
            }
            else if(strcmp(Location, "VipClubPos", true) == 0)
            {
                GetPlayerPos(playerid, VipClubPosX, VipClubPosY, VipClubPosZ);
                VipClubVW = GetPlayerVirtualWorld(playerid);
                VipClubInteriorID = GetPlayerInterior(playerid);

                DestroyDynamicPickup(VipClubPickup);

                dini_FloatSet("Assets.ini", "VipClubPosX", VipClubPosX);
                dini_FloatSet("Assets.ini", "VipClubPosY", VipClubPosY);
                dini_FloatSet("Assets.ini", "VipClubPosZ", VipClubPosZ);
                dini_IntSet("Assets.ini", "VipClubVW", VipClubVW);
                dini_IntSet("Assets.ini", "VipClubInteriorID", VipClubInteriorID);

                SendClientMessage(playerid, WHITE, "You have successfully re-located the VipClubPos location.");

                VipClubPickup = CreateDynamicPickup(1239, 23, VipClubPosX, VipClubPosY, VipClubPosZ, VipClubVW, VipClubInteriorID, -1, 150.0);
            }
            else if(strcmp(Location, "VipLockerPos", true) == 0)
            {
                GetPlayerPos(playerid, VipLockerPosX, VipLockerPosY, VipLockerPosZ);
                VipLockerVW = GetPlayerVirtualWorld(playerid);
                VipLockerInteriorID = GetPlayerInterior(playerid);

                DestroyDynamicPickup(VipLockerPickup);

                dini_FloatSet("Assets.ini", "VipLockerPosX", VipLockerPosX);
                dini_FloatSet("Assets.ini", "VipLockerPosY", VipLockerPosY);
                dini_FloatSet("Assets.ini", "VipLockerPosZ", VipLockerPosZ);
                dini_IntSet("Assets.ini", "VipLockerVW", VipLockerVW);
                dini_IntSet("Assets.ini", "VipLockerInteriorID", VipLockerInteriorID);

                SendClientMessage(playerid, WHITE, "You have successfully re-location the VipLockerPos location.");

                VipLockerPickup = CreateDynamicPickup(1239, 23, VipLockerPosX, VipLockerPosY, VipLockerPosZ, VipLockerVW, VipLockerInteriorID, -1, 150.0);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Invalid location.");
            }
        }
    }
    return 1;
}
And could you tell me what is wrong so I can fix it in the future.
Reply
#2

if(sscanf(params, "z", Location)) change to: if(sscanf(params, "s[128]", Location))

Code:
Function:
	sscanf
Params:
	string[] - String to extract parameters from.
	format[] - Parameter types to get.
	{Float,_}:... - Data return variables.
Return:
	0 - Successful, not 0 - fail.
Notes:
	A fail is either insufficient variables to store the data or insufficient
	data for the format string - excess data is disgarded.
 
	A string in the middle of the input data is extracted as a single word, a
	string at the end of the data collects all remaining text.
 
	The format codes are:
 
	c - A character.
	d, i - An integer.
	h, x - A hex number (e.g. a colour).
	f - A float.
	s - A string.
	z - An optional string.
	pX - An additional delimiter where X is another character.
	'' - Encloses a litteral string to locate.
	u - User, takes a name, part of a name or an id and returns the id if they're connected.
Reply
#3

Quote:
Originally Posted by kamzaf
View Post
if(sscanf(params, "z", Location)) change to: if(sscanf(params, "s[128]", Location))

Code:
Function:
	sscanf
Params:
	string[] - String to extract parameters from.
	format[] - Parameter types to get.
	{Float,_}:... - Data return variables.
Return:
	0 - Successful, not 0 - fail.
Notes:
	A fail is either insufficient variables to store the data or insufficient
	data for the format string - excess data is disgarded.
 
	A string in the middle of the input data is extracted as a single word, a
	string at the end of the data collects all remaining text.
 
	The format codes are:
 
	c - A character.
	d, i - An integer.
	h, x - A hex number (e.g. a colour).
	f - A float.
	s - A string.
	z - An optional string.
	pX - An additional delimiter where X is another character.
	'' - Encloses a litteral string to locate.
	u - User, takes a name, part of a name or an id and returns the id if they're connected.
Thanks for the quick reply and thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)