strcmp problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: strcmp problem (
/showthread.php?tid=656400)
strcmp problem -
3417512908 - 15.07.2018
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
}
Re: strcmp problem -
3417512908 - 15.07.2018
Players still can create another room.Even if they created one.
Re: strcmp problem -
coool - 15.07.2018
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.
Re: strcmp problem -
SytonicX - 15.07.2018
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)
|