/carjacker
#1

hy there...i have a little problem with my carjacker script. When a player is a car jacker he is able to steel any car with the comand /carjack (by using that comand he automaticly receved wanted level 2), any car jacker could use the comand /dropcar once every 30 minutes, and here comes my problem, if the player used the comand and than reloged he could use it instantly without waiting the required time.

Код:
// comanda de iti arata checkpoint //

	if(strcmp(cmd, "/dropcar", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  	{
	    if(PlayerInfo[playerid][pJob] == 5)
			{
			  if(PlayerOnMission[playerid] > 0)
			  {
			    SendClientMessage(playerid, COLOR_GREY, "  On a mission right now, can't use this command!");
			    return 1;
			  }
		    if(PlayerInfo[playerid][pCarTime] == 0)
		    {
		      GameTextForPlayer(playerid, "~w~Car Selling ~n~~r~Drop the car at the Garage", 5000, 1);
		      CP[playerid] = 1;
		      SetPlayerCheckpoint(playerid, 1699.0282,-2083.3892,13.1442,8.0);
		    }
		    else
		    {
		      SendClientMessage(playerid, COLOR_GREY, "  You already Dropped a car, wait till your reload time is over!");
		    }
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "  You are not a Store Robber!");
			}
		}//not connected
		return 1;
	}

	// asta e in public OnPlayerEnterCheckpoint(playerid) //


	else if(CP[playerid]==1)
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    new vehicleid = GetPlayerVehicleID(playerid);
			if(gLastCar[playerid] >= 200)
			{
			  PlayerInfo[playerid][pJackSkill] ++;
				if(PlayerInfo[playerid][pJackSkill] == 50)
				{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 2, you will earn more Money and quicker Reload Time."); }
				else if(PlayerInfo[playerid][pJackSkill] == 100)
				{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 3, you will earn more Money and quicker Reload Time."); }
				else if(PlayerInfo[playerid][pJackSkill] == 200)
				{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 4, you will earn more Money and quicker Reload Time."); }
				else if(PlayerInfo[playerid][pJackSkill] == 400)
				{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 5, you will earn more Money and quicker Reload Time."); }
				new level = PlayerInfo[playerid][pJackSkill];
				if(level >= 0 && level <= 50)
				{
				  new rand = random(sizeof(SELLCAR1));
				  format(string, sizeof(string), "You sold a car for $%d, your reload time is 30 minutes.", SELLCAR1[rand]);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					SafeGivePlayerMoney(playerid, SELLCAR1[rand]);
				  PlayerInfo[playerid][pCarTime] = 1800;
				  SetVehicleToRespawn(vehicleid);
				}
				else if(level >= 51 && level <= 100)
				{
				  new rand = random(sizeof(SELLCAR2));
				  format(string, sizeof(string), "You sold a car for $%d, your reload time is 25 minutes.", SELLCAR2[rand]);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					SafeGivePlayerMoney(playerid, SELLCAR2[rand]);
				  PlayerInfo[playerid][pCarTime] = 1500;
				  SetVehicleToRespawn(vehicleid);
				}
				else if(level >= 101 && level <= 200)
				{
				  new rand = random(sizeof(SELLCAR3));
				  format(string, sizeof(string), "You sold a car for $%d, your reload time is 20 minutes.", SELLCAR3[rand]);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					SafeGivePlayerMoney(playerid, SELLCAR3[rand]);
				  PlayerInfo[playerid][pCarTime] = 1200;
				  SetVehicleToRespawn(vehicleid);
				}
				else if(level >= 201 && level <= 400)
				{
				  new rand = random(sizeof(SELLCAR4));
				  format(string, sizeof(string), "You sold a car for $%d, your reload time is 15 minutes.", SELLCAR4[rand]);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					SafeGivePlayerMoney(playerid, SELLCAR4[rand]);
				  PlayerInfo[playerid][pCarTime] = 900;
				  SetVehicleToRespawn(vehicleid);
				}
				else if(level >= 401)
				{
				  new money = 500;
				  format(string, sizeof(string), "You sold a car for $%d, your reload time is 10 minutes.", money);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					SafeGivePlayerMoney(playerid, money);
				  PlayerInfo[playerid][pCarTime] = 600;
				  SetVehicleToRespawn(vehicleid);
				}
			}
			GameTextForPlayer(playerid, "~y~Sold the car", 2500, 1);
			CP[playerid] = 0;
		  DisablePlayerCheckpoint(playerid);
		  SetVehicleToRespawn(GetPlayerVehicleID(playerid));
		}
		else
		{
		  GameTextForPlayer(playerid, "Not in a car", 5000, 1);
		}
	}


	// new //

	new SELLCAR1[] = { 100, 112, 125, 139, 145, 154, 166, 176, 185, 196, 200 };
	new SELLCAR2[] = { 209, 213, 225, 237, 247, 256, 264, 271, 286, 298, 300 };
	new SELLCAR3[] = { 305, 317, 321, 337, 344, 355, 368, 371, 385, 396, 400 };
	new SELLCAR4[] = { 407, 413, 425, 438, 442, 456, 463, 475, 487, 491, 500 };

	// si in public SetPlayerUnjail() //

	if(PlayerInfo[i][pCarTime] > 0)
	{
		if(PlayerInfo[i][pCarTime] <= 0)
		{
			PlayerInfo[i][pCarTime] = 0;
		}
		else
		{
			PlayerInfo[i][pCarTime] -= 1;
		}
	}
Reply
#2

Can no one help ?

I have something else to add, this function work properly on my test server witch runs on windows, but it doesn't work on my host ...wich runs on Linux.
Reply
#3

Put in OnPlayerConnect, PlayerInfo[playerid][pCarTime] != 0
Reply
#4

whether it should be as


Quote:

if(PlayerInfo[playerid][pCarTime] <= 0)
{
PlayerInfo[playerid][pCarTime] = 0;
}
else
{
PlayerInfo[playerid][pCarTime] -= 1;


sorry my bad english
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)