strcmp problem
#1

I want to check if player is created a room:
Код:
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
			   
if(strcmp(RoomInfo[i][Owner],playername)!=0)
{
Dialog(playerid,999,DIALOG_STYLE_MSGBOX,"{ff0000}警告","{ff0000}你已经创建了一个房间","Okay","");
break;
}
//not work :(
On create
Код:
GetPlayerName(playerid, RoomInfo[i][Owner], MAX_PLAYER_NAME);
enum
Код:
enum rInfo
{
	bool:IsCreated,
	Owner[MAX_PLAYER_NAME],
	RoomID,
	World,
	Name[22],
	Weapon1,
	Weapon2,
	Map,
	Players

}
Reply
#2

Players still can create another room.Even if they created one.
Reply
#3

strcmp will return '0', if the strings are equal. In the above case:
PHP код:
if(strcmp(RoomInfo[i][Owner],playername)==0)//player name and 'RoomInfo[i][Owner]' match 
Maybe I can be wrong because I don't understand the dialog.
Reply
#4

Don't use " != 0 " because it might not get it as a compiler sometimes, I might sound as a retard but it happens a lot of times with me specially while using other programming languages as C++ etc.
Use " == 0 " or " == 1 " and I believe if you used the following it might work smoothly.

Quote:
Originally Posted by coool
Посмотреть сообщение
PHP код:
if(strcmp(RoomInfo[i][Owner],playername)==0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)