PDA

Просмотр полной версии : [Поиск] Курсор мыши



Витёк
09.06.2017, 05:38
Возможно ли в самп определить где именно находится курсор мыши?
Если да то какой функцией если не секрет :blush2:

Seregamil
09.06.2017, 07:04
никакой.

Seviel
09.06.2017, 14:43
В iPleoMax как-то определяют, но в эти дебри я лесть не собираюсь, так что сам разбирайся


forward OnCursorPositionChange(NewX, NewY);
public OnCursorPositionChange(NewX, NewY)
{
if(EditEnabled)
{
switch(EditMode)
{
case EDITMODE_POSITION:
{
if(Project[EditIndex][iUsebox] && Project[EditIndex][iLetterX] == 0.0)
{
Project[EditIndex][iPositionX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iTextX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iPositionY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iTextX], Project[EditIndex][iPositionY]);
} else {
Project[EditIndex][iPositionX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iPositionY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iPositionX], Project[EditIndex][iPositionY]);
}
UpdateTextDraw(EditIndex);
}
case EDITMODE_USEBOX:
{
Project[EditIndex][iPositionX] = (floatdiv(NewX, ScreenWidth) * 640.0) + 2.0;
Project[EditIndex][iLetterY] = ((floatdiv(NewY, ScreenHeight) * 448.0) - Project[EditIndex][iPositionY])/9.0;
Project[EditIndex][iLetterY] -= 0.15;
UpdateTextDraw(EditIndex);
}
case EDITMODE_TEXTUREBOX:
{
Project[EditIndex][iTextX] = (floatdiv((NewX == ScreenWidth - 1) ? ScreenWidth : NewX, ScreenWidth) * 640.0) - Project[EditIndex][iPositionX];
Project[EditIndex][iTextY] = (floatdiv((NewY == ScreenHeight - 1) ? ScreenHeight : NewY, ScreenHeight) * 448.0) - Project[EditIndex][iPositionY];
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iTextX], Project[EditIndex][iTextY]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_SIZE:
{
if(Project[EditIndex][iUsebox] && Project[EditIndex][iLetterX] == 0.0)
{
Project[EditIndex][iLetterY] -= (floatdiv(floatsub(CursorOY, NewY), ScreenWidth) * 640.0)/10.0 * EditSpeed;
Project[EditIndex][iPositionX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
} else {
Project[EditIndex][iTextX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iTextY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iTextX], Project[EditIndex][iTextY]);
}
UpdateTextDraw(EditIndex);
}
case EDITMODE_LETTERSIZE:
{
Project[EditIndex][iLetterX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed * 0.001;
Project[EditIndex][iLetterY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed * 0.01;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iLetterX], Project[EditIndex][iLetterY]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_OUTLINE:
{
Project[EditIndex][iOutline] -= floatround(floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0);
Project[EditIndex][iOutline] -= floatround(floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0);
UpdateTextDraw(EditIndex);
}
case EDITMODE_SHADOW:
{
Project[EditIndex][iShadow] -= floatround(floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0);
Project[EditIndex][iShadow] -= floatround(floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0);
UpdateTextDraw(EditIndex);
}
case EDITMODE_COLOR:
{
HexToRGBA(Project[EditIndex][iColor], Colors[0], Colors[1], Colors[2], Colors[3]);
switch(ColorMode)
{
case COLORMODE_RED: Colors[0] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_GREEN: Colors[1] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
case COLORMODE_BLUE: Colors[2] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_ALPHA: Colors[3] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
}
format(String_Normal, sizeof String_Normal, "~n~~r~R%i~n~~g~G%i~n~~b~B%i~n~~w~A%i", Colors[0], Colors[1], Colors[2], Colors[3]);
GameTextForPlayer(ProjectEditor, String_Normal, 1000, 3);
Project[EditIndex][iColor] = RGBAToHex(Colors[0], Colors[1], Colors[2], Colors[3]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_BGCOLOR:
{
HexToRGBA(Project[EditIndex][iBackgroundcolor], Colors[0], Colors[1], Colors[2], Colors[3]);
switch(ColorMode)
{
case COLORMODE_RED: Colors[0] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_GREEN: Colors[1] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
case COLORMODE_BLUE: Colors[2] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_ALPHA: Colors[3] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
}
format(String_Normal, sizeof String_Normal, "~n~~r~R%i~n~~g~G%i~n~~b~B%i~n~~w~A%i", Colors[0], Colors[1], Colors[2], Colors[3]);
GameTextForPlayer(ProjectEditor, String_Normal, 1000, 3);
Project[EditIndex][iBackgroundcolor] = RGBAToHex(Colors[0], Colors[1], Colors[2], Colors[3]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_BOXCOLOR:
{
HexToRGBA(Project[EditIndex][iBoxcolor], Colors[0], Colors[1], Colors[2], Colors[3]);
switch(ColorMode)
{
case COLORMODE_RED: Colors[0] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_GREEN: Colors[1] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
case COLORMODE_BLUE: Colors[2] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_ALPHA: Colors[3] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
}
format(String_Normal, sizeof String_Normal, "~n~~r~R%i~n~~g~G%i~n~~b~B%i~n~~w~A%i", Colors[0], Colors[1], Colors[2], Colors[3]);
GameTextForPlayer(ProjectEditor, String_Normal, 1000, 3);
Project[EditIndex][iBoxcolor] = RGBAToHex(Colors[0], Colors[1], Colors[2], Colors[3]);
UpdateTextDraw(EditIndex);
}
}
}
return true;
}

Seregamil
09.06.2017, 14:55
В iPleoMax как-то определяют, но в эти дебри я лесть не собираюсь, так что сам разбирайся


forward OnCursorPositionChange(NewX, NewY);
public OnCursorPositionChange(NewX, NewY)
{
if(EditEnabled)
{
switch(EditMode)
{
case EDITMODE_POSITION:
{
if(Project[EditIndex][iUsebox] && Project[EditIndex][iLetterX] == 0.0)
{
Project[EditIndex][iPositionX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iTextX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iPositionY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iTextX], Project[EditIndex][iPositionY]);
} else {
Project[EditIndex][iPositionX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iPositionY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iPositionX], Project[EditIndex][iPositionY]);
}
UpdateTextDraw(EditIndex);
}
case EDITMODE_USEBOX:
{
Project[EditIndex][iPositionX] = (floatdiv(NewX, ScreenWidth) * 640.0) + 2.0;
Project[EditIndex][iLetterY] = ((floatdiv(NewY, ScreenHeight) * 448.0) - Project[EditIndex][iPositionY])/9.0;
Project[EditIndex][iLetterY] -= 0.15;
UpdateTextDraw(EditIndex);
}
case EDITMODE_TEXTUREBOX:
{
Project[EditIndex][iTextX] = (floatdiv((NewX == ScreenWidth - 1) ? ScreenWidth : NewX, ScreenWidth) * 640.0) - Project[EditIndex][iPositionX];
Project[EditIndex][iTextY] = (floatdiv((NewY == ScreenHeight - 1) ? ScreenHeight : NewY, ScreenHeight) * 448.0) - Project[EditIndex][iPositionY];
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iTextX], Project[EditIndex][iTextY]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_SIZE:
{
if(Project[EditIndex][iUsebox] && Project[EditIndex][iLetterX] == 0.0)
{
Project[EditIndex][iLetterY] -= (floatdiv(floatsub(CursorOY, NewY), ScreenWidth) * 640.0)/10.0 * EditSpeed;
Project[EditIndex][iPositionX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
} else {
Project[EditIndex][iTextX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed;
Project[EditIndex][iTextY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iTextX], Project[EditIndex][iTextY]);
}
UpdateTextDraw(EditIndex);
}
case EDITMODE_LETTERSIZE:
{
Project[EditIndex][iLetterX] -= floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0 * EditSpeed * 0.001;
Project[EditIndex][iLetterY] -= floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0 * EditSpeed * 0.01;
ShowValues(Project[EditIndex][iPositionY], Project[EditIndex][iLetterX], Project[EditIndex][iLetterY]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_OUTLINE:
{
Project[EditIndex][iOutline] -= floatround(floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0);
Project[EditIndex][iOutline] -= floatround(floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0);
UpdateTextDraw(EditIndex);
}
case EDITMODE_SHADOW:
{
Project[EditIndex][iShadow] -= floatround(floatdiv(floatsub(CursorOX, NewX), ScreenWidth) * 640.0);
Project[EditIndex][iShadow] -= floatround(floatdiv(floatsub(CursorOY, NewY), ScreenHeight) * 448.0);
UpdateTextDraw(EditIndex);
}
case EDITMODE_COLOR:
{
HexToRGBA(Project[EditIndex][iColor], Colors[0], Colors[1], Colors[2], Colors[3]);
switch(ColorMode)
{
case COLORMODE_RED: Colors[0] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_GREEN: Colors[1] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
case COLORMODE_BLUE: Colors[2] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_ALPHA: Colors[3] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
}
format(String_Normal, sizeof String_Normal, "~n~~r~R%i~n~~g~G%i~n~~b~B%i~n~~w~A%i", Colors[0], Colors[1], Colors[2], Colors[3]);
GameTextForPlayer(ProjectEditor, String_Normal, 1000, 3);
Project[EditIndex][iColor] = RGBAToHex(Colors[0], Colors[1], Colors[2], Colors[3]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_BGCOLOR:
{
HexToRGBA(Project[EditIndex][iBackgroundcolor], Colors[0], Colors[1], Colors[2], Colors[3]);
switch(ColorMode)
{
case COLORMODE_RED: Colors[0] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_GREEN: Colors[1] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
case COLORMODE_BLUE: Colors[2] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_ALPHA: Colors[3] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
}
format(String_Normal, sizeof String_Normal, "~n~~r~R%i~n~~g~G%i~n~~b~B%i~n~~w~A%i", Colors[0], Colors[1], Colors[2], Colors[3]);
GameTextForPlayer(ProjectEditor, String_Normal, 1000, 3);
Project[EditIndex][iBackgroundcolor] = RGBAToHex(Colors[0], Colors[1], Colors[2], Colors[3]);
UpdateTextDraw(EditIndex);
}
case EDITMODE_BOXCOLOR:
{
HexToRGBA(Project[EditIndex][iBoxcolor], Colors[0], Colors[1], Colors[2], Colors[3]);
switch(ColorMode)
{
case COLORMODE_RED: Colors[0] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_GREEN: Colors[1] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
case COLORMODE_BLUE: Colors[2] = floatround( floatdiv((NewY - 1), (ScreenHeight - 2)) * 255.0 );
case COLORMODE_ALPHA: Colors[3] = floatround( floatdiv((NewX - 1), (ScreenWidth - 2)) * 255.0 );
}
format(String_Normal, sizeof String_Normal, "~n~~r~R%i~n~~g~G%i~n~~b~B%i~n~~w~A%i", Colors[0], Colors[1], Colors[2], Colors[3]);
GameTextForPlayer(ProjectEditor, String_Normal, 1000, 3);
Project[EditIndex][iBoxcolor] = RGBAToHex(Colors[0], Colors[1], Colors[2], Colors[3]);
UpdateTextDraw(EditIndex);
}
}
}
return true;
}

Там используется win-only плагин, работающий только, если не ошибаюсь, для хоста.

Seviel
09.06.2017, 15:12
Там используется win-only плагин, работающий только, если не ошибаюсь, для хоста.

Скорее всего вы ошибаетесь, ведь я им(iPleoMax-ом) пользуюсь только на локалке.

Alpano
09.06.2017, 15:25
Скорее всего вы ошибаетесь, ведь я им(iPleoMax-ом) пользуюсь только на локалке.

под словом "хост" имелся в виду именно локалхост.