How do i do this:
#1

If i already have something like this under OnPlayerCommand:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/Teleport", true) == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teleport Menu", "Unity Station \n Los Santos Police Department", "Select", "Cancel");
return 1;
}
return 0;
}


How would I add this onto it:
public OnPlayerCommandText(...)
{
//This will start your engine!
if(strcmp(cmd, "/startengine",true) == 0) {
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID) {
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
// ||||||
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,al arm,doors,bonnet,boot,objective);
//VEHICLE_PARAMS_ON is used to start the engine,it purely replace the engine thing!
}
return 1;
}
if(strcmp(cmd, "/stopengine",true) == 0) {
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID) {
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
// ||||||
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,a larm,doors,bonnet,boot,objective);
//Here the VEHICLE_PARAMS_OFF will turn off your engine.
}
return 1;
}


Every time i try to add something underneath, it gives me a error. Please help?
Reply
#2

pawn Код:
public OnPlayerCommandText(...)
{
if(strcmp(cmd, "/startengine",true) == 0)
{
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
              GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
              SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,al arm,doors,bonnet,boot,objective);
        }
        return 1;
}
if(strcmp(cmd, "/stopengine",true) == 0)
{
       new vid = GetPlayerVehicleID(playerid);
       if(vid != INVALID_VEHICLE_ID)
       {
                GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
                SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,a larm,doors,bonnet,boot,objective);
       }
       return 1;
}
if(strcmp(cmdtext, "/Teleport", true) == 0)
{
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teleport Menu", "Unity Station \n Los Santos Police Department", "Select", "Cancel");
    return 1;
}
return 0;
}
Reply
#3

But, how did you do it? i dont understand.
Reply
#4

Stil doesnt work, i get errors
Reply
#5

I think it's time that you post your errors to see what's wrong.
Reply
#6

C:\Users\Anoop\Desktop\samp03csvr_R2-2_win32\gamemodes\Server.pwn(200) : error 017: undefined symbol "cmd"
C:\Users\Anoop\Desktop\samp03csvr_R2-2_win32\gamemodes\Server.pwn(205) : error 017: undefined symbol "engine"
C:\Users\Anoop\Desktop\samp03csvr_R2-2_win32\gamemodes\Server.pwn(205) : error 017: undefined symbol "onnet"
C:\Users\Anoop\Desktop\samp03csvr_R2-2_win32\gamemodes\Server.pwn(205) : error 029: invalid expression, assumed zero
C:\Users\Anoop\Desktop\samp03csvr_R2-2_win32\gamemodes\Server.pwn(205) : fatal error 107: too many error messages on one line
Reply
#7

pawn Код:
public OnPlayerCommandText(...)
{
    if(strcmp(cmd, "/startengine",true) == 0)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    return 1;
}
    if(strcmp(cmd, "/stopengine",true) == 0)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    return 1;
}
    if(strcmp(cmdtext, "/Teleport", true) == 0)
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teleport Menu", "Unity Station \n Los Santos Police Department", "Select", "Cancel");
        return 1;
    }
    return 0;
}
Had to open this up in pawno, I suck at correcting indentation in the forums.
Reply
#8

1 problem man, the thing is that, my compiler crashes when i try to compile what you wrote.. Help?
Reply
#9

pawn Код:
public OnPlayerCommandText(...)
{
    if(strcmp(cmd, "/startengine",true) == 0)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    return 1;

    if(strcmp(cmd, "/stopengine",true) == 0)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    return 1;

    if(strcmp(cmdtext, "/Teleport", true) == 0)
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teleport Menu", "Unity Station \n Los Santos Police Department", "Select", "Cancel");
        return 1;
    }
    return 0;
}
Try it like this.
Reply
#10

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/startengine",true) == 0)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }


    if(strcmp(cmdtext, "/stopengine",true) == 0)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }


    if(strcmp(cmdtext, "/Teleport", true) == 0)
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teleport Menu", "Unity Station \n Los Santos Police Department", "Select", "Cancel");
        return 1;
    }
    return 0;
}
Well, you're right Schurman, didn`t really payed attention. Here`s the fixed code. If this doesn`t work, I`ll give up scripting =)

Sorry about my wrong codes earlier ... don`t know what happend.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)