Jump to content
  • 0

Problema Masini personale


Alecsandro

Question

Salut stiu ca nu e o problema dar am nevoie de ajutor si nush cum sa fac.

Am sistemul la masini personale cu /v lock , park , buy etc

Si vreau sa fie fare prefixul /v" vreau sa fac /lockcar /parkcar cu aceleasi coduri de comanda.

Exemplu  /v buy sa-l fac /buyvehicle

if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SCM(playerid, COLOR_GREY, "   You need to login first ! ");
	            return 1;
	        }
	        new x_nr[64];
	        x_nr = strtok(cmdtext, idx);
	        if(!strlen(x_nr))
	        {
	            SCM(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]");
	            SCM(playerid, COLOR_WHITE, "Available names: park, lock1,lock2 sell, sellto, color, tow1, tow2 locate1,locate2, plate");
	            return 1;
	        }
else if(strcmp(x_nr,"buy",true) == 0)
	        {
	            if(IsAnOwnableCar(idcar))
	            {
	                if(PlayerInfo[playerid][pLevel] < 4)
			    	{
                    	SendClientMessage(playerid, COLOR_GREY, "You need to be level 4 to buy a vehicle!");
                    	return 1;
			    	}
			    	if(PlayerInfo[playerid][pPcarkey] == 999) { }
			    	else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
			    	else { SendClientMessage(playerid, COLOR_WHITE, "You owned already two cars"); return 1; }
					if(CarInfo[idcar][cOwned]==1)
					{
				    	SendClientMessage(playerid, COLOR_WHITE, "Someone owned already this car");
				    	return 1;
					}
					if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
					{
					    if(PlayerInfo[playerid][pPcarkey] == 999) { PlayerInfo[playerid][pPcarkey] = idcar; }
					    else if(PlayerInfo[playerid][pPcarkey2] == 999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
					    else { return 1; }
						CarInfo[idcar][cComponent0] = 0;
						CarInfo[idcar][cComponent1] = 0;
						CarInfo[idcar][cComponent2] = 0;
						CarInfo[idcar][cComponent3] = 0;
						CarInfo[idcar][cComponent4] = 0;
						CarInfo[idcar][cComponent5] = 0;
						CarInfo[idcar][cComponent6] = 0;
						CarInfo[idcar][cComponent7] = 0;
						CarInfo[idcar][cComponent8] = 0;
						CarInfo[idcar][cComponent9] = 0;
						CarInfo[idcar][cComponent10] = 0;
						CarInfo[idcar][cComponent11] = 0;
						CarInfo[idcar][cComponent12] = 0;
						CarInfo[idcar][cComponent13] = 0;
						CarInfo[idcar][cOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
						GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
						PlayerPlayMusic(playerid);
						GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /v park it!", 5000, 3);
						SCM(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
						SCM(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!");
						SendClientMessage(playerid, COLOR_YELLOW2, "You can start the engine up now !");
						gEngine[playerid] = 0;
						engineOn[GetPlayerVehicleID(playerid)] = false;
						OnPropUpdate();
						OnPlayerUpdate(playerid);
						TogglePlayerControllable(playerid, 1);
						return 1;
					}
					else
					{
					    SCM(playerid, COLOR_GREY, "  You don't have enough cash with you ! ");
					    return 1;
					}
	            }
	        }

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.