20.03.2012, 21:27
Hello! Working on a weed-script to my RP server. It would not work it says that I'm at the field even if I'm not near a field.
If you look in the debug file so you can see that it has picked up the info as it should.
Here is the cmd as user using to plant a seed:
And enum:
Now I wonder what I'm doing wrong for it not to read properly?
pawn Код:
stock weedspot(playerid)
{
new weed[500];
for(new id; id < MAX_WEEDSPOT; id++)
{
format(weed, sizeof(weed), "SELECT * FROM weedplace WHERE id= %d", id);
mysql_query(weed);
mysql_store_result();
if(mysql_num_rows())
if(mysql_fetch_row_format(weed,"|"))
{
sscanf(weed, "p<|>e<fff>", WeedSpot[id]);
if (IsPlayerInRangeOfPoint(playerid, 2.0, WeedSpot[id][wPos][0],WeedSpot[id][wPos][1],WeedSpot[id][wPos][2])){
return id;
}
}
}
return 1;
}
Код:
[22:11:50] CMySQLHandler::FetchRow() - Return: 3|1527.91, -1266.21, 14.38|1527.91|-1266.21|14.38 [22:11:50] >> mysql_query( Connection handle: 1 ) [22:11:50] CMySQLHandler::Query(SELECT * FROM weedplace WHERE id= 4) - Successfully executed.
pawn Код:
CMD:growweed(playerid, params[])
{
if (Logged[playerid])
{
if (weedspot(playerid)) //check if user is at one of the stored fields
{
if (PlayerInfo[playerid][pSeed] != 0)
{
SendClientMessage(playerid, 0x1EFF00FF, "You have planted a seed, wait for it to grow!");
PlayerInfo[playerid][pSeed]--;
CreateObject(808, 1508.65, -1392.60, 14.24, 0.00, 0.00, 0.00);
}
else SendClientMessage(playerid, 0xFF0000FF, "You must have a seed to plant, go and buy one at your nearest shop!");
}
else SendClientMessage(playerid, 0xFF0000FF,"You are not near a weed field or a weed pot!");
}
return 1;
}
pawn Код:
enum wSpot
{
wPos[3]
}