Need help with Admin Sell Car Command Problem
#1

Код:
	if(!strcmp(cmdtext, "/asellcar", true)) // By Matthew
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
	            return 1;
	        }
	        if(PlayerInfo[playerid][pAdmin] >= 1337)
	        {
	            new vehid = GetPlayerVehicleID(playerid);
	            new Float:x,Float:y,Float:z;
         		new Float:a;
         		CarInfo[vehid][cOwned] = 0;
         		strmid(CarInfo[vehid][cOwner], "The State", 0, strlen("The State"), 999);
         		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
         		GameTextForPlayer(playerid, "~w~You have admin sold the vehicle!", 10000, 3);
         		GetVehiclePos(vehid, x, y, z);
         		GetVehicleZAngle(vehid, a);
         		CarInfo[vehid][cLocationx] = 7497.1460;
         		CarInfo[vehid][cLocationy] = -926.4014;
         		CarInfo[vehid][cLocationz] = -7.0675;
         		CarInfo[vehid][cAngle] = 270.7372;


				// Fixed Car System

         		for(new i = 0; i < MAX_PLAYERS; i ++)
			    {
			        if(IsPlayerConnected(i))
			        {
						if(PlayerInfo[i][pPcarkey] == vehid || PlayerInfo[i][pPcarkey2] == vehid)
			            {
			                if(PlayerInfo[i][pPcarkey] == vehid) PlayerInfo[i][pPcarkey] = 9999;
			                else if(PlayerInfo[i][pPcarkey2] == vehid) PlayerInfo[i][pPcarkey2] = 9999;

			                SafeGivePlayerMoney(i, GetVehiclePrice(vehid) / 2);
						}
						else
						{
						    format(string, sizeof(string),"LARP/Users/%s.ini",CarInfo[vehid][cOwner]);
			         		new totalcash = dini_Int(string,"Money") + GetVehiclePrice(vehid);
			         		dini_IntSet(string,"Money",totalcash);

			         		if(dini_Int(string,"Car") == vehid)
			         		{
			         		    dini_IntSet(string,"Car",9999);
			         		    strmid(PlayerInfo[i][pPcarkey], "9999", 0, strlen("9999"), 9999);
							}
							else if(dini_Int(string,"Car2") == vehid)
			         		{
			         		    dini_IntSet(string,"Car2",9999);
			         		    strmid(PlayerInfo[i][pPcarkey], "9999", 0, strlen("9999"), 9999);
							}
						}
					}
				}

				// End Of Fix for the Car-Sell system //

         		RemovePlayerFromVehicle(playerid);
         		TogglePlayerControllable(playerid, 1);
         		OnPropUpdate(4,vehid);
         		DestroyVehicle(vehid);
				CreateVehicle(CarInfo[vehid][cModel],CarInfo[vehid][cLocationx],CarInfo[vehid][cLocationy],CarInfo[vehid][cLocationz]+1.0,CarInfo[vehid][cAngle],CarInfo[vehid][cColorOne],CarInfo[vehid][cColorTwo],60000);
	            return 1;
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You're not authorized to use that command !");
	            return 1;
	        }
	    }
	    return 1;
	}
I've done that so far, How would I make it so when I use /asellcar, It edits the car-owner file, and changes there pPcarkey1/2 to 9999 which ever car is sold? how do I get the username, of the car im in?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)