Fix this Dialog
#1

Anyone know what's problem with this dialog? My server crashes after i choose any listitem In-Game.

Код:
if(dialogid == DIALOG_MEDICINE)
	{
	    if(!response) return 1;
	    switch(listitem)
	    {
	        case 0:
	        {
	        if(PlayerInfo[playerid][pAspirin] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Aspirin");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseAspirin") == 1;
	         PlayerInfo[playerid][pAspirin] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Aspirin");
	        }
	        case 1:
	        {
	        if(PlayerInfo[playerid][pParacetamol] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Paracetamol");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseParacetamol") == 1;
	         PlayerInfo[playerid][pParacetamol] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Paracetamol");
	        }
	        case 2:
	        {
	        if(PlayerInfo[playerid][pMylanta] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Mylanta");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseMylanta") == 1;
	         PlayerInfo[playerid][pMylanta] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Mylanta");
	        }
	        case 3:
	        {
	        if(PlayerInfo[playerid][pAspirin] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Buscopan Plus");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseBuscopan") == 1;
	         PlayerInfo[playerid][pBuscopan] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Buscopan Plus");
	        }
	    }
	}
Reply
#2

Quote:
Originally Posted by Dirda
Посмотреть сообщение
Anyone know what's problem with this dialog? My server crashes after i choose any listitem In-Game.

Код:
if(dialogid == DIALOG_MEDICINE)
	{
	    if(!response) return 1;
	    switch(listitem)
	    {
	        case 0:
	        {
	        if(PlayerInfo[playerid][pAspirin] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Aspirin");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseAspirin") == 1;
	         PlayerInfo[playerid][pAspirin] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Aspirin");
	        }
	        case 1:
	        {
	        if(PlayerInfo[playerid][pParacetamol] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Paracetamol");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseParacetamol") == 1;
	         PlayerInfo[playerid][pParacetamol] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Paracetamol");
	        }
	        case 2:
	        {
	        if(PlayerInfo[playerid][pMylanta] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Mylanta");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseMylanta") == 1;
	         PlayerInfo[playerid][pMylanta] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Mylanta");
	        }
	        case 3:
	        {
	        if(PlayerInfo[playerid][pAspirin] < 1)
	        {
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda tidak mempunyai obat Buscopan Plus");
	         return 1;
	        }
	         SetPVarInt(playerid, "UseBuscopan") == 1;
	         PlayerInfo[playerid][pBuscopan] -= 1;
	         SendClientMessageEx(playerid, COLOR_WHITE, "Anda telah meminum sebutir obat Buscopan Plus");
	        }
                return 1;
	    }
            return 0;
	}
Try this?
Reply
#3

Still.

I found the solution.
Missunderstanding with the SetPVarInt, it doesn't need any operator.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)