SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Closed Thread
 
Thread Tools Display Modes
Old 05/06/2018, 08:48 PM   #21
IS4
Banned
 
Join Date: Apr 2018
Posts: 15
Reputation: 66
Default

That would be interesting to have, but if it is possible to implement it nicely, I'm not the right person.

Version 0.7 released. Variants (in lists and maps as well) can now store 2D and 3D arrays. All custom syntax features are now also disabled by default, since they made the plugin incompatible with YSI and prevented writing libraries using PawnPlus. You can enable them all by using #define PP_SYNTAX or selectively with specific defines (#define PP_SYNTAX_@ etc. - see the include).

Last edited by dugi; 13/07/2018 at 06:37 PM.
IS4 is offline  
Old 15/07/2018, 11:40 AM   #22
Moldova
Banned
 
Join Date: Jul 2018
Location: Republic of Moldova
Posts: 8
Reputation: 0
Default Re: PawnPlus

IS4, I can not find the problem:
Code:
new String:msg = str_new("~p~")+str_val(speed)+str_new(" ~b~km/h");
PlayerTextDrawSetString(playerid,PlayerInfo[playerid][speedometru],msg);
me send error
Code:
: error 035: argument type mismatch (argument 3) line error PlayerTextDrawSetString(playerid,PlayerInfo[playerid][speedometru],msg);
Moldova is offline  
Old 24/07/2018, 12:36 PM   #23
IS4
Banned
 
Join Date: Apr 2018
Posts: 15
Reputation: 66
Default Re: PawnPlus

Quote:
Originally Posted by Moldova View Post
IS4, I can not find the problem:
Code:
new String:msg = str_new("~p~")+str_val(speed)+str_new(" ~b~km/h");
PlayerTextDrawSetString(playerid,PlayerInfo[playerid][speedometru],msg);
me send error
Code:
: error 035: argument type mismatch (argument 3) line error PlayerTextDrawSetString(playerid,PlayerInfo[playerid][speedometru],msg);
You cannot call a standard native function directly with a dynamic string argument, that is simply not possible in Pawn. However, you can easily port the native function to use the dynamic string:
Code:
native PlayerTextDrawSetStringStr(playerid, PlayerText:text, AmxString:string) = PlayerTextDrawSetString;
Calling PlayerTextDrawSetStringStr with a String parameter will work.
IS4 is offline  
Old 24/07/2018, 03:51 PM   #24
Ivan_Ino
Big Clucker
 
Join Date: Oct 2012
Location: Croatia
Posts: 149
Reputation: 120
Default Re: PawnPlus

Can you please check map_remove?

for an example:
Code:
new Map:m = map_new();
map_add(m, 1, 123);
map_add(m, 2, 456);

map_remove(m, 1); // returns false
printf("%d", map_get(1)); // prints, 123
Ivan_Ino is offline  
Old 24/07/2018, 05:23 PM   #25
IS4
Banned
 
Join Date: Apr 2018
Posts: 15
Reputation: 66
Default Re: PawnPlus

Quote:
Originally Posted by Ivan_Ino View Post
Can you please check map_remove?

for an example:
Code:
new Map:m = map_new();
map_add(m, 1, 123);
map_add(m, 2, 456);

map_remove(m, 1); // returns false
printf("%d", map_get(1)); // prints, 123
Thanks for reporting; there has been a bug in map_remove.

0.7.2 released to fix this issue. I have also added another set of functions, map_has_key, to check if the specified map contains a given key.
IS4 is offline  
Old 24/07/2018, 09:24 PM   #26
Ivan_Ino
Big Clucker
 
Join Date: Oct 2012
Location: Croatia
Posts: 149
Reputation: 120
Default Re: PawnPlus

Quote:
Originally Posted by IS4 View Post
Thanks for reporting; there has been a bug in map_remove.

0.7.2 released to fix this issue. I have also added another set of functions, map_has_key, to check if the specified map contains a given key.
nice job! it was fast and efficient
Ivan_Ino is offline  
Old 24/07/2018, 10:05 PM   #27
Banditul18
Huge Clucker
 
Join Date: Nov 2014
Location: Brasov,Romania
Posts: 321
Reputation: 25
Default Re: PawnPlus

This is amaizing stuff but i have a question. I love threads because they offer great things but let say i would do a textdraw that show distance between 2 points(a player and enything else) i can perform the calculations in the thread and meantime show the resultated distance in that textdraw? I mean, its safe to do so?

Edit: Like calculations inside a timer/constant update function so the distance will shown acording to the player position
__________________
Banditul18 is offline  
Old 25/07/2018, 10:24 AM   #28
IS4
Banned
 
Join Date: Apr 2018
Posts: 15
Reputation: 66
Default Re: PawnPlus

Quote:
Originally Posted by Banditul18 View Post
This is amaizing stuff but i have a question. I love threads because they offer great things but let say i would do a textdraw that show distance between 2 points(a player and enything else) i can perform the calculations in the thread and meantime show the resultated distance in that textdraw? I mean, its safe to do so?

Edit: Like calculations inside a timer/constant update function so the distance will shown acording to the player position
I wouldn't recommend that. GetPlayerPos and TextDrawSetString are not thread-safe. Threads in PawnPlus are meant to be used for CPU-intensive code, so if you simply want to calculate a distance, you don't need to use threads. OnPlayerUpdate is sufficient for this, and tasks are better suited for cooperative multitasking.
IS4 is offline  
Old 02/08/2018, 06:28 PM   #29
Netherland
Little Clucker
 
Join Date: Jun 2018
Posts: 2
Reputation: 0
Default Re: PawnPlus

Just need better and more documentation and examples...
specially about configuring it and using such APIs:

Code:
native String:str_format(const format[], {StringTags,Float,_}:...);
native String:str_format_s(StringTag:format, {StringTags,Float,_}:...);
Netherland is offline  
Old 06/08/2018, 06:52 PM   #30
DBZdabIt3Bro7
Banned
 
Join Date: Sep 2017
Location: Lovely name, right?
Posts: 76
Reputation: 8
Default Re: PawnPlus

PHP Code:
          ShowPlayerDialogString(playeridDIALOG_ID_SP_TD_POSITIONDIALOG_STYLE_INPUT,
            
str_new("Change textdraw string content"),

            
str_new("Please enter the location in width and height format.\n \n\
              "
COLOR_DEFAULT"Good to know:\n\
              "
COLOR_HIGHLIGHT" - If you enter a height less than 1.0, only the shadow will be visible.\n\
               - If the coordination is off your visual screen, only the shadow will be visible.\n\
               - The width and height are estimated in float (decimal) values in a canvas of 640x480.\n\
               - You are the only one who will use this texdraw, so you can design it to fit your resolution perfectly.\n \n\
              "
COLOR_DEFAULT"Current position: "COLOR_HIGHLIGHT) +
            
str_float(characterSpeedometerTextdraws[playerid][profile][textdraw][speedometerPosWidth]) + str_new("x") +
            
str_float(characterSpeedometerTextdraws[playerid][profile][textdraw][speedometerPosHeight]),
            
COLOR_HIGHLIGHT"Submit""Back"); 


Not really sure why str_float() (shown in the snippet above) is undefined.

Code:
../include/vehicles/vehicleSpeedometers.inc(187) -- (197) : error 017: undefined symbol "str_float"
Pawn compiler 3.2.3664      Copyright (c) 1997-2017, ITB CompuPhase


1 Error.
[Finished in 0.6s]
DBZdabIt3Bro7 is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help] PawnPlus IDE Manda21 Scripting Help 4 29/10/2016 01:41 PM
[Tool/Web/Other] [0.1] PawnPlus IDE - PAWNO alternative WopsS Tools and Files 62 13/04/2016 10:32 PM
[Tool/Web/Other] PawnPlus IDE - PAWNO alternative WopsS Tools and Files 94 14/01/2016 09:32 PM


All times are GMT. The time now is 05:11 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.