SA-MP Forums Archive
strmp to zcmd - 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: strmp to zcmd (/showthread.php?tid=513595)



strmp to zcmd - Shazwan - 17.05.2014

how to edit this to zcmd??

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/tune", true))
{
		new playerstate = GetPlayerState(playerid);
		if(playerstate == PLAYER_STATE_DRIVER)
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 1256.05, -1469.17, 13.61))
		{
        ShowPlayerDialog(playerid, DIALOG_TYPE_MAIN, DIALOG_STYLE_LIST, "Tuning Garage", "Paint Jobs\nColors\nHoods\nVents\nLights\nExhausts\nFront Bumpers\nRear Bumpers\nRoofs\nSpoilers\nSide Skirts\nBullbars\nWheels\nCar Stereo\nHydraulics\nNitrous Oxide\nRepair Car", "Enter", "Close");
		return 1;
		}
		else
		{
		   return SendClientMessage(playerid, COLOR_RED, "SERVER: You need to be in a Tuning garage.");		}
		}
return 0;
}



Re: strmp to zcmd - saikumar - 17.05.2014

pawn Код:
CMD:tune(playerid, params[ ])
{
        new playerstate = GetPlayerState(playerid);
        if(playerstate == PLAYER_STATE_DRIVER)
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1256.05, -1469.17, 13.61))
        {
        ShowPlayerDialog(playerid, DIALOG_TYPE_MAIN, DIALOG_STYLE_LIST, "Tuning Garage", "Paint Jobs\nColors\nHoods\nVents\nLights\nExhausts\nFront Bumpers\nRear Bumpers\nRoofs\nSpoilers\nSide Skirts\nBullbars\nWheels\nCar Stereo\nHydraulics\nNitrous Oxide\nRepair Car", "Enter", "Close");
        return 1;
        }
        else
        {
           return SendClientMessage(playerid, COLOR_RED, "SERVER: You need to be in a Tuning garage.");     }
        }
        return 1;
}



Re: strmp to zcmd - Ciandlah - 17.05.2014

Код:
COMMAND:tune(playerid, params[])
{
	new playerstate = GetPlayerState(playerid);
	if(playerstate == PLAYER_STATE_DRIVER)
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1256.05, -1469.17, 13.61))
	{
        ShowPlayerDialog(playerid, DIALOG_TYPE_MAIN, DIALOG_STYLE_LIST, "Tuning Garage", "Paint Jobs\nColors\nHoods\nVents\nLights\nExhausts\nFront Bumpers\nRear Bumpers\nRoofs\nSpoilers\nSide Skirts\nBullbars\nWheels\nCar Stereo\nHydraulics\nNitrous Oxide\nRepair Car", "Enter", "Close");
		return 1;
	}
	else return SendClientMessage(playerid, COLOR_RED, "SERVER: You need to be in a Tuning garage.");	}
	}
	return 1;
}
If this has help you in anyway to learn, There might be a warning but youll have to figure that out, im just giving you an Idea, however if this has helkped you out in anyway +1 rep me


Re: strmp to zcmd - Shazwan - 17.05.2014

below the

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
=============here =======




Re: strmp to zcmd - Ciandlah - 17.05.2014

No, you do not need to place anything in there, Leave it blank

Place the commands at the bottom of your script anywhere


Re: strmp to zcmd - SAMProductions - 17.05.2014

Try This :-
pawn Код:
CMD:tune(playerid, params[])
{
    new playerstate = GetPlayerState(playerid);
    if(playerstate == PLAYER_STATE_DRIVER)
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1256.05, -1469.17, 13.61))
    {
        ShowPlayerDialog(playerid, DIALOG_TYPE_MAIN, DIALOG_STYLE_LIST, "Tuning Garage", "Paint Jobs\nColors\nHoods\nVents\nLights\nExhausts\nFront Bumpers\nRear Bumpers\nRoofs\nSpoilers\nSide Skirts\nBullbars\nWheels\nCar Stereo\nHydraulics\nNitrous Oxide\nRepair Car", "Enter", "Close");
        return 1;
    }
    else
    {
        return SendClientMessage(playerid, COLOR_RED, "SERVER: You need to be in a Tuning garage.");     }
    }
    return 1;
}
Put that somewhere in your GameMode, Don't put that on any Callbacks.


Re: strmp to zcmd - Parallex - 17.05.2014

Make sure to add this callback somewhere:
pawn Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success == 0)
return SendClientMessage(playerid,0xFF000AA,"Put your Error Message over here if invalid command."); // Optional.
return 1;
}
Also, converting the tune command into ZCMD:
pawn Код:
CMD:tune(playerid, params[])
{
        new playerstate = GetPlayerState(playerid);
        if(playerstate == PLAYER_STATE_DRIVER)
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1256.05, -1469.17, 13.61))
        {
        ShowPlayerDialog(playerid, DIALOG_TYPE_MAIN, DIALOG_STYLE_LIST, "Tuning Garage", "Paint Jobs\nColors\nHoods\nVents\nLights\nExhausts\nFront Bumpers\nRear Bumpers\nRoofs\nSpoilers\nSide Skirts\nBullbars\nWheels\nCar Stereo\nHydraulics\nNitrous Oxide\nRepair Car", "Enter", "Close");
        return 1;
        }
        else
        {
           return SendClientMessage(playerid, COLOR_RED, "SERVER: You need to be in a Tuning garage.");     }
        }
        return 1;
}
Make sure it's out of any callback [CMD:tune].


Re: strmp to zcmd - Shazwan - 17.05.2014

it say, sorry kinda confused

Quote:

warning 209: function "cmd_tune" should return a value
error 010: invalid function or declaration




Re: strmp to zcmd - JuanStone - 17.05.2014

pawn Код:
CMD:tune(playerid, params[])
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 1256.05, -1469.17, 13.61))
        {
            ShowPlayerDialog(playerid, DIALOG_TYPE_MAIN, DIALOG_STYLE_LIST, "Tuning Garage", "Paint Jobs\nColors\nHoods\nVents\nLights\nExhausts\nFront Bumpers\nRear Bumpers\nRoofs\nSpoilers\nSide Skirts\nBullbars\nWheels\nCar Stereo\nHydraulics\nNitrous Oxide\nRepair Car", "Enter", "Close");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "SERVER: You need to be in a Tuning garage.");
        }
    }
    return 1;
}



Re: strmp to zcmd - Threshold - 17.05.2014

It can literally go anywhere in your script, as long as it isn't under any form of callback or function. Place it at the bottom of your script if you want to.

pawn Код:
CMD:tune(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "SERVER: You must be in a vehicle to tune it.");
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1256.05, -1469.17, 13.61))
        ShowPlayerDialog(playerid, DIALOG_TYPE_MAIN, DIALOG_STYLE_LIST, "Tuning Garage", "Paint Jobs\nColors\nHoods\nVents\nLights\nExhausts\nFront Bumpers\nRear Bumpers\nRoofs\nSpoilers\nSide Skirts\nBullbars\nWheels\nCar Stereo\nHydraulics\nNitrous Oxide\nRepair Car", "Enter", "Close");
    else
        SendClientMessage(playerid, COLOR_RED, "SERVER: You need to be in a Tuning garage.");
    return 1;
}