compare string
#1

Hi,

There is more fast that 'strcmp' because I use a command with:
strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)

it's no at once, result after 0.5 sc.

Thanks
Reply
#2

1. Zcmd (fast & easy to use)
2. Dcmd (slowest but faster then strcmp & easy to use)
3. Ycmd (fastest but a little harder to use)

Use the search button to search for them.
Reply
#3

Yes but Zcmd is for a command COMMAND:mycommand(playerid, params[]), here if I want to compare my name and the name house, strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0). How to use that?
Reply
#4

someone?
Reply
#5

If you will use zcmd:

pawn Code:
CMD:compare(playerid, params[])
{
    if(strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
    {
        // if they are the same
    }
    else
    {
        // if they are different
    }
    return 1;
}
Reply
#6

it's most likely not strcmp that's causing the lag, however if you really wanted you could assign a number to each player and index it to the house owners and then do something like this

if(PlayerID[playerid] == HouseInfo[ownerID])
Reply
#7

ok so inside the command, if I want to compare a string the best solution is strcmp?

Ycmd Zcmd...or sccanf can't to be used for that?
Reply
#8

YCMD and ZCMD are for command processing.
sscanf is for string, erm, scanning? It's not for comparing.

strcmp stands for string compare.
Reply
#9

Quote:
Originally Posted by Sinner
View Post
1. Zcmd (fast & easy to use)
2. Dcmd (slowest but faster then strcmp & easy to use)
3. Ycmd (fastest but a little harder to use)

Use the search button to search for them.
You provide false information. Take a look at the dcmd definition.

pawn Code:
dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0)
It uses strcmp and since macros or defines are a pre-processor directive I doubt it alters code delay. The specifiers allows what would have been input if using strcmp when declaring a dcmd command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)