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 0: str = "Offline";
case 1: str = "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
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
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 0: str = "Offline";
case 1: str = "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
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 0: str = "Offline";
case 1: str = "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