Simple cmds.
#17

Quote:
Originally Posted by MoroDan
Посмотреть сообщение
Hey steve_gibson. Actually, if you are using more drifts, i suggest you to make like this:
PHP код:
// Top of your script
#define NUMBER_OF_DRIFTS (3)
new const stock Float:Drift[NUMBER_OF_DRIFTS][3] =
{
    {
0.01.02.0},
    {
3.04.05.0},
    {
6.07.08.0}
}
// At top of OnPlayerCommandText
#if !defined string
    
new string[128];
#endif
for(new 0NUMBER_OF_DRIFTSi++)
{
    
format(stringsizeof(string), "/drift%d", (i+1));
    if(!
strcmp(cmdtextstringtrue))
    {
        if(
IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Drift[i][0], Drift[i][1], Drift[i][2]);
        else 
SetPlayerPos(playeridDrift[i][0], Drift[i][1], Drift[i][2]);
    }

And let me explain how this works. If you type /drift1, he will get the coords from the Drift Array, from the line 0. If you type /drift2, he will get the coords from the Drift Array, from the line 1.

If you want to add more drifts, just change & add the coords in Drift Array and change the number of drifts from macro NUMBER_OF_DRIFTS.
I understand i well...
Reply


Messages In This Thread
Simple cmds. - by steve_gibson - 16.07.2011, 07:20
Re: Simple cmds. - by freshOrange - 16.07.2011, 07:22
Re: Simple cmds. - by steve_gibson - 16.07.2011, 07:24
Re: Simple cmds. - by freshOrange - 16.07.2011, 07:26
Re: Simple cmds. - by Lorenc_ - 16.07.2011, 07:26
Re: Simple cmds. - by Kitten - 16.07.2011, 07:28
Re: Simple cmds. - by steve_gibson - 16.07.2011, 07:30
Re: Simple cmds. - by Lorenc_ - 16.07.2011, 07:32
Re: Simple cmds. - by Ash. - 16.07.2011, 07:33
Re: Simple cmds. - by steve_gibson - 16.07.2011, 07:37
Re: Simple cmds. - by steve_gibson - 16.07.2011, 07:40
Re: Simple cmds. - by freshOrange - 16.07.2011, 07:41
Re: Simple cmds. - by MoroDan - 16.07.2011, 07:43
Re: Simple cmds. - by freshOrange - 16.07.2011, 07:48
Re: Simple cmds. - by MoroDan - 16.07.2011, 07:49
Re: Simple cmds. - by Kitten - 16.07.2011, 07:56
Re: Simple cmds. - by steve_gibson - 16.07.2011, 07:59
Re: Simple cmds. - by steve_gibson - 16.07.2011, 08:05
Re: Simple cmds. - by steve_gibson - 16.07.2011, 08:07
Re: Simple cmds. - by freshOrange - 16.07.2011, 08:09
Re: Simple cmds. - by steve_gibson - 16.07.2011, 08:10
Re: Simple cmds. - by MoroDan - 16.07.2011, 08:11
Re: Simple cmds. - by steve_gibson - 16.07.2011, 08:15
Re: Simple cmds. - by steve_gibson - 16.07.2011, 08:20
Re: Simple cmds. - by MoroDan - 16.07.2011, 08:23
Re: Simple cmds. - by steve_gibson - 16.07.2011, 08:26
Re: Simple cmds. - by MoroDan - 16.07.2011, 08:30
Re: Simple cmds. - by freshOrange - 16.07.2011, 10:03

Forum Jump:


Users browsing this thread: 46 Guest(s)