3D text toggle Help PLEASE
#1

Код:
new tempID[128];

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[128], idx;
	cmd = strtok(cmdtext, idx);
	new pID[128];
	pID = strtok(cmdtext, idx);

	if (strcmp(cmd,"/oocmode", true) == 0)
	{
		if(strlen(pID) == 0) return SendClientMessage(playerid, 0xE3E3E3FF, "USAGE: /oocmode  [playerid]");
		if( omode == 0 )
		{
        new Text3D:label = Create3DTextLabel("DO NOT ROLEPLAY WITH THIS PERSON!\nTHIS PERSON IS IN OOC MODE!", COLOR_LIGHTGREEN, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label, strval(pID), 0.0, 0.0, 0.7);
        SendClientMessage(strval(pID), COLOR_LIGHTGREEN, "(Info): You are now in OOC mode, you may not roleplay with anybody!");
        omode = 1;
        strcat(tempID, pID); // Here I put pID value in tempID, maybe I am doing it wrongly?
        }
		else if( omode == 1 )
	    SendClientMessage(playerid, COLOR_ERROR, "ERROR: There is currently a player using OOC mode, you may not use it now!");
	    else if( omode == 1 && tempID[] == pID[] )
	    {
	    omode = 0;
	    Delete3DTextLabel(Text3D:0);
	    }
        return 1;
	}
}
Код:
ERRORS: C:\Users\haim\Desktop\Script\gamemodes\Untitled.pwn(195) : error 033: array must be indexed (variable "tempID")
C:\Users\haim\Desktop\Script\gamemodes\Untitled.pwn(195) : error 033: array must be indexed (variable "pID")
Reply
#2

I want it to check if tempID = to pID and if yes to disable the text 3D. Although I got everything except how to check if they are equal.
Reply
#3

if( tempID == strval(pID)) ?

Hope I helped.
Reply
#4

Thanks. Rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)