14.01.2014, 00:10
So basically, I made a /spawnboat command where it opens a dialog. However, I wanted a way to check if the player is in water. Well I got help with this the other day, and someone gave me this stock:
I am not knowledgeable with stocks in anyway, and I would like to learn more about them (if someone has a link to where I could learn about them, or you could take the time to explain it to me). Back to the point, when I do my /spawnboat command, it just shows me the menu, even though I'm on land. My question is, why is this happening? Here's my command. I'd just like some help if anyone can help me.
Код:
static stock IsPlayerInWater( playerid ) //Credits to Synchro for his coords function. { static Float:fX, Float:fY, Float:fZ ; GetPlayerPos( playerid, fX, fY, fZ ); if((fX >= 2044.6 && fX <= 2192.984 && fY >= 1206.358 && fY <= 1376.552) && fZ < 0xA) return true; else if((fX >= 2048.504 && fX <= 2185.174 && fY >= 1063.239 && fY <= 1202.49) && fZ < 0xA) return true; else if((fX >= 2204.698 && fX <= 2204.698 && fY >= 1426.837 && fY <= 1430.705) && fZ < 0xA) return true; else if((fX >= 2032.885 && fX <= 2114.887 && fY >= 1852.325 && fY <= 1991.575) && fZ < 0xC) return true; else if((fX >= 2517.086 && fX <= 2606.897 && fY >= 2316.493 && fY <= 2420.93) && fZ < 0x16) return true; else if((fX >= 2554.5996 && fX <= 2507.7683 && fY >= 1548.6178 && fY <= 1588.9154) && fZ < 0xF) return true; else if((fX >= -2043.628 && fX <= -1973.561 && fY >= -980.9415 && fY <= -724.0283) && fZ < 0x20) return true; else if((fX >= -2753.912 && fX <= -2665.071 && fY >= -522.3632 && fY <= -380.3444) && fZ < 0x05) return true; else if((fX >= 1219.864 && fX <= 1292.118 && fY >= -2435.881 && fY <= -2325.344) && fZ < 0xF) return true; else if((fX >= 1923.388 && fX <= 2010.854 && fY >= -1223.924 && fY <= -1168.656) && fZ < 0x16) return true; else if((fX >= 1269.301 && fX <= 1314.935 && fY >= -837.0452 && fY <= -781.7769) && fZ < 0x5A) return true; else if((fX >= 1087.3953 && fX <= 1102.3138 && fY >= -682.6734 && fY <= -663.0043) && fZ < 0x71) return true; else if((fX >= 1268.6118 && fX <= 1291.8774 && fY >= -784.2910 && fY <= -764.6104) && fZ < 0x43D) return true; else if(fZ < 0xF) return true; else return false; }
Код:
CMD:spawnboat(playerid, params[]) { new currentvehicle; currentvehicle = GetPlayerVehicleID(playerid); if(IsPlayerInWater( playerid )) { } else { SendClientMessage(playerid, COLOR_RED, "You're not in water, therefore a boat will not be spawned!"); } if(IsPlayerInAnyVehicle(playerid)) { DestroyVehicle(currentvehicle); ShowPlayerDialog(playerid,19,DIALOG_STYLE_LIST,""COL_BLUE"Boats:",""COL_ORANGE"Test\n","Select","Cancel"); } else { ShowPlayerDialog(playerid,19,DIALOG_STYLE_LIST,""COL_BLUE"Boats:",""COL_ORANGE"Test\n","Select","Cancel"); } return 1; }