Command isn't working
#1

pawn Код:
command(movecoords, playerid, params[])
{
    new coords[128];
    if( sscanf( params, "z", coords) )
    {
        if( PlayerInfo[playerid][Admin] >= 4 )
        {
            SendClientMessage( playerid, COLOUR_ORANGE, "Hint: /movecoords (object)" );
            SendClientMessage( playerid, COLOUR_WHITE, "Fish Location >< Fish Location 2 >< Fish Location 3" );
        }
    }
    else
    {
        if( PlayerInfo[playerid][Admin] >= 4 )
        {
            if(strcmp(coords, "Fish Location", true) == 0 )
            {
                GetPlayerPos( playerid, Fishx, Fishy, Fishz);

                dini_FloatSet( "locations.ini", "Fishx", Fishx);
                dini_FloatSet( "locations.ini", "Fishy", Fishy);
                dini_FloatSet( "locations.ini", "Fishz", Fishz);

                SendClientMessage( playerid, PLAYER, "Fish location moved!" );
            }
            else if(strcmp(coords, "Fish Location 2", true) == 0 )
            {
                GetPlayerPos( playerid, Fish2x, Fish2y, Fish2z);

                dini_FloatSet( "locations.ini", "Fish2x", Fish2x);
                dini_FloatSet( "locations.ini", "Fish2y", Fish2y);
                dini_FloatSet( "locations.ini", "Fish2z", Fish2z);

                SendClientMessage( playerid, PLAYER, "Fish location 2 moved!" );
            }
            else if(strcmp(coords, "Fish Location 3", true) == 0 )
            {
                GetPlayerPos( playerid, Fish3x, Fish3y, Fish3z);

                dini_FloatSet( "locations.ini", "Fish3x", Fish3x);
                dini_FloatSet( "locations.ini", "Fish3y", Fish3y);
                dini_FloatSet( "locations.ini", "Fish3z", Fish3z);

                SendClientMessage( playerid, PLAYER, "Fish location 3 moved!" );
            }
        }
    }
    return 1;
}
In game I type /movecoords but instead of saying SendClientMessage( playerid, COLOUR_ORANGE, "Hint: /movecoords (object)" ); it says Fishing Location Moved. Hmm Please help mwa
Reply
#2

pawn Код:
if( sscanf( params, "z", coords) )
That code returns true or 1 if sscanf could make sense of it and place the values in to the 'coords' variable, so you need to add an exclamation mark (!) before you use sscanf, so:

pawn Код:
if(!sscanf(params, "z", coords))
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)