[Help] Car Commands
#1

Hello, I wonder if you can help me. I created a few car commands /Autofix on/off and /Nos
But I need some more help.

With my autofix I want to know how to make it say: 'AutoFix Is already turned on!' when you do it again and same sort of thing with /autofix off.
Here is that code
pawn Код:
if (strcmp("/autofix on", cmdtext, true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid) && PLAYER_STATE_DRIVER)
        {
            cartimer[playerid]=SetTimerEx("CarHealth",2500,true,"i",playerid);
        SendClientMessage(playerid, COLOR_GREEN,"SERVER:Use /autofix off to disable or leave your car");
        SendClientMessage(playerid, COLOR_GREEN,"USAGE:Repair your car automatically");
        }
        else
        {
           SendClientMessage(playerid, COLOR_GREEN,"You are not in a Vehicle");
        }
        return 1;
    }

    if (strcmp("/autofix off", cmdtext, true) == 0)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
            KillTimer(cartimer[playerid]);
            SendClientMessage(playerid, COLOR_GREEN,"Autofix is now off");
        }
        else
        {
          SendClientMessage(playerid, COLOR_GREEN,"/autofix isnt connected");
        }
        return 1;
    }
And With my nos I made I want to make an autnos aaswell (/Anos)
I searched and I foungd This: http://forum.sa-mp.com/index.php?topic=54579.0

but i dont know how to make something like that as a command.

Anyone that help me I say thank you to, byez
Reply
#2

anyone?
Reply
#3

Use a variable
pawn Код:
// Top of script
new AutoOn[MAX_PLAYERS];

// In Command
if(AutoOn[playerid] == 0)
{
  // Turn Auto Fix On
  AutoOn[playerid] = 1;
}
else
{
  // Turn Auto Fix Off
  AutoOn[playerid] = 0;
}
BTW, Dont double post
Reply
#4

C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\samp03csvr_R2-2_win32\gamemodes\XtremeFreeroamUpdated.pwn(63 : error 017: undefined symbol "cartimer"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\samp03csvr_R2-2_win32\gamemodes\XtremeFreeroamUpdated.pwn(63 : warning 215: expression has no effect
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\samp03csvr_R2-2_win32\gamemodes\XtremeFreeroamUpdated.pwn(63 : error 001: expected token: ";", but found "]"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\samp03csvr_R2-2_win32\gamemodes\XtremeFreeroamUpdated.pwn(63 : error 029: invalid expression, assumed zero
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\samp03csvr_R2-2_win32\gamemodes\XtremeFreeroamUpdated.pwn(63 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

What should I do, not to have errors about this. The word "cartimer" is undefined symbol.
Reply
#5

You need to define (new cartimer[MAX_PLAYERS] on the top of your GM.
Reply
#6

Quote:
Originally Posted by wouter0100
You need to define (new cartimer[MAX_PLAYERS] on the top of your GM.
Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)