Giter Club home page Giter Club logo

Comments (14)

nexquery avatar nexquery commented on September 20, 2024 1

Use hooked macros first. Because the macros will add the file and line number to the plugin when your game mod is compiled.

A simple example: Change CreateDynamicPlayerTextDraw to CreatePlayerTextDraw.

This is an example of how to use a clickable textdraw.

// * Includes *
#include "a_samp.inc"
#include "colors.inc"
#include "textdraw-streamer.inc"
 
// * Variables *
new PlayerText: MainMenuBtns[MAX_PLAYERS][3];
 
// * Main *
main()
{
    print("Main Menu test...");
}
 
// * On Game Mode Init *
public OnGameModeInit()
{
 
    return 1;
}
 
// * On Game Mode Init *
public OnGameModeExit()
{
 
    return 1;
}
 
// * On Player Connect *
public OnPlayerConnect(playerid)
{
    if(!IsPlayerNPC(playerid))
    {
        CreateMainMenuPlayerTD(playerid);
        ShowMainMenuTD(playerid);
    }
    return 1;
}
 
// * On Click Dynamic Player Textdraw *
public OnClickDynamicPlayerTextDraw(playerid, PlayerText: textid)
{
	// Main Menu textdraws opened
    if(GetPVarInt(playerid, "main_menu_td") == 1)
	{
		if(textid == MainMenuBtns[playerid][0])
		{
			SendClientMessage(playerid, -1, "PLAY");
			return 0;
		}
		
		if(textid == MainMenuBtns[playerid][1])
		{
			SendClientMessage(playerid, -1, "RULES");
			return 0;
		}
	
		if(textid == MainMenuBtns[playerid][2])
		{
			SendClientMessage(playerid, -1, "CREDITS");
			return 0;
		}
	}
    return 0;
}

public OnCancelDynamicTextDraw(playerid)
{
	// Main Menu textdraws opened
    if(GetPVarInt(playerid, "main_menu_td") == 1)
	{
		HideMainMenuTD(playerid);
	}
	return 1;
}

// * Functions *
CreateMainMenuPlayerTD(playerid)
{
    MainMenuBtns[playerid][0] = CreateDynamicPlayerTextDraw(playerid, 570.000000, 155.000000, "PLAY");
    DynamicPlayerTextDrawFont(playerid, MainMenuBtns[playerid][0], 2);
    DynamicPlayerTextDrawLetterSize(playerid, MainMenuBtns[playerid][0], 0.258332, 1.750000);
    DynamicPlayerTextDrawTextSize(playerid, MainMenuBtns[playerid][0], 16.500000, 83.000000);
    DynamicPlayerTextDrawSetOutline(playerid, MainMenuBtns[playerid][0], 0);
    DynamicPlayerTextDrawSetShadow(playerid, MainMenuBtns[playerid][0], 0);
    DynamicPlayerTextDrawAlignment(playerid, MainMenuBtns[playerid][0], 2);
    DynamicPlayerTextDrawColour(playerid, MainMenuBtns[playerid][0], -1);
    DynamicPlayerTextDrawBGColour(playerid, MainMenuBtns[playerid][0], 255);
    DynamicPlayerTextDrawBoxColor(playerid, MainMenuBtns[playerid][0], 9109704);
    DynamicPlayerTextDrawUseBox(playerid, MainMenuBtns[playerid][0], 1);
    DynPlayerTextSetProportional(playerid, MainMenuBtns[playerid][0], 1);
    DynamicPlayerTextDrawSelectable(playerid, MainMenuBtns[playerid][0], 1);
 
    MainMenuBtns[playerid][1] = CreateDynamicPlayerTextDraw(playerid, 570.000000, 198.000000, "RULES");
    DynamicPlayerTextDrawFont(playerid, MainMenuBtns[playerid][1], 2);
    DynamicPlayerTextDrawLetterSize(playerid, MainMenuBtns[playerid][1], 0.258332, 1.750000);
    DynamicPlayerTextDrawTextSize(playerid, MainMenuBtns[playerid][1], 16.500000, 83.000000);
    DynamicPlayerTextDrawSetOutline(playerid, MainMenuBtns[playerid][1], 0);
    DynamicPlayerTextDrawSetShadow(playerid, MainMenuBtns[playerid][1], 0);
    DynamicPlayerTextDrawAlignment(playerid, MainMenuBtns[playerid][1], 2);
    DynamicPlayerTextDrawColour(playerid, MainMenuBtns[playerid][1], -1);
    DynamicPlayerTextDrawBGColour(playerid, MainMenuBtns[playerid][1], 255);
    DynamicPlayerTextDrawBoxColor(playerid, MainMenuBtns[playerid][1], -1962934072);
    DynamicPlayerTextDrawUseBox(playerid, MainMenuBtns[playerid][1], 1);
    DynPlayerTextSetProportional(playerid, MainMenuBtns[playerid][1], 1);
    DynamicPlayerTextDrawSelectable(playerid, MainMenuBtns[playerid][1], 1);
 
    MainMenuBtns[playerid][2] = CreateDynamicPlayerTextDraw(playerid, 570.000000, 243.000000, "CREDITS");
    DynamicPlayerTextDrawFont(playerid, MainMenuBtns[playerid][2], 2);
    DynamicPlayerTextDrawLetterSize(playerid, MainMenuBtns[playerid][2], 0.258332, 1.750000);
    DynamicPlayerTextDrawTextSize(playerid, MainMenuBtns[playerid][2], 16.500000, 83.000000);
    DynamicPlayerTextDrawSetOutline(playerid, MainMenuBtns[playerid][2], 0);
    DynamicPlayerTextDrawSetShadow(playerid, MainMenuBtns[playerid][2], 0);
    DynamicPlayerTextDrawAlignment(playerid, MainMenuBtns[playerid][2], 2);
    DynamicPlayerTextDrawColour(playerid, MainMenuBtns[playerid][2], -1);
    DynamicPlayerTextDrawBGColour(playerid, MainMenuBtns[playerid][2], 255);
    DynamicPlayerTextDrawBoxColor(playerid, MainMenuBtns[playerid][2], 1296911816);
    DynamicPlayerTextDrawUseBox(playerid, MainMenuBtns[playerid][2], 1);
    DynPlayerTextSetProportional(playerid, MainMenuBtns[playerid][2], 1);
    DynamicPlayerTextDrawSelectable(playerid, MainMenuBtns[playerid][2], 1);
    return 1;
}
 
ShowMainMenuTD(playerid)
{
	SetPVarInt(playerid, "main_menu_td", 1);
    for(new i = 0; i < sizeof(MainMenuBtns); i++)
    {
        DynamicPlayerTextDrawShow(playerid, MainMenuBtns[playerid][i]);
    }
    SelectTextDraw(playerid, 0x00FF00FF);
    return 1;
}
 
HideMainMenuTD(playerid)
{
	DeletePVar(playerid, "main_menu_td");
    for(new i = 0; i < sizeof(MainMenuBtns); i++)
    {
        DynamicPlayerTextDrawHide(playerid, MainMenuBtns[playerid][i]);
    }
    return 1;
}

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

Ow thats it!! Thank u!!

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

Whoa! There's an warning in that code.

C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(65) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(65) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(66) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(66) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(67) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(67) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(68) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(68) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(69) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(69) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(70) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(70) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(71) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(71) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(72) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(72) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(73) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(73) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(74) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(74) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(75) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(75) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(76) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(76) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(79) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(79) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(80) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(80) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(81) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(81) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(82) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(82) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(83) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(83) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(84) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(84) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(85) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(85) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(86) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(86) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(87) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(87) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(88) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(88) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(89) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(89) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(90) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(90) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(93) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(93) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(94) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(94) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(95) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(95) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(96) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(96) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(97) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(97) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(98) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(98) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(99) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(99) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(100) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(100) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(101) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(101) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(102) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(102) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(103) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(103) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(104) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(104) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(113) : warning 202: number of arguments does not match definition
C:\Users\Jeybi\Desktop\Testing Gamemode\gamemodes\mainmenu.pwn(113) : warning 202: number of arguments does not match definition

from samp-textdraw-streamer.

nexquery avatar nexquery commented on September 20, 2024

What is your compiler version? Which server file are you using, SA:MP or Open.MP?

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

im using SA:MP and my compiler version is 3.10.10

from samp-textdraw-streamer.

nexquery avatar nexquery commented on September 20, 2024

Do your library files have const compatibility?

Try updating your libraries with the files here.
pawn-stdlib
samp-stdlib

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

yes i have. My problem is i updated the include and the plugin of textdraw-streamer to v2.0.3 (hot fix) then the warnings start showing up

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

when i remove these codes in textdraw-streamer.inc the warnings are gone.

// I remove the const file and line
native DynamicPlayerTextDrawFont(playerid, PlayerText:textid, font, const file[], line); - Original
native DynamicPlayerTextDrawFont(playerid, PlayerText:textid, font); - Edited

// I remove the _file and _line
#define PlayerTextDrawFont(%0,%1,%2) DynamicPlayerTextDrawFont(%0, %1, %2,  __file, __line) - Original
#define PlayerTextDrawFont(%0,%1,%2) DynamicPlayerTextDrawFont(%0, %1, %2) - Edited

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

i think there's an issue in the include

from samp-textdraw-streamer.

nexquery avatar nexquery commented on September 20, 2024

Can you try it in an empty game mode, because I don't get this warning. It's probably the #include ordering.

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

no matter what I do, there are still warnings

from samp-textdraw-streamer.

nexquery avatar nexquery commented on September 20, 2024

Can you share your game mod with all its files?

from samp-textdraw-streamer.

JeybiDevv avatar JeybiDevv commented on September 20, 2024

https://www.mediafire.com/file/e4j08hqkxx66ry9/Testing+GM.zip/file

Here's the files.

from samp-textdraw-streamer.

nexquery avatar nexquery commented on September 20, 2024

Your compiler version is old.

Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase

You need to change the function names, they should be like this.

MainMenuBtns[playerid][0] = CreatePlayerTextDraw(playerid, 570.000000, 155.000000, "PLAY");
PlayerTextDrawFont(playerid, MainMenuBtns[playerid][0], 2);
PlayerTextDrawLetterSize(playerid, MainMenuBtns[playerid][0], 0.258332, 1.750000);
PlayerTextDrawTextSize(playerid, MainMenuBtns[playerid][0], 16.500000, 83.000000);

// other codes

Not like this

MainMenuBtns[playerid][0] = CreateDynamicPlayerTextDraw(playerid, 570.000000, 155.000000, "PLAY");
DynamicPlayerTextDrawFont(playerid, MainMenuBtns[playerid][0], 2);
DynamicPlayerTextDrawLetterSize(playerid, MainMenuBtns[playerid][0], 0.258332, 1.750000);
DynamicPlayerTextDrawTextSize(playerid, MainMenuBtns[playerid][0], 16.500000, 83.000000);

// other codes

from samp-textdraw-streamer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.