SA-MP Forums Archive
How to set a variable to a string? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to set a variable to a string? (/showthread.php?tid=574864)



How to set a variable to a string? - DarkLouis - 21.05.2015

PHP код:

#define MAX_P 50
enum pi
{
    
string[MAX_P][30],
};
new 
PlayerInfo[MAX_PLAYERS][pi];
public 
OnPlayerConnect(playerid)
{
    new 
p = MAX_P - 1;
    for(new 
i = 0; i < MAX_PLAYERS; i++)
    {
        
SendClientMessage(i, -1, PlayerInfo[playerid][string[p]]);
    }
    return 
1;
} 
It is ONLY an example. Who can help me?


Re: How to set a variable to a string? - MikE1990 - 21.05.2015

Check https://sampwiki.blast.hk/wiki/Format


Re: How to set a variable to a string? - DarkLouis - 21.05.2015

The problem is

PHP код:
enum pi 
{ 
    
string[MAX_P][30], 
}; 
new 
PlayerInfo[MAX_PLAYERS][pi]; 
I want to assign at a string in an enum, another value.


Re: How to set a variable to a string? - MikE1990 - 21.05.2015

If you want to assing for example value 5 you need to format it.I don't know for another way