CLEO Help Remove %d from ini...

CLEO related
Status
Not open for further replies.

Rough

Active member
Joined
Mar 7, 2015
Messages
42
Reaction score
4
hello ug base, i'm coming back to you again, in this beautiful new year, 2017 with a script problem... so I hope you could help me :D..

well, that's what i've made so far..

[shcode=cpp]
{$CLEO .cs}

:Noname_03
wait 0                                                                                 
                                                                                              
:Noname_04                                                                                   
wait 0                                                                                      
IF SAMP.Available                                                                            
jf @Noname_04                                                                                    

0B34: samp register_client_command "ag" to_label @anuntgratuit
0C6A: $SCANFORANUNTGRATUIT_3333 = create_custom_thread_at_label @GETANUNTGRATUIT
$ANUTGRATUITMORE_EZ = FALSE
                            wait 1000
                            thread "anuntgratuit"
                            
:Noname_05
wait 0
jump @Noname_05

:anuntgratuit //Scrie textul care trebuie sa fie in /news
samp.IsCommandTyped(17@) // /ag [cacat] <-- citeste cacat
0AF5: write_string 17@ to_ini_file "cleo\ag.ini" section "Section" key "string"  // il scrie in section -> string
jump @anuntgratuit_2     // sare la /number

:anuntgratuit_2 //ia /number de pe chat si il pune in syntaxa        
  SAMP.IsCommandTyped(0@)  // daca scriu /ag
IF 0AD4: 1@ = scan_string 0@ format "%d" 2@   // scaneaza id-ul din /ag
JF @ERROR
IF SAMP.IsPlayerConnected(2@)   // verifica daca-i conectat junioru'
JF @ERROR_2
3@ = SAMP.GetPlayerNickname(2@)        // ii ia numele                                                     
Say "/number %s" 3@      //apare numarul juniorului pe chat
$ANUTGRATUITMORE_EZ = TRUE   //sare-n while true
samp.CmdRet()
                                                                  //   /ag [id] [text] = /news Alexander vinde sau schimba Bullet, [/sms xxx-xxxx].


:GETANUNTGRATUIT
while true
wait 0
IF $ANUTGRATUITMORE_EZ == TRUE
then
 wait 300
alloc $schaneazastringusamoara 1024
alloc $iamesajulficat  1024
   0B75: samp get_chat_string 99 text_to $schaneazastringusamoara prefix_to 2@ color_to 2@ prefix_color_to -1   //citeste ultimul rand
if or
   0AD4: $tiganeasca = scan $schaneazastringusamoara format "{999999}Nume: %s Numar de telefon: %s" 21@v 25@s   //  scaneaza daca din ultimul rand citit
   0AD4: $francezapocita = scan $schaneazastringusamoara format "{999999}Name: %s Phone number: %s" 21@v 25@s      //    se gaseste una din astea
then
0AF4: $iamesajulficat  = read_string_from_ini_file "cleo\ag.ini" section "Section" key "string"   // apoi citeste ini                                                         
say "/say %s %s, sms la numarul [%s]." 21@v $iamesajulficat  25@s      //si scrie /sms cu nunmerele respective.. simple lol
else
 chatmsg " Incearca din nou" -1
end
free $schaneazastringusamoara
free $iamesajulficat
$ANUTGRATUITMORE_EZ = FALSE
end
end
 
:error
chatmsg "{660000}Eroare, trebuie sa selectezi un {990000}ID. - SCANAG" -1
samp.CmdRet()

:error_2
chatmsg "{660000}Playerul nu este {990000}conectat. - SCANAG" -1
samp.CmdRet()
[/shcode]
             
And I have to problems... first problem is,

Let's say ID 2 =[A]DaNnY11
and ID 3 = Blondutzuuu

when i type /ag 2 [text] i have two problems..

First problem is the text is like this:

" Rough.[ZEW] says: [A]DaNnY11, 2 is selling potatoes., sms la numarul [393-4548] "

there is his ID because his ID is readed from the .ini file.. i mean when i type the /ag [id] [text] the .ini file read also the id
and when i read and i decalre where to write it is taking it's id too.. so I want to ask if you guys have any idea about how to get rid of that number..

and the second problem is like this, i allocated memory for the last string scanned, and for the ini but when i type

/ag 3 [a text a little bit longer] everything is like

Rough.[ZEW] says: Blondutzuuu, 3 want to sell a car for a boat, sms la numarul

so i want to ask where is the restriction? it can't be a /say restriction.. i tried to type in chat "aaaaaaaaaaaaaaaaaa" and it's over the [sms] text..

i hope you guys could help me please.. or give me any ideas.. happy new year by the way! and thank you!
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Using the example: "/ag 2 sells potatoes"
Read the input, use strtok/strchr to find the first whitespace in the string, which will be between ID and TEXT. Then write to the .ini file from the returned pointer. You'd need to do some checking to see if the string is the correct format "ID TEXT" and the returned pointer is valid, before writing to the .ini file.

SA-MP chat limits are the following, 128 for the input(where you write) and 144 for each chat line(text in chat).
 
Status
Not open for further replies.
Top