DB[playerid][Job]=strval("Unemployed"); -
Lirbo - 22.07.2015
PHP код:
DB[playerid][Job]=strval("Unemployed");
this shit doesn't get anything, I mean the DB[playerid][Job] stays blank, I tried to make this function to check it:
PHP код:
new String[256];
format(String,sizeof(String),"Job: %s",DB[playerid][Job]);
SendClientMessage(playerid,-1,String);
and it's just sending "Job: " which means the variable = nothing.
what should i do?
pls ignore my shitty english i wrote it in a minute and I was too lazy to take a look on the thread before posting it.
AW: DB[playerid][Job]=strval("Unemployed"); -
BigBrainAFK - 22.07.2015
Can you post the declaration of Job?
Re: AW: DB[playerid][Job]=strval("Unemployed"); -
Lirbo - 22.07.2015
Quote:
Originally Posted by BigBrainAFK
Can you post the declaration of Job?
|
PHP код:
enum Database{
Blah,
Blah,
Job[30]
Blah,
Blah,
}
that's all.
AW: DB[playerid][Job]=strval("Unemployed"); -
Nero_3D - 22.07.2015
First read what strval does
https://sampwiki.blast.hk/wiki/Strval
Than read that
https://sampwiki.blast.hk/wiki/Scripting_Basics#Strings
If that doesn't work because of the enum use strcat with an empty string
https://sampwiki.blast.hk/wiki/Strcat
Re: AW: DB[playerid][Job]=strval("Unemployed"); -
Lirbo - 22.07.2015
Quote:
Originally Posted by Nero_3D
|
PHP код:
new EmptyString[1];
DB[playerid][Job]=strcat(EmptyString,"Unemployed");
isn't working and I read the second link that u sent and i didnt understand what you want me to do with that info?
Re: DB[playerid][Job]=strval("Unemployed"); -
kristo - 22.07.2015
pawn Код:
DB[playerid][Job][0] = EOS; // Clearing the string
strcat(DB[playerid][Job], "Unemployed", 30); // Adding "unemployed" to the now empty string.
Or use the strcpy macro, then you can do it with just one line:
pawn Код:
#define strcpy(%0,%1) strcat((%0[0] = EOS, %0), %1)
strcpy(DB[playerid][Job], "Unemployed", 30);
Re: DB[playerid][Job]=strval("Unemployed"); -
Lirbo - 22.07.2015
Quote:
Originally Posted by kvann
pawn Код:
DB[playerid][Job][0] = EOS; // Clearing the string strcat(DB[playerid][Job], "Unemployed", 30); // Adding "unemployed" to the now empty string.
Or use the strcpy macro, then you can do it with just one line:
pawn Код:
#define strcpy(%0,%1) strcat((%0[0] = EOS, %0), %1)
strcpy(DB[playerid][Job], "Unemployed", 30);
|
oowah thanks man but when i do it with strcpy it's shows me this:
warning 201: redefinition of constant/macro (symbol "strcpy(%0,%1)")
Re: DB[playerid][Job]=strval("Unemployed"); -
OwlIT - 22.07.2015
You don't need strcpy just change into:
format(DB[playerid][Job], /* HERE STRING SIZE */, "Unemployed");
Re: DB[playerid][Job]=strval("Unemployed"); -
Lirbo - 22.07.2015
Quote:
Originally Posted by OwlIT
You don't need strcpy just change into:
DB[playerid][Job] = "Unemployed";
|
smartass it won't work.
Re: DB[playerid][Job]=strval("Unemployed"); -
xVIP3Rx - 22.07.2015
Quote:
Originally Posted by Lirbo
oowah thanks man but when i do it with strcpy it's shows me this:
warning 201: redefinition of constant/macro (symbol "strcpy(%0,%1)")
|
it is already defined in your script, just remove it.
I'm talking about this
pawn Код:
#define strcpy(%0,%1) strcat((%0[0] = EOS, %0), %1)