Player info problem
#1

How do I use ex:

Код:
if(PlayerInfo[playerid][pArrested] == "Yes")
I got now
Код:
if(PlayerInfo[playerid][pArrested] == 1)
I want to change it yes no. Pleas!
Reply
#2

Do You Mean Yes No In Army / Cia ?
Here Is A Stock
Код:
stock YesNo(playerid)
{
      new string[5];
      switch(CanUseCIA[playerid])
      {
             case 0: string = "No";
             case 1: string = "Yes";
      }
      return string;
}
+ Rep If Helped.
Reply
#3

Код:
if(strcmp(PlayerInfo[playerid][pArrested],"Yes",true) == 0)
You also need to change the way you load/save it, from integer to string. Can't help you there since I don't have know your code.
Reply
#4

Make pArrested a string with the length of four, pArrested[4] (Yes + \0), then when you want to add Yes or No to someone you do the following:

pawn Код:
strcat((PlayerInfo[playerid][pArrested][0] = EOS, PlayerInfo[playerid][pArrested]), "Yes", 4);
Or:

pawn Код:
strcat((PlayerInfo[playerid][pArrested][0] = EOS, PlayerInfo[playerid][pArrested]), "No", 4);

Then just:


pawn Код:
if(!strcmp(PlayerInfo[playerid][pArrested], "Yes")){
...
}
Reply
#5

Quote:
Originally Posted by Daddy Yankee
Посмотреть сообщение
Код:
if(strcmp(PlayerInfo[playerid][pArrested],"Yes",true) == 0)
You also need to change the way you load/save it, from integer to string. Can't help you there since I don't have know your code.
Well I am using simple enum for these
Код:
enum PlayerInfo
{
	pArrested,
	pPrisoned
}
new pInfo[MAX_PLAYERS][PlayerInfo];

CMD:out(playerid,params[])
{
	if(PlayerInfo[playerid][pArrested] == "Yes")
	{
		SetPlayerPos(playerid,1312.00,1254.122,744.00);	
	}
	else SendClientMessage(playerid, COLOR_RED, "You are not even prisoned");
}
Reply
#6

Quote:
Originally Posted by Pawnie
Посмотреть сообщение
Well I am using simple enum for these
Код:
enum PlayerInfo
{
	pArrested,
	pPrisoned
}
new pInfo[MAX_PLAYERS][PlayerInfo];

CMD:out(playerid,params[])
{
	if(PlayerInfo[playerid][pArrested] == "Yes")
	{
		SetPlayerPos(playerid,1312.00,1254.122,744.00);	
	}
	else SendClientMessage(playerid, COLOR_RED, "You are not even prisoned");
}
See my solution, it is complete and works with your system.
Reply
#7

but I got lots of places using the pArrested, do I need to place it inside every single function or? I mean where do I place your code at
Reply
#8

Can anyone help?
I need to define it somehow otherwise. Like in my enum
Quote:

if(strcmp(PlayerInfo[playerid][pArrested],"Yes",true) == 0)

Reply
#9

Quote:
Originally Posted by Maro06
Посмотреть сообщение
Do You Mean Yes No In Army / Cia ?
Here Is A Stock
Код:
stock YesNo(playerid)
{
      new string[5];
      switch(CanUseCIA[playerid])
      {
             case 0: string = "No";
             case 1: string = "Yes";
      }
      return string;
}
pawn Код:
stock YesNo(playerid)
{
    string = (CanUseCIA[playerid] == 0) ? ("No") : ("Yes");
    return string;
}
ok
Reply
#10

Is there any way to do it without stock? Like to be in the enum? Like I got so far. Like


PlayerInfo[playerid][pBanned] = "account";
and to be able to do also
PlayerInfo[playerid][pBanned] = "IP";
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)