CLEO Help Need help in comparing vars

CLEO related
Status
Not open for further replies.

Codex1337

Active member
Joined
Mar 1, 2014
Messages
170
Reaction score
1
Hello, how can i compare two variables containing nicknames which include symbols. For example : Jaster_Moden?
And also how to compare two variables containing IP addresses?
I tried several ways but i failed.

Thanks in advance.
 

0B36

Expert
Joined
Jan 6, 2014
Messages
1,324
Reaction score
8
http://blast.hk/wiki/opcodes:0c14

There are several string opcodes defined in sampfuncs, go through them all and see which suits your needs.
 

Codex1337

Active member
Joined
Mar 1, 2014
Messages
170
Reaction score
1
I tried 0C14 and others, it lags the game.. I even tried by doing this :

var
2@ : string
1@ : string
end
///////
if 1@ == 2@
then
//////
end

The code below is in loop (WHILE TRUE)

Code:
   repeat
    wait 0
    0AD7: read_string_from_file 0@ to 1@ size 260 
    if
    0AD4: 31@ = scan_string 1@ format "XYZ_PLAYER_NAMES_LIST_NUMBER %d" 3@
    then
        0AD7: read_string_from_file 0@ to 1@ size 260
        chatmsg "DEBUG - %s" -1 1@ 
        2@ = SAMP.GetPlayerNickname(PLAYER_ID) // defined in the main script
        chatmsg "DEBUG - %s" -1 2@ // Works fine till here
        if 0C14: strcmp string1 1@ string2 2@ // cause lags
        then 
            chatmsg "DEBUG - Success!" -1
        end
    end
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Explained here; http://ugbase.eu/help-7/(admin-checker-creator)-get-player-from-a-txt-file-15135/msg84037/#msg84037

Codex1337 link said:
var
2@ : string
1@ : string
end
///////
if 1@ == 2@
then
//////
end

This won't work because when you allocate memory that variable becames a pointer to the allocated space, so sanny will check if 1@(0x739739) == 2@(0x455656).
PS1: since you posted incomplete code maybe you forgot the end of repeat instruction, 'until'.
PS2: reading in a loop will cause your game to lag.
PS3: this is my 1000th post
PS4:  :sadpepe:
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
springfield link said:
Explained here; http://ugbase.eu/help-7/(admin-checker-creator)-get-player-from-a-txt-file-15135/msg84037/#msg84037

This won't work because when you allocate memory that variable becames a pointer to the allocated space, so sanny will check if 1@(0x739739) == 2@(0x455656).
PS1: since you posted incomplete code maybe you forgot the end of repeat instruction, 'until'.
PS2: reading in a loop will cause your game to lag.
PS3: this is my 1000th post
PS4:  :sadpepe:

PS5: This is also my 1000th post, lets party?  :somuchwin:
 
Status
Not open for further replies.
Top