Mission
#1

Hellou,When I start doing Mission
* next time you point me
* Add new player
[and the same point as I did without a mission: (
* I can not find a bug

Code :

Код:
#include <a_samp>



#define DIALOG_SECURITY 100
#define DIALOG_SECURITY2 200

new SecurityMission;
new JOB2[MAX_PLAYERS]; // Security Povolanн
new JOB[MAX_PLAYERS];
new pickup_security;
new body[MAX_PLAYERS];


new jobs[MAX_PLAYERS];//...
new Float: checkpoints[][8] =
{
{ 2153.2192,945.8641,10.8203,3.0 },
{ 2121.6907,905.4733,10.8203,3.0 }, // 2
{ 2037.7532,999.4741,10.6719 ,3.0 },//3
{ 2597.7217,2269.4827,10.8133,3.0 },//4
{ 2171.0691,1683.3202,10.8203, 3.0},//5
{ 2217.9463,1836.0540,10.8203,3.0 },//6
{ 2181.4563,1994.0330,10.8203, 3.0},//7
{ 2459.5520,2039.9741,10.8203, 3.0} //8
};
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("JOB JOB");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/job", true))
    {
        new string[128];
        if(JOB[playerid] == 0) return SendClientMessage(playerid,-1,"Jsi nezaměstanэ");
		else
		JOB[playerid] = 1;
		format(string,sizeof string,"Vaљe Body - %d ",Jmeno(playerid),body);
 		ShowPlayerDialog(playerid,300,DIALOG_STYLE_MSGBOX,"Tvoje Body",string,"OK","");
		return 1;
        // Returning 1 informs the server that the command has been processed.
        // OnPlayerCommandText won't be called in other scripts.
    }
    return 0;
    // Returning 0 informs the server that the command hasn't been processed by this script.
    // OnPlayerCommandText will be called in other scripts until one returns 1.
    // If no scripts return 1, the 'SERVER: Unknown Command' message will be shown.
}

public OnGameModeInit()
{

    SetGameModeText("Test Mod");
    pickup_security = CreatePickup(1581, 1, 1904.4683,964.6888,10.8203,-1);

    return 1;
}

public OnGameModeExit()
{
    return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == pickup_security)
    {
        ShowPlayerDialog(playerid,DIALOG_SECURITY,DIALOG_STYLE_LIST,"Security","Zaměstnat se\nSkin\nInformace\nZačнt Misi\nVэpověd","Vybrat","Odejнt");
    }
    return 1;
}
/*public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (newkeys == KEY_FIRE)
	{
		if (IsPlayerInAnyVehicle(playerid))//je li hrac v aute
		if(GetPlayerVehicleID(playerid) != 428)// co ted?
		if(jobs[playerid] == 20) return SendClientMessage(playerid, 0xFFFFFF, "[ JOB ] Jiћ dělбљ misi!");//spatne dani text
		JOB[playerid]= 1;
		{
		new rand = random(sizeof(checkpoints));
 		SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
		JOB2[playerid] = 0;
 		jobs[playerid] = 20;
  		}
	}
	return 1;
}*/

public OnPlayerEnterCheckpoint(playerid)
{
 
    switch(JOB2[playerid])
    {
 
    case 0: // CP 1
    {

    DisablePlayerCheckpoint(playerid);new rand = random(sizeof(checkpoints));
    body[playerid]+= 1;
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
    
	}
	case 1: // CP 1
	{
	DisablePlayerCheckpoint(playerid);
	new rand = random(sizeof(checkpoints));
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);

    }
    case 2: // CP 1
	{
	DisablePlayerCheckpoint(playerid);
	body[playerid]+= 1;
	new rand = random(sizeof(checkpoints));
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
	
    }
    case 3:// CP 1
	{
	DisablePlayerCheckpoint(playerid);
	body[playerid]+= 1;
 	new rand = random(sizeof(checkpoints));
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);

    }
    case 4:// CP 1
	{
	DisablePlayerCheckpoint(playerid);
	body[playerid]+= 1;
	new rand = random(sizeof(checkpoints));
	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
	}
    case 5:// CP 1
	{
	DisablePlayerCheckpoint(playerid);
	body[playerid]+= 1;
	new rand = random(sizeof(checkpoints));
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);

    }
    case 6:// CP 1
	{
	DisablePlayerCheckpoint(playerid);
	body[playerid]+= 1;
	new rand = random(sizeof(checkpoints));
	body[playerid]+= 1;
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);

    }
    case 7:// CP 1
	{
	DisablePlayerCheckpoint(playerid);
	body[playerid]+= 1;
	new rand = random(sizeof(checkpoints));
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
	
    }// CP 1
    case 8:// CP 1
	{
	DisablePlayerCheckpoint(playerid);
	body[playerid]+= 1;
	new rand = random(sizeof(checkpoints));
  	SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
	}
}
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_SECURITY)
    {
        if(response) // If they clicked 'Select' or double-clicked a weapon
        {
            // Give them the weapon
            if(listitem == 0) // They selected the first item - Desert Eagle
            {
                if(JOB[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFF, "[ JOB ] Jsi zde zaměstnбn!");
                JOB[playerid]= 1;
                SendClientMessage(playerid,0xFFFFFFF,"Zaměstal jsi se u Security!");
            }
            if(listitem == 1) // They selected the second item - AK-47
            {
                SetPlayerSkin(playerid,71);
            }
            if(listitem == 2) // They selected the third item - Desert Eagle
            {
                ShowPlayerDialog(playerid,DIALOG_SECURITY2,DIALOG_STYLE_MSGBOX,"Informace o Security "," Topped","OK",""); // Give them a Combat Shotgun
   			}
            if(listitem == 3) // They selected the third item - Desert Eagle
            {
			
				if(jobs[playerid] == 20) return SendClientMessage(playerid, 0xFFFFFF, "[ JOB ] Jiћ dělбљ misi!");
                if(IsPlayerInVehicle(playerid, 428))
                SecurityMission = CreateVehicle(428,1905.1967,937.9476,10.8259,0, 0, 1, -1);
                PutPlayerInVehicle(playerid,SecurityMission,0);//dela to vsude nebo jenom tady to nevнm ale kdyћ zac(nu misi tak prvnн CP jde dobr(e pak mб bэt druhej a je u birgady :/
                new rand = random(sizeof(checkpoints));
                SetPlayerCheckpoint(playerid,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],checkpoints[rand][3]);
                JOB2[playerid] = 0;
                jobs[playerid] = 20; // Give them a Combat Shotgun
            }
            if(listitem == 4) // They selected the third item - Desert Eagle
            {
                 if(JOB[playerid] == 0) return SendClientMessage(playerid, 0xFFFFFFF, "[ JOB ]Nejsi zde zaměstnбn!");
                 JOB[playerid]= 0;
                 SendClientMessage(playerid,0xFFFFFFF,"Podal jsi vэpove");
                 // Give them a Combat Shotgun
            }
        }
        return 1;// We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
    return 0;
}

public OnPlayerConnect(playerid)
{   
    /* new string[128];
     format(string,sizeof(string),"Body %s");
     ShowPlayerDialog(playerid, DIALOG_SECURITY, DIALOG_STYLE_MSGBOX,"Mission", string, "OK", "Esc");*/
    // new string[128],Body[5];
	 //format(string,sizeof string,"Body hrбče %s - %d",Jmeno(playerid),Body[playerid]);
	 //SendClientMessageToAll(0xFFFFFFAA,string);
     
     return 1;
}
    

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
	

	SetPlayerPos(playerid,1905.1967,937.9476,10.8347);
    
    return 1;
}
stock Jmeno(playerid)
{
	new n[MAX_PLAYER_NAME];
	GetPlayerName(playerid,n,sizeof(n));
	return n;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)