SA-MP Forums Archive
Problem with /v buy - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with /v buy (/showthread.php?tid=104111)



Problem with /v buy - Mark k - 22.10.2009

here is the command:
else if(strcmp(x_nr,"buy",true) == 0)
{
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pLevel] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 1 to buy a vehicle!");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 999) { }
else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
else if(PlayerInfo[playerid][pPcarkey3] == 999) { }
else { SendClientMessage(playerid, COLOR_GREY, " You already own 3 vehicles"); return 1; }
if(CarInfo[idcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Someone already owns 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 if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { return 1; }
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);
SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
SendClientMessage(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;
DateProp(playerid);
OnPropUpdate();
OnPlayerUpdate(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]");
SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lock(1-3), sell, sellto, color");
return 1;
}
}
return 1;
}

it writes that i allready have 3 vehicles


Re: Problem with /v buy - Mark k - 23.10.2009

~Up~


Re: Problem with /v buy - MenaceX^ - 23.10.2009

pawn Код:
if(PlayerInfo[playerid][pPcarkey]!=999&&PlayerInfo[playerid][pPcarkey2]!=999&&PlayerInfo[playerid][pPcarkey3]!=999) return SendClientMessage(playerid,color,"You already own 3 vehicles.");



Re: Problem with /v buy - Mark k - 23.10.2009

nope it's giving 4 errors and i forgot to show you somethings in the publics on player register,login and update its like that:
PHP код:
format(var, 64"Car=%d\n",PlayerInfo[playerid][pPcarkey]);fwrite(hFile, var);
format(var, 64"Car2=%d\n",PlayerInfo[playerid][pPcarkey2]);fwrite(hFile, var);
format(var, 64"Car3=%d\n",PlayerInfo[playerid][pPcarkey3]);fwrite(hFile, var); 
PHP код:
format(var, 64"Car=%d\n",PlayerInfo[playerid][pPcarkey]);fwrite(hFile, var);
format(var, 64"Car2=%d\n",PlayerInfo[playerid][pPcarkey2]);fwrite(hFile, var);
format(var, 64"Car3=%d\n",PlayerInfo[playerid][pPcarkey3]);fwrite(hFile, var); 
PHP код:
if( strcmpkey "Car" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPcarkey] = strvalval ); }
                if( 
strcmpkey "Car2" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPcarkey2] = strvalval ); }
                if( 
strcmpkey "Car3" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPcarkey3] = strvalval ); } 



Re: Problem with /v buy - MadeMan - 23.10.2009

Maybe you already have 3?


Re: Problem with /v buy - Mark k - 23.10.2009

no i just dont understand why it's written that i do but i dont if you need my mode i will send it to you by pm


Re: Problem with /v buy - MadeMan - 23.10.2009

Quote:
Originally Posted by Mark k
no i just dont understand why it's written that i do but i dont if you need my mode i will send it to you by pm
Alright


Re: Problem with /v buy - Mark k - 23.10.2009

i sent it to you


Re: Problem with /v buy - Mark k - 24.10.2009

He didnt solve the problem please someone help!


Re: Problem with /v buy - Night Life RP - 24.10.2009

Try That

Код:
	    }
	    else if(strcmp(x_nr,"buy",true) == 0)
	    {
	      if(IsAnOwnableCar(idcar))
	      {
	        if(PlayerInfo[playerid][pLevel] < 3)
			  	{
          	SendClientMessage(playerid, COLOR_GREY, "You need to be level 3 to buy a vehicle!");
          	return 1;
			  	}
			  	if(PlayerInfo[playerid][pPcarkey] == 999) { }
			  	else if(PlayerInfo[playerid][pPcarkey2] == 999) { }
			  	else if(PlayerInfo[playerid][pPcarkey3] == 999) { }
			  	else { SendClientMessage(playerid, COLOR_GREY, "  You already own 3 vehicles"); return 1; }
					if(CarInfo[idcar][cOwned]==1)
					{
				  	SendClientMessage(playerid, COLOR_GREY, "Someone already owns 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 if(PlayerInfo[playerid][pPcarkey3] == 999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
					  else { return 1; }
						CarInfo[idcar][cOwned] = 1;
						GetPlayerName(playerid, sendername, sizeof(sendername));
						strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
						SafeGivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
						PlayerPlayMusic(playerid);
						GameTextForPlayer(playerid, "~w~Congratulations~n~Don't forget to /v park it!", 5000, 3);
						SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
						SendClientMessage(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;
						DateProp(playerid);
						OnPropUpdate();
						OnPlayerUpdate(playerid);
						return 1;
					}
					else
					{
					  SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
					  return 1;
					}
	      }
	    }