HELP URGENT
#1

Код:
public OnPlayerConnect(playerid)
{
		CP_tatoo = CreateDynamicCP(-201.2237,-42.7339,1002.2734, 2.0, .interiorid = 3); // creating the checkpoint CP_tatoo
    	GameTextForPlayer(playerid,"~r~Welcome~w~ To ~w~ ~b~The ~b~ ~g~server~g~", 5000, 3);
    	return 1;
    	}
    	
  public OnPlayerEnterDynamicCP(playerid, checkpointid) //Add this anywhere
{

   if(checkpointid == CP_tatoo) //Checking if player is in the checkpoint "Tatoo"
   {
   	SendClientMessage(playerid, COLOR_RED, "Start robbery by typing /robthis"); //Sending message so that player knows that to rob. he must type this command
   }
   return 1;
}

CMD:robthis(playerid, params[])
{
    #pragma unused params // we dont need the params
    if(IsPlayerInDynamicCP(playerid, CP_tatoo)) // Checking if player is in the checkpoint
	{
	    if(tatoorobbedrecently >=1) //checking if tatoo shop has been robbed recently
	    {
	        SendClientMessage(playerid, COLOR_RED, "Tatoo Shop has been robbed recently"); // sending error message
         	return 1;
		}
		ROBBING_TATOO[playerid] = 60; // setting the robbery timer
		tatoorobbedrecently =180; // Time the players needs to wait for starting an another robbery in the same place
	}
	return 1;
}

stock GivePlayerScore( playerid, score ) SetPlayerScore( playerid, GetPlayerScore( playerid ) + score );
forward ServerRobbery();
public ServerRobbery()
{

     	for(new i=0; i<MAX_PLAYERS; i++)
		{
		    if(IsPlayerConnected(i)) // checking if player connected
		    {
		        //ROBBERIES
      			if(ROBBING_TATOO[i] > 1) // Checking if robbery time is above 1
		        {
		            ROBBING_TATOO[i] --; // Decreasing time
		            new time[20]; //adding time variable
              		format(time,sizeof(time),"Robbery Time: %d",ROBBING_TATOO[i]);
           			GameTextForPlayer(i,time,500,3); //shows gametext showing the time remaining for the robbery
				}
				if(ROBBING_TATOO[i] == 1) // IF the timer reached 1
				{
                    new string[64], pName[MAX_PLAYER_NAME];// getting player name
    				GetPlayerName(i,pName,MAX_PLAYER_NAME);
					SendClientMessage(i, COLOR_GREEN, "Robbery Complete"); //sending message to the player that robbery was complete
					SetPlayerWantedLevel(i, GetPlayerWantedLevel(i) + 1); //giving player 1 wanted level
					ROBBING_TATOO[i] =0; // RESET timer
					new mrand =random(50000);
     				GivePlayerScore(i,1);
					format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed a total of $%d from the tatoo shop! LOL!",pName,i,mrand);
					SendClientMessageToAll(COLOR_RED,string);
					GivePlayerMoney(i, mrand);
				}
			}
		}
		return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
	if(checkpointid == CP_tatoo) // checking if the player is leaving the CP tatoo
	{
	    if(ROBBING_TATOO[playerid] >= 1) //checking if the person was robbing and his robbery timer was above 1
	    {
	    	SendClientMessage(playerid, COLOR_RED, "[ERROR]Robbery Failed"); //Error message that he failed
	    	ROBBING_TATOO[playerid] =0; // Setting Robbing_tatoo to 0. to stop the counter
	    	return 1;
		}
	}
	return 1;
}
hey guys i wanna ask you how to make more than 1 robbing points?
I mean on above code there is only code for 1 checkpoint how to add more?
Reply
#2

pawn Код:
if(checkpointid == CP_tatoo || checkpointid == CP_Other )

if(IsPlayerInDynamicCP(playerid, CP_tatoo) || IsPlayerInDynamicCP(playerid, CP_Other))

CP_Other = CreateDynamicCP(-201.2237,-42.7339,1002.2734, 2.0, .interiorid = 3);
If u will not understand this, then idk..
easy ni.gga
Reply
#3

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
pawn Код:
if(checkpointid == CP_tatoo || checkpointid == CP_Other )

if(IsPlayerInDynamicCP(playerid, CP_tatoo) || IsPlayerInDynamicCP(playerid, CP_Other))

CP_Other = CreateDynamicCP(-201.2237,-42.7339,1002.2734, 2.0, .interiorid = 3);
If u will not understand this, then idk..
easy ni.gga
Yep. Enigma code
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)