SA-MP Forums Archive
One question. - 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: One question. (/showthread.php?tid=199280)



One question. - [Comrade] - 15.12.2010

Hey guys here is the question - how is it possible to turn this.

Код:
new Text3D: Riffa1;
Riffa1 = Create3DTextLabel("Grovet",COLOR_GROVE,0,0,0,50,0);              //Grove Street
Attach3DTextLabelToVehicle(Riffa1, 1, 0.0,0.0,0.0+1.0);
new Text3D: Riffa2;
Riffa2 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0);            
Attach3DTextLabelToVehicle(Riffa2, 2, 0.0,0.0,0.0+1.0);
new Text3D: Riffa3;
Riffa3 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0);           
Attach3DTextLabelToVehicle(Riffa3, 3, 0.0,0.0,0.0+1.0);
In to a one line. I don't want to waste my time creating all these lines, and then if i add a car before them id have to change the entire thing. so can anyone help? thank you


Re: One question. - admantis - 15.12.2010

I think..
pawn Код:
new Text3D: Riffa1; Riffa1 = Create3DTextLabel("Grovet",COLOR_GROVE,0,0,0,50,0); Attach3DTextLabelToVehicle(Riffa1, 1, 0.0,0.0,0.0+1.0); new Text3D: Riffa2; Riffa2 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0); Attach3DTextLabelToVehicle(Riffa2, 2, 0.0,0.0,0.0+1.0); new Text3D: Riffa3; Riffa3 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0); Attach3DTextLabelToVehicle(Riffa3, 3, 0.0,0.0,0.0+1.0);
EDIT: Or use a stock


Re: One question. - XePloiT - 15.12.2010

pawn Код:
stock FuncName()
{
new Text3D: Riffa1;
Riffa1 = Create3DTextLabel("Grovet",COLOR_GROVE,0,0,0,50,0);              //Grove Street
Attach3DTextLabelToVehicle(Riffa1, 1, 0.0,0.0,0.0+1.0);
new Text3D: Riffa2;
Riffa2 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0);            
Attach3DTextLabelToVehicle(Riffa2, 2, 0.0,0.0,0.0+1.0);
new Text3D: Riffa3;
Riffa3 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0);          
Attach3DTextLabelToVehicle(Riffa3, 3, 0.0,0.0,0.0+1.0);
}



Re: One question. - [Comrade] - 15.12.2010

is there any other way?


Re: One question. - admantis - 15.12.2010

Quote:
Originally Posted by [Comrade]
Посмотреть сообщение
is there any other way?
Either a stock or the way I first posted (which makes the script hard to read), else than that, I dont know any way and Im doubtful there is any. Becareful when you choose the IDs and that stuff so you don't have to change it all when you made a mistake.


Re: One question. - [Comrade] - 15.12.2010

yeah thats what im trying to do, can you give me an example of a stock? for like this? how does it work?


Re: One question. - admantis - 15.12.2010

In my personal theory, stock is just like a function. It's a bunch of functions inside other function, like..
pawn Код:
OnPlayerConnect(playerid)
{
    WelcomePlayer();
}

stock WelcomePlayer();
{
        new string[50], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(COLOR_YELLOW, string);
}
You can also add extra parameters like..

pawn Код:
WelcomePlayer(color);
But i yet dont know how to do that.


Re: One question. - [Comrade] - 15.12.2010

all i really wanted to do was add same Text to a bunch of cars without making aklot of lines like to cars whos ids are like from 0> <6


Re: One question. - admantis - 15.12.2010

Quote:
Originally Posted by [Comrade]
Посмотреть сообщение
all i really wanted to do was add same Text to a bunch of cars without making aklot of lines like to cars whos ids are like from 0> <6
Like this?
pawn Код:
if (vehicleid > 0 && vehicleid < 6)
{
    DoSomething();
}



Re: One question. - XePloiT - 15.12.2010

Quote:
Originally Posted by XePloiT
Посмотреть сообщение
pawn Код:
stock FuncName()
{
new Text3D: Riffa1;
Riffa1 = Create3DTextLabel("Grovet",COLOR_GROVE,0,0,0,50,0);              //Grove Street
Attach3DTextLabelToVehicle(Riffa1, 1, 0.0,0.0,0.0+1.0);
new Text3D: Riffa2;
Riffa2 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0);            
Attach3DTextLabelToVehicle(Riffa2, 2, 0.0,0.0,0.0+1.0);
new Text3D: Riffa3;
Riffa3 = Create3DTextLabel("Grove",COLOR_GROVE,0,0,0,50,0);          
Attach3DTextLabelToVehicle(Riffa3, 3, 0.0,0.0,0.0+1.0);
}
i don't get 'ya... you want a stack? here i made one for you ^
or what you want?