Function to return a string
#4

PHP Code:
stock GetCasa(playerid)
{
    new 
Cache:resultname[MAX_PLAYER_NAME];
    if(
Player[playerid][quantPropriedades] < 1) return -1;
    
GetPlayerName(playeridnamesizeof(name));
    for(new 
0Server[0][quantCasas]; a++)
    {
        
printf("%s -> %s"Casa[a][dono], name);
        if(!
strcmp(Casa[a][dono], name)) return a;
    }
    
    return -
1;

Tested myself just on printf, and it was returning always -1, even if names are equal, which I compared for 4 players on my server (Myself and 3 NPCS), and it printed:

PHP Code:
Fel_486 -> Fel_486
           
-> Fel_486
          
-> Fel_486
          
-> Fel_486 
The Owner field on Mysql default I put as ' '. Well, the command is correct, and straight thing there is that the "return" doesn't stops the loop, lol...

Well, that's not normal...
Reply


Messages In This Thread
Function to return a string - by Fel486 - 21.04.2015, 19:40
Re: Function to return a string - by [KHK]Khalid - 21.04.2015, 20:43
Re: Function to return a string - by Konstantinos - 21.04.2015, 20:57
Re: Function to return a string - by Fel486 - 21.04.2015, 21:12
Re: Function to return a string - by Konstantinos - 21.04.2015, 21:24
Re: Function to return a string - by Fel486 - 21.04.2015, 21:33
Re: Function to return a string - by Konstantinos - 21.04.2015, 21:39
Re: Function to return a string - by Fel486 - 21.04.2015, 21:50

Forum Jump:


Users browsing this thread: 4 Guest(s)