SA-MP Forums Archive
Need help with textdraw and enums. - 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: Need help with textdraw and enums. (/showthread.php?tid=641302)



Need help with textdraw and enums. - danielpalade - 13.09.2017

-- DELETED --


Re: Need help with textdraw and enums. - Kane - 13.09.2017

So in a descending order?

PHP код:
new
    
string[128];
    
for(new 
sizeof(obj); >= 0i--)
{
    
format(stringsizeof(string), "This would be a descending order: %i"i);
    
SendClientMessage(playerid, -1string); 

Is one way.


Re: Need help with textdraw and enums. - Paulice - 14.09.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
So in a descending order?

PHP код:
new
    
string[128];
    
for(new 
sizeof(obj); >= 0i--)
{
    
format(stringsizeof(string), "This would be a descending order: %i"i);
    
SendClientMessage(playerid, -1string); 

Is one way.
No loop...

-----

Create an array such as pCount[MAX_PLAYERS] then use it to keep count of the object you're on.


Re: Need help with textdraw and enums. - Kane - 14.09.2017

Quote:

How can I make it so when I for example type the command: /forth it will show me the objects in order?

Did I misunderstand him OR?


Re: Need help with textdraw and enums. - OneDay - 14.09.2017

Quote:
Originally Posted by danielpalade
Посмотреть сообщение
Let's say I have the enum objects in which I have 3 objects.

Код:
enum objects
{
	objID,
	objModel
}
new obj[5][objects];
There are 3 objects currently stored in the enum.

How can I make it so when I for example type the command: /forth it will show me the objects in order?
For example:

I use /forth and a message pops up and gives me the objID of the next object in queue in the enum.
Let's say I use this command 3 times and I end up at the last objID which is 3.

How can I make it that when I now type /back, it will give me messages with the objects in a reversed order?
So again, I use /back 3 times here.

First /back: objID 3
Second /back: objID 2
Thrid Back: objID 1

Let's say I stop at the second /back which is objID 2, and I type /forth one more time, it has to get me to objID 3, since objID 3 is the next in the queue. How can I make this?
PHP код:
enum objects
{
    
objID,
    
objModel
}
new 
obj[5][objects];
new 
objcount;
new 
objforplayer[MAX_PLAYERS];
CMD:forth(playeridparams[])
{
    if (
objforplayer[playerid] < objcount)
    {
        new 
str[64];
        
format(strsizeof str"objID %d"obj[objforplayer[playerid]][objID]);
        
SendClientMessage(playeridCOLOR_GREENstr);
        
objforplayer[playerid]++;
    }
}
CMD:back(playeridparams[])
{
    if (
objforplayer[playerid] > 0)
    {
        
objforplayer[playerid]--;
        new 
str[64];
        
format(strsizeof str"objID %d"obj[objforplayer[playerid]][objID]);
        
SendClientMessage(playeridCOLOR_GREENstr);
    }