SA-MP Forums Archive
help my with command - 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: help my with command (/showthread.php?tid=611215)



help my with command - organe. - 03.07.2016

hey all, i need a create command for jobs

my code:
Код:
COMMAND:job( playerid, params[ ] )
{
	new CharKintamasis;
	switch( CharKintamasis )
	{
		case 0: CharKintamasis = "Bedarbis";
		case 1: CharKintamasis = "Mechanikas";
		case 2: CharKintamasis = "Policijos Pareigūnas";
	}
	// my cmds...
	format( mystring, 100, "You job is: %s", CharKintamasis );
	SendClientMessage....
	return 1;
}
And i need to the print this: You job is: Mechanikas

what do it ?

sry for my bad english (


Re: help my with command - Stinged - 03.07.2016

Do you save the player's job in a variable or something?


Re: help my with command - Theepiccoder - 03.07.2016

Do you have PlayerInfo defined?
If you do, here:

Код:
#define JOB_LIST 5413

CMD:job(playerid, params[])
{
        ShowPlayerDialog(playerid, JOB_LIST, DIALOG_STYLE_LIST, "Job List", "Job #1\nJob #2\Job #3", "Select", "Nevermind");
        return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        switch(dialogid)
        {
                case JOB_LIST:
                {
                        switch(listitem)
                        {
                                case 0:
                                {
                                        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}JOB: {FFFFFF}Your job is now Job #1");
                                        PlayerInfo[playerid][pJob] = 1; // assuming you have it defined
                                }
                                case 1:
                                {
                                        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}JOB: {FFFFFF}Your job is now Job #2");
                                        PlayerInfo[playerid][pJob] = 2; // assuming you have it defined
                                }
                                case 2:
                                {
                                        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}JOB: {FFFFFF}Your job is now Job #3");
                                        PlayerInfo[playerid][pJob] = 3; // assuming you have it defined
                                }
                        }
                }
        }
        return 1;
}



Re: help my with command - organe. - 03.07.2016

no no no

i need create by this code:
Код:
COMMAND:job( playerid, params[ ] )
{
	new CharKintamasis;
	switch( CharKintamasis )
	{
		case 0: CharKintamasis = "Bedarbis";
		case 1: CharKintamasis = "Mechanikas";
		case 2: CharKintamasis = "Policijos Pareigūnas";
	}
	// my cmds...
	format( mystring, 100, "You job is: %s", CharKintamasis );
	SendClientMessage....
	return 1;
}
what from the string get text

if i have pinfo[ playerid ] [ job ] = 0;
when i write command /job i see this :

You job is: Mechanikas or other job.


Re: help my with command - Stinged - 03.07.2016

Код:
COMMAND:job(playerid, params[])
{
	new CharKintamasis[34];
	switch(pinfo[playerid][job])
	{
		case 0: CharKintamasis = "Bedarbis";
		case 1: CharKintamasis = "Mechanikas";
		case 2: CharKintamasis = "Policijos Pareigūnas";
	}
	// my cmds...
	format(CharKintamasis, sizeof (CharKintamasis), "You job is: %s", CharKintamasis);
	SendClientMessage....
	return 1;
}