SA-MP Forums Archive
How to set string to an array without assigning in to an array? - 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 string to an array without assigning in to an array? (/showthread.php?tid=572636)



How to set string to an array without assigning in to an array? - bgedition - 30.04.2015

Hello!
As in the title - How to set string to an array without assigning in to an array?
I want this for saving player status. example: PlayerInfo[playerid][pStatus] = "Offline" or something other, IDK
If someone knows how tell me here, please. +rep

BGEdition


Re : How to set string to an array without assigning in to an array? - StreetRP - 30.04.2015

PHP Code:
GetStatu(playerid)
{
    static
    
str[24];
    switch (
PlayerInfo[playerid][pStatus])
    {
        case 
0str "Offline";
        case 
1str "Online";
    }
    return 
str;




Re: How to set string to an array without assigning in to an array? - Azula - 30.04.2015

pStatus must be text value

pStatus[24],


Re : Re: How to set string to an array without assigning in to an array? - StreetRP - 30.04.2015

Quote:
Originally Posted by Azula
View Post
pStatus must be text value

pStatus[24],
No,if he use my post before


Re: How to set string to an array without assigning in to an array? - bgedition - 30.04.2015

@StreetRP Sorry for that question but can you explain what is happening with the code you're posted, because I have not used pawn language for about 6 months. And how to use it? sorry again. Thanks


Re: How to set string to an array without assigning in to an array? - Azula - 30.04.2015

Quote:
Originally Posted by StreetRP
View Post
No,if he use my post before
but you can't set any texts you like to any variable without declaring size


Re : How to set string to an array without assigning in to an array? - StreetRP - 30.04.2015

So :
PHP Code:
stock GetStatu(playerid//Is a stock

    static 
    
str[24]; 
    switch (
PlayerInfo[playerid][pStatus])  //Is switch , he detecte if PlayerInfo[playerid][pStatus] == 0 or 1
    

        case 
0str "Offline"
        case 
1str "Online"
    } 
    return 
str

To use it ,is simple
PHP Code:
GetStatu(playerid); 



Re: Re : How to set string to an array without assigning in to an array? - Kyle - 30.04.2015

Quote:
Originally Posted by StreetRP
View Post
So :
PHP Code:
stock GetStatu(playerid//Is a stock

    static 
    
str[24]; 
    switch (
PlayerInfo[playerid][pStatus])  //Is switch , he detecte if PlayerInfo[playerid][pStatus] == 0 or 1
    

        case 
0str "Offline"
        case 
1str "Online"
    } 
    return 
str

To use it ,is simple
PHP Code:
GetStatu(playerid); 
https://sampforum.blast.hk/showthread.php?tid=570635


Re: How to set string to an array without assigning in to an array? - bgedition - 30.04.2015

Ok thanks but I want to SET player status "offline" when the player exit the server not to detect his status


Re: How to set string to an array without assigning in to an array? - Azula - 30.04.2015

lool
this code will never work correctly whithout declare array size for pStatus [ size text ]
and it is not necessary to do it with a stock