problem with a command
#1

Hello,
I wrote an command which looks if you're near a pickup I've defined and checks if you've got enough money for this house (I defined). But when I type /wohnen ingame there's no message. I can't locate any error in console and server log.

Script:
Код:
if (strcmp("/wohnen", cmdtext, true) == 0)
	{
		if(pInfo[playerid][neu] == 1)
		{
	  	SendClientMessage(playerid,ROT,"Du hast bereits ein Haus!");
			new bool:foundPickup=false;
			for(new i=0;i<49;i++)
			{
				if(IsPlayerInRangeOfPoint(playerid,5.0,haus[i][0],haus[i][1],haus[i][2]))
				{
					if(GetPlayerMoney(playerid) < hauskosten[i])
					{
				  	// Zu wenig Geld
						new msg[128];
						format(msg, sizeof msg, "Du hast nicht genug Geld fьr diese Immobilie. Du benцtigst %d$",hauskosten[i]);
						SendClientMessage(playerid,ROT,msg);
					}
					else
					{
				  	// Genug Geld
						new Float:Xpos, Float:Ypos, Float:Zpos, Float:fAngle, queryn[128], prin[256];
						new queryx[128], queryy[128], queryz[128], querya[128], pName[MAX_PLAYER_NAME], queryneu[128];
						GetPlayerPos(playerid,Xpos,Ypos,Zpos);
						GetPlayerFacingAngle(playerid,fAngle);
						format(queryx,sizeof queryx,"UPDATE skin SET skin1x = %f WHERE name = '%s'",Xpos,pName);
						mysql_query(queryx);
						format(queryy,sizeof queryy,"UPDATE skin SET skin1y = %f WHERE name = '%s'",Ypos,pName);
						mysql_query(queryy);
 						format(queryz,sizeof queryz,"UPDATE skin SET skin1z = %f WHERE name = '%s'",Zpos,pName);
						mysql_query(queryz);
 						format(querya,sizeof querya,"UPDATE skin SET skin1a = %f WHERE name = '%s'",fAngle,pName);
						mysql_query(querya);
 						format(queryn,sizeof querya,"UPDATE skin SET skin1name = Privatskin WHERE name = '%s'",pName);
						format(prin,sizeof prin,"%s hat gespeichert mit X %f Y %f Z %f und Angle %f",pName,Xpos,Ypos,Zpos,fAngle);
						print(prin);
						pInfo[playerid][neu] = 0;
						format(queryneu,sizeof queryneu,"UPDATE user SET neu = 0 WHERE name = '%s'",pName);
						mysql_query(queryneu);
						GivePlayerMoney(playerid,hauskosten[i]);
	  					foundPickup=true;
						break;
					}

				}
			}
			
			if(foundPickup==false)
			{
				SendClientMessage(playerid,ROT,"Du bist nicht in der Nдhe eines kaufbaren Hauses. Schau auf der Karte nach.");
			}
		}
	}
House definitions:
Код:
new hauskosten[49] =
{
	2500,	1700,	2500,	2000,	2500,	2200,	1800,	4500,	2200,	2000,	1500,	2000,	2500,
	2800,	2500,	2000,	2600,	3000,	3200,	2200,	2400,	2600,	1800,	2000,	2300,	1600,
	3200,	3100,	3600,	3500,	3100,	3000,	3400,	3000,	1800,	2000,	2300,	1600,	3200,
	3200,	1200,	1200,	1200,	1200,	3400,	3400,	3400,	3100
};

new Float:haus[49][3]=
{
	{2067.4065, -1731.6440, 13.8762},
	{2012.3688, -1656.3959, 13.5547},
	{2015.9045, -1641.7181, 13.7824},
	{2016.7020, -1629.7666, 13.5469},
	{2068.7625, -1628.8110, 13.8762},
	{2068.5388, -1643.6956, 13.5469},
	{2067.7371, -1656.8142, 13.5469},
	{2065.5249, -1703.2827, 14.1484},
	{2067.2285, -1716.8826, 13.5547},
	{2014.7258, -1732.8055, 14.2344},
	{2015.3224, -1717.1617, 13.5547},
	{2017.5978, -1702.9974, 14.2344},
	{2015.3224, -1717.1617, 13.5547},
	{2017.5978, -1702.9974, 14.2344},
	{2308.7744, -1715.0220, 14.6496},
	{2306.8833, -1678.7894, 14.0012},
	{2368.2605, -1674.9868, 14.1682},
	{2362.6506, -1644.2437, 13.5313},
	{2409.0989, -1673.8839, 13.6044},
	{2384.6162, -1674.8713, 14.7234},
	{2385.8176, -1712.9901, 14.1796},
	{2402.5837, -1716.0219, 13.9366},
	{2393.0059, -1646.9878, 13.5350},
	{2413.9487, -1647.3440, 14.0119},
	{2451.7817, -1642.4371, 13.7357},
	{2469.4573, -1647.2286, 13.5182},
	{2498.2456, -1642.8578, 13.7826},
	{2513.3696, -1690.8275, 13.5293},
	{2151.2246, -1446.1715, 25.7746},
	{2149.0498, -1433.7584, 25.5391},
	{2150.2231, -1419.2042, 25.9219},
	{2150.2466, -1400.8291, 25.7980},
	{2195.4233, -1442.9932, 25.5391},
	{2192.6489, -1456.0232, 25.5391},
	{2191.5085, -1470.3420, 25.9141},
	{2190.9495, -1487.6495, 25.7746},
	{2451.7817, -1642.4371, 13.7357},
	{2469.4573, -1647.2286, 13.5182},
	{2498.2456, -1642.8578, 13.7826},
	{2513.3696, -1690.8275, 13.5293},
	{2153.4678, -980.8218, 63.2934},
	{2143.1438, -978.2022, 61.3793},
	{2131.4187, -974.4938, 59.7856},
	{2122.4060, -969.7921, 58.2074},
	{767.6899, -1655.5536, 5.6094},
	{766.4616, -1605.9467, 13.8039},
	{768.6107, -1696.8157, 5.1554},
	{769.2280, -1745.7079, 13.0773},
	{768.8572, -1727.3201, 13.4321}
};
I hope you can help
Padarom
Reply


Messages In This Thread
problem with a command - by Padarom - 05.04.2010, 13:33
Re: problem with a command - by pmk1 - 05.04.2010, 20:53
Re: problem with a command - by Padarom - 06.04.2010, 14:03

Forum Jump:


Users browsing this thread: 1 Guest(s)