SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 22/05/2019, 09:35 PM   #11
nickdodd25
Huge Clucker
 
nickdodd25's Avatar
 
Join Date: Jan 2012
Location: Unknown
Posts: 444
Reputation: 109
Default Re: samp-precise-timers ⌚: A timer plugin written in the memory-safe Rust language. Check it out, you might like Rust!

Quote:
Originally Posted by RogueDrifter View Post

Ah.... just tested it and you would be correct. I just get random chars instead of the string i passed. I thought the issue was similar to the empty string issue. Guess not.
__________________
Nick
nickdodd25 is offline   Reply With Quote
Old 22/05/2019, 09:51 PM   #12
MouadJhon
Little Clucker
 
Join Date: Oct 2017
Posts: 1
Reputation: 0
Default Re: samp-precise-timers ⌚: A timer plugin written in the memory-safe Rust language. Check it out, you might like Rust!

Looks Good
MouadJhon is offline   Reply With Quote
Old 23/05/2019, 02:01 AM   #13
MisterTickle
Huge Clucker
 
MisterTickle's Avatar
 
Join Date: Jul 2007
Posts: 365
Reputation: 75
Default Re: samp-precise-timers ⌚: A timer plugin written in the memory-safe Rust language. Check it out, you might like Rust!

This doesn't seem to work for me for some reason. It breaks object and actor deleting and I'm unsure. I've converted all my timers over, but the error doesn't tel me the particular timer causing a problem.

[03:40:54] samp-precise-timers error: The amount of callback arguments passed (1) does not match the length of the list of types (4).
[03:40:54] [sampgdk:warning] Native function not found: DestroyPlayerObject
[03:40:55] [sampgdk:warning] Native function not found: DestroyActor
[03:40:57] [sampgdk:warning] Native function not found: StopPlayerObject
__________________
MisterTickle is offline   Reply With Quote
Old 23/05/2019, 02:22 AM   #14
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,191
Reputation: 386
Default Re: samp-precise-timers ⌚: A timer plugin written in the memory-safe Rust language. Check it out, you might like Rust!

Quote:
Originally Posted by nickdodd25 View Post
Ah.... just tested it and you would be correct. I just get random chars instead of the string i passed. I thought the issue was similar to the empty string issue. Guess not.
Nope, i mean it is fixable by creating a variable string with an array holding max value of the parameters passed through the timer, something you would see in a script fixing the BanEx function, like so:
pawn Code:
#define MAX_BAN_REASON_LENGTH 120
#define KICKBAN_FIX_WAIT 250// In ms

static
    FIX_BanReason[MAX_PLAYERS][MAX_BAN_REASON_LENGTH ];

hook BanEx(playerid, const reason[])    
{
    if(playerid < 0 || playerid > MAX_PLAYERS) return 0;
    if(!IsPlayerConnected(playerid)) return 0;

    format(FIX_BanReason[playerid], MAX_BAN_REASON_LENGTH, "%s", reason);
    SetTimerEx("kickban_FIX", KICKBAN_FIX_WAIT, false, "i", playerid);
    return 1;
}

forward kickban_FIX(playerid);
public kickban_FIX(playerid)
{
    BanEx(playerid, FIX_BanReason[playerid]);
    return 1;
}

But then again I'm not sure if this guy's plugin fixes the issue or not so we await his reply.
__________________
Quote:
Originally Posted by Andy
I offer paid scripting services, I can do anything except mapping because fuck mapping.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is online now   Reply With Quote
Old 23/05/2019, 09:46 AM   #15
Misiek
Big Clucker
 
Join Date: May 2006
Posts: 111
Reputation: 15
Default Re: samp-precise-timers ⌚: A timer plugin written in the memory-safe Rust language. Check it out, you might like Rust!

Quote:
Originally Posted by RogueDrifter View Post
I thought we were unable to pass strings through the settimer function, does that mean your plugin fixes it?
Yes. This plugin handles strings correctly (as noted on GitHub), no need to worry.

Quote:
Originally Posted by kocurek View Post
great plugin!
but, will you add IsValidPreciseTimer and SetPreciseTimerInterval?
I will add SetPreciseTimerInterval.

IsValidTimer, however, is a little misleading in other plugins. They don't actually guarantee that the timer in a given slot is still the same timer as when assigned. For example:
Code:
new TimerVariable;
public OnGameModeInit() {
    TimerVariable = SetTimer("Timer1",3000,1);
}

public OnPlayerConnect(playerid) {
    TimerVariable = SetTimer("Timer2",1000,1); //timer id accidentally assigned to the same variable
}

public OnGameModeExit() {
    printf("TimerVariable's timer %d is valid, but points to a new timer: %d",TimerVariable, IsValidTimer(TimerVariable));
}
As you can see, TimerVariable is technically valid, but probably not what was intended, because it now points to a completely different timer.

A proper implementation would use versioned timer ids.

Quote:
Originally Posted by MisterTickle View Post
Going to go ahead and implement this. Good job.
Thanks! Let me know how that goes!
__________________
Ex-SA-MP beta tester 😉
net4game.com
Misiek is offline   Reply With Quote
Old 23/05/2019, 09:51 AM   #16
Misiek
Big Clucker
 
Join Date: May 2006
Posts: 111
Reputation: 15
Default Re: samp-precise-timers ⌚: A timer plugin written in the memory-safe Rust language. Check it out, you might like Rust!

Quote:
Originally Posted by MisterTickle View Post
This doesn't seem to work for me for some reason. It breaks object and actor deleting and I'm unsure. I've converted all my timers over, but the error doesn't tel me the particular timer causing a problem.

[03:40:54] samp-precise-timers error: The amount of callback arguments passed (1) does not match the length of the list of types (4).
[03:40:54] [sampgdk:warning] Native function not found: DestroyPlayerObject
[03:40:55] [sampgdk:warning] Native function not found: DestroyActor
[03:40:57] [sampgdk:warning] Native function not found: StopPlayerObject
This plugin doesn't have much of a way to affect those functions - it doesn't hook anything, just adds new natives. It seems somewhere in your code you defined a timer with a wrong amount of argument letters. I'll add the name of the callback to the warning so you can know which one is being problematic.
__________________
Ex-SA-MP beta tester 😉
net4game.com
Misiek is offline   Reply With Quote
Reply

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
[Tool/Web/Other] Rust SA:MP SDK EvaBaka Plugin Development 12 15/03/2018 10:59 PM
Rust On 4GB RAM K0P Everything and Nothing 20 28/12/2016 12:34 AM
[Projeto] San Andreas Rust (DayZ/Rust/Survival) JPedro Português/Portuguese 38 15/10/2015 02:31 AM
[Off] Rust para SA-MP PratesPlay Português/Portuguese 17 27/02/2014 07:29 PM


All times are GMT. The time now is 03:32 PM.


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