Define custom weapon names
#2

As you can add more data to the array, comparing one by one would be bad so a loop is just what you need.

PHP код:
DefineGuns(playerid)
{
    new 
string[32] = "N/A";
    for (new 
i!= sizeof (InvItems); ++i)
    {
        if(
Player[playerid][pWeapon] == InvItems[i][InvItem])
        {
            
strcat((string[0] = EOSstring), InvItems[i][InvName], sizeof (string));
            break;
        }
    }
    return 
string;

It will return the name of it if it exists, else N/A.
Reply


Messages In This Thread
Define custom weapon names - by SiraBots - 01.06.2015, 18:59
Re: Define custom weapon names - by Konstantinos - 01.06.2015, 19:10
Re: Define custom weapon names - by SiraBots - 01.06.2015, 19:12
Re: Define custom weapon names - by Konstantinos - 01.06.2015, 19:16
Re: Define custom weapon names - by SiraBots - 01.06.2015, 19:18
Re: Define custom weapon names - by Konstantinos - 01.06.2015, 19:27
Re: Define custom weapon names - by SiraBots - 01.06.2015, 19:55
Re: Define custom weapon names - by Konstantinos - 01.06.2015, 20:02
Re: Define custom weapon names - by SiraBots - 01.06.2015, 20:14
Re: Define custom weapon names - by Konstantinos - 01.06.2015, 20:26

Forum Jump:


Users browsing this thread: 1 Guest(s)