random Chekpoint
#1

How To Set This To Random Checkpoint ? Player Go To Random Checkpoint Give Money This is Code :
Код:
public OnPlayerEnterCheckpoint(playerid)
{
     if(IsPlayerInRangeOfPoint(playerid, 3.0, 2306.7969,-5.9403,26.7422))
     {
        if(HarvestJob[playerid] == 1){
            HarvestJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
        if(HarvestJob[playerid] == 2){
            HarvestJob[playerid] = 3;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
        if(HarvestJob[playerid] == 3){
            HarvestJob[playerid] = 4;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
        if(HarvestJob[playerid] == 4){
            HarvestJob[playerid] = 5;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
        if(HarvestJob[playerid] == 5){
            HarvestJob[playerid] = 6;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
        if(HarvestJob[playerid] == 6){
            HarvestJob[playerid] = 7;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
        if(HarvestJob[playerid] == 7){
            HarvestJob[playerid] = 0;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            DisablePlayerCheckpoint(playerid);
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
       		new string[200];//We are defining a new string for the formatted message that we are displaying later on.
   			new cash = random(500000);
			GivePlayerMoney(playerid, cash);
			format(string, sizeof(string), "{00FFFF}[Shoghl] {FFFF00}Keshavarze Zahmatkesh {FF0000}Mablaghe {FFFFFF}$%d Va {FF0000}+1 Score {FFFF00}Daryaft Kard!", cash);
			SendClientMessageToAll(COLOR_WHITE, string);
			GameTextForPlayer(playerid,"~w~Mamnoon. ~y~Khaste ~w~Nabashid",4000,3);
         }
     }
     return 1;
}
}
Reply
#2

Код:
public OnPlayerEnterCheckpoint(playerid)
{
     if(IsPlayerInRangeOfPoint(playerid, 3.0, 2306.7969,-5.9403,26.7422))
     {
        if(HarvestJob[playerid] == 1){
            HarvestJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -488.9691,-1454.4095,13.6985))
	 {
        if(HarvestJob[playerid] == 2){
            HarvestJob[playerid] = 3;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
     }
     if(IsPlayerInRangeOfPoint(playerid, 3.0, -491.1559,-1590.0781,6.0986))
     {
        if(HarvestJob[playerid] == 3){
            HarvestJob[playerid] = 4;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -517.1489,-1494.8715,10.6554))
     {
        if(HarvestJob[playerid] == 4){
            HarvestJob[playerid] = 5;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -537.1957,-1495.2427,9.5398))
     {
        if(HarvestJob[playerid] == 5){
            HarvestJob[playerid] = 6;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -538.4468,-1594.6807,7.9598))
     {
        if(HarvestJob[playerid] == 6){
            HarvestJob[playerid] = 7;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -562.2611,-1505.3055,8.7389))
     {
        if(HarvestJob[playerid] == 7){
            HarvestJob[playerid] = 0;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            DisablePlayerCheckpoint(playerid);
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
       		new string[200];//We are defining a new string for the formatted message that we are displaying later on.
   			new cash = random(500000);
			GivePlayerMoney(playerid, cash);
			format(string, sizeof(string), "{00FFFF}[Shoghl] {FFFF00}Keshavarze Zahmatkesh {FF0000}Mablaghe {FFFFFF}$%d Va {FF0000}+1 Score {FFFF00}Daryaft Kard!", cash);
			SendClientMessageToAll(COLOR_WHITE, string);
			GameTextForPlayer(playerid,"~w~Mamnoon. ~y~Khaste ~w~Nabashid",4000,3);
         }
     }
     return 1;
}
Reply
#3

Quote:
Originally Posted by mahardika
Посмотреть сообщение
Код:
public OnPlayerEnterCheckpoint(playerid)
{
     if(IsPlayerInRangeOfPoint(playerid, 3.0, 2306.7969,-5.9403,26.7422))
     {
        if(HarvestJob[playerid] == 1){
            HarvestJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -488.9691,-1454.4095,13.6985))
	 {
        if(HarvestJob[playerid] == 2){
            HarvestJob[playerid] = 3;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
     }
     if(IsPlayerInRangeOfPoint(playerid, 3.0, -491.1559,-1590.0781,6.0986))
     {
        if(HarvestJob[playerid] == 3){
            HarvestJob[playerid] = 4;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -517.1489,-1494.8715,10.6554))
     {
        if(HarvestJob[playerid] == 4){
            HarvestJob[playerid] = 5;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -537.1957,-1495.2427,9.5398))
     {
        if(HarvestJob[playerid] == 5){
            HarvestJob[playerid] = 6;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -538.4468,-1594.6807,7.9598))
     {
        if(HarvestJob[playerid] == 6){
            HarvestJob[playerid] = 7;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
            return 1;
         }
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 3.0, -562.2611,-1505.3055,8.7389))
     {
        if(HarvestJob[playerid] == 7){
            HarvestJob[playerid] = 0;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            DisablePlayerCheckpoint(playerid);
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
       		new string[200];//We are defining a new string for the formatted message that we are displaying later on.
   			new cash = random(500000);
			GivePlayerMoney(playerid, cash);
			format(string, sizeof(string), "{00FFFF}[Shoghl] {FFFF00}Keshavarze Zahmatkesh {FF0000}Mablaghe {FFFFFF}$%d Va {FF0000}+1 Score {FFFF00}Daryaft Kard!", cash);
			SendClientMessageToAll(COLOR_WHITE, string);
			GameTextForPlayer(playerid,"~w~Mamnoon. ~y~Khaste ~w~Nabashid",4000,3);
         }
     }
     return 1;
}
Tnx But This Is Not Random Checkpoint
Reply
#4

you have to make an array which holds the checkpoints co-ords and then create a random function... use this: https://sampwiki.blast.hk/wiki/Random
Reply
#5

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	new rendom = random(6);
	switch(rendom)
	{
		case 1:
		{
        	if(HarvestJob[playerid]){
            	HarvestJob[playerid] ++;
            	SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
            	PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            	SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
			}

         }
        case 2:
		{
        	if(HarvestJob[playerid]){
            	HarvestJob[playerid] ++;
            	SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
            	PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            	SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
			}

         }
         case 3:
		{
        	if(HarvestJob[playerid]){
            	HarvestJob[playerid] ++;
            	SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
            	PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            	SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
			}

         }
         case 4:
		{
        	if(HarvestJob[playerid]){
            	HarvestJob[playerid] ++;
            	SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
            	PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            	SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
			}

         }
         case 5:
		{
        	if(HarvestJob[playerid]){
            	HarvestJob[playerid] ++;
            	SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
            	PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            	SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
			}

         }
		 case 6:
		{
        	if(HarvestJob[playerid]){
            	HarvestJob[playerid] ++;
            	SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
            	PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            	SendClientMessage(playerid,COLOR_LIGHTBLUE,"[Shoghl] {FFFF00}Go To Next Checkpoint");
			}

         }
	}
	if(HarvestJob[playerid] == 7)
	{
            HarvestJob[playerid] = 0;
            PlayerPlaySound(playerid, 1139, 0.0, 0.0, 10.0);
            DisablePlayerCheckpoint(playerid);
            SetPlayerScore(playerid, GetPlayerScore(playerid) + 4);
       		new string[200];//We are defining a new string for the formatted message that we are displaying later on.
   			new cash = random(500000);
			GivePlayerMoney(playerid, cash);
			format(string, sizeof(string), "{00FFFF}[Shoghl] {FFFF00}Keshavarze Zahmatkesh {FF0000}Mablaghe {FFFFFF}$%d Va {FF0000}+1 Score {FFFF00}Daryaft Kard!", cash);
			SendClientMessageToAll(COLOR_WHITE, string);
			GameTextForPlayer(playerid,"~w~Mamnoon. ~y~Khaste ~w~Nabashid",4000,3);
   }
}
hope it helped
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)