Jump to content
Hostul a fost schimbat. Daca vedeti serverul offline readaugati rpg.b-zone.ro sau 141.95.124.78:7777 in clientul de sa-mp ×

[Request] Mod pentru /sms


AndriiPopa
 Share

Recommended Posts

23 hours ago, AndriiPopa said:

Salut,

 

Se poate realiza un mod cleo cu următoarea funcție și anume să trimită /sms la toți jucătorii online?

 

 

Merci!

Da, se poate realiza. Îți las mai jos un exemplu folosind funția FOR pentru parcurgerea tuturor jucatorilor online (conectati pe server).

 

if 1@ <= 5
then
    say "/sms %d Test" 1@
    say "/sms %d test." 1@
    1@++
    wait 600 
else
    0@ = 0
    1@ = 0
end

De menționat faptul că această verificare poate fi folosită doar în interiorul unei bucle care se repetă la infinit, WHILE TRUE spre exemplu.

Edited by Tupi
Link to comment
Share on other sites

20 hours ago, Tupi said:

 

De menționat faptul că funția FOR poate fi folosită doar în interiorul unei bucle care se repetă la infinit, WHILE TRUE spre exemplu.

Actually you have a small mistake the for loop can work perfectly in a structure, the only thing that needs an infinite loop is wait as it means wait+=1 until wait == ms_counter and it’s only possibly happening in what you call an infinite loop. 

You can add

If and 

0B5C: 0@ 

 

to test if the player was AFK or not. 

 

There is also an important point is that you can’t send the same text in a row, you can example use a repeat until loop jumping one player each time example 

 

0@ = 1

repeat

if and

//is connected

// is afk

then

say “sms %d Spam “ 0@

say “sms %d Spam.“ 0@+1

0@+=2

end

until 0@ > 999

 

If I had a syntax mistake it’s because I wrote this with phone. You can make it better performance I’m just tired to find the efficient idea.

 

Thank you for the answer!

Edited by CouldnoT
Link to comment
Share on other sites

1 hour ago, CouldnoT said:

Actually you have a small mistake the for loop can work perfectly in a structure, the only thing that needs an infinite loop is wait as it means wait+=1 until wait == ms_counter and it’s only possibly happening in what you call an infinite loop. 

You can add

If and 

0B5C: 0@ 

 

to test if the player was AFK or not. 

 

There is also an important point is that you can’t send the same text in a row, you can example use a repeat until loop jumping one player each time example 

 

0@ = 1

repeat

if and

//is connected

// is afk

then

say “sms %d Spam “ 0@

say “sms %d Spam.“ 0@+1

0@+=2

end

until 0@ > 999

 

If I had a syntax mistake it’s because I wrote this with phone. You can make it better performance I’m just tired to find the efficient idea.

 

Thank you for the answer!

@CouldnoT 

 

1. It doesn't matter if it's afk or not when you send an SMS.

2. say “sms %d Spam.“ 0@+1 is not possible man in cleo script :-W 

3. If playeriD = 1 and you use 0@+=2 next id will be 3, id 2 will be skipped ~X(

Link to comment
Share on other sites

1 hour ago, CouldnoT said:

Actually you have a small mistake the for loop can work perfectly in a structure, the only thing that needs an infinite loop is wait as it means wait+=1 until wait == ms_counter and it’s only possibly happening in what you call an infinite loop. 

You can add

If and 

0B5C: 0@ 

 

to test if the player was AFK or not. 

 

There is also an important point is that you can’t send the same text in a row, you can example use a repeat until loop jumping one player each time example 

 

0@ = 1

repeat

if and

//is connected

// is afk

then

say “sms %d Spam “ 0@

say “sms %d Spam.“ 0@+1

0@+=2

end

until 0@ > 999

 

If I had a syntax mistake it’s because I wrote this with phone. You can make it better performance I’m just tired to find the efficient idea.

 

Thank you for the answer!

Thanks for the answers both you and @Tupi

I really appreciate it.

Could either one of you perhaps make a tutorial about this? If of course you have the time.

I'm pretty new at this and I find it quite complicated to be honest.

 

Link to comment
Share on other sites

1 hour ago, AndriiPopa said:

Could either one of you perhaps make a tutorial about this? If of course you have the time.

I'm pretty new at this and I find it quite complicated to be honest.

Iti las mai jos solutia completa pentru modul cerut

 

{$CLEO}

0000:

repeat
    wait 0
until 0AFA:

0B34: samp register_client_command "ssms" to_label @SMS

while true
wait 0

if 0@ == 1
then
    if 1@ <= 5 //primii 5 jucatori vor primi SMS
    then
        say "/sms %d Test" 1@
        say "/sms %d test." 1@
        1@++
        wait 600 
    else
        0@ = 0
        1@ = 0
    end
end

END

:SMS
0@ = 1
0B43: samp cmd_ret

Ție îți rămâne să modifici Test si Test. cu textele pe care vrei să le trimiți la jucători. Dacă mai ai nevoie de ajutor, îmi poți spune.

Edited by Tupi
Modificare solutie
Link to comment
Share on other sites

16 hours ago, Tupi said:

It doesn't matter if it's afk or not when you send an SMS.

say “sms %d Spam.“ 0@+1 is not possible man in cleo script :-W 

If playeriD = 1 and you use 0@+=2 next id will be 3, id 2 will be skipped ~X(

I don't like your aggressive way, if you want to learn you have to stay open to others. Once, you decide that you know everything you will ruin your career. It's more efficient if you skip players who are AFK as it won't help with anything and will make your code use more useless memory. 0@+=2 will not skip any player as in each loop you will send two messages, so we jumped a player. I'll close this topic and try to make a tutorial about this, so you can understand more ?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.