How to set string to an array without assigning in to an array?
#1

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
Reply
#2

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

Reply
#3

pStatus must be text value

pStatus[24],
Reply
#4

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

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

@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
Reply
#6

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
Reply
#7

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); 
Reply
#8

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
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: