SA-MP Forums Archive
Something weird is happending - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Something weird is happending (/showthread.php?tid=261192)



Something weird is happending - [MG]Dimi - 12.06.2011

Код:
if (strcmp("/pcar", cmdtext, true, 10) == 0)
	{
	        if (strcmp(pName,"[MG]Dimi", true))
		{
		    ShowPlayerDialog(playerid,Dimi_Car_Menu,DIALOG_STYLE_LIST, "{FFFF00}Private Car Selection", "{FFFFFF}SLOT 1:{0FFF00} Sultan \n{FFFFFF}SLOT 2:{FF0000} Empty Slot", "Spawn", "Cancel");
		}
                if (strcmp(pName,"[Air]Dule", true))
		{
		    ShowPlayerDialog(playerid,Dule_Car_Menu,DIALOG_STYLE_LIST, "{FFFF00}Private Car Selection", "{FFFFFF}SLOT 1:{0FFF00} Jester \n{FFFFFF}SLOT 2:{FF0000} Empty Slot", "Spawn", "Cancel");
		}
		if (strcmp(pName,"[Air]Beastboy", true))
		{
		    ShowPlayerDialog(playerid,Beastboy_Car_Menu,DIALOG_STYLE_LIST, "{FFFF00}Private Car Selection", "{FFFFFF}SLOT 1:{0FFF00} Turismo \n{FFFFFF}SLOT 2:{FF0000} Empty Slot", "Spawn", "Cancel");
		}
		if (strcmp(pName,"[Air]Proliner", true))
		{
		    ShowPlayerDialog(playerid,Proliner_Car_Menu,DIALOG_STYLE_LIST, "{FFFF00}Private Car Selection", "{FFFFFF}SLOT 1:{0FFF00} Elegy \n{FFFFFF}SLOT 2:{FF0000} Empty Slot", "Spawn", "Cancel");
		}
		if (strcmp(pName,"[Air]Zezima", true))
		{
		    ShowPlayerDialog(playerid,Zezima_Car_Menu,DIALOG_STYLE_LIST, "{FFFF00}Private Car Selection", "{FFFFFF}SLOT 1:{0FFF00} Buffalo \n{FFFFFF}SLOT 2:{FF0000} Empty Slot", "Spawn", "Cancel");
		}
		if (strcmp(pName,"[Air]Kevin", true))
		{
		    ShowPlayerDialog(playerid,Kevin_Car_Menu,DIALOG_STYLE_LIST, "{FFFF00}Private Car Selection", "{FFFFFF}SLOT 1:{0FFF00} Bullet \n{FFFFFF}SLOT 2:{FF0000} Empty Slot", "Spawn", "Cancel");
		}
		if (strcmp(pName,"[Air]Bogdan", true))
		{
		    ShowPlayerDialog(playerid,Bogdan_Car_Menu,DIALOG_STYLE_LIST, "{FFFF00}Private Car Selection", "{FFFFFF}SLOT 1:{0FFF00} Buffalo \n{FFFFFF}SLOT 2:{FF0000} Empty Slot", "Spawn", "Cancel");
		}
		else 
	    {
			SendClientMessage(playerid,0xFF0000FF,"ERROR: You don't own a private car");
			return 1;
		}
		return 1;
	}
Problem is in that when I do /pcar with nick [MG]Dimi I get message "ERROR: You don't own a private car" and when I enter the Server with nich "adaskjdbasda" I get random menu and spawned Sultan from First Menu. Anyone know how to fix it?

P.S. I have defined everything, add everything into Dialog Response etc. Only Problem is that the strcmp is doing opposite from thing it should do


Re: Something weird is happending - Cyanide - 12.06.2011

You're using strcmp incorrect. This is a great tutorial explaining how strcmp is actually used. Click here.


Re: Something weird is happending - Flo_White - 12.06.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
P.S. I have defined everything, add everything into Dialog Response etc. Only Problem is that the strcmp is doing opposite from thing it should do
you're using it wrong

Код:
if(strcmp(...,...,true) == 0)
should work