Help with Clean GM (some questions/problems) please help!
#1

Hello people, i have some noob questions about scripting... I will loock really noob but i don't care... If i don't ask i will never know rigth?

Then, they are there:

1є- I am making a RP GM.... But, it is going very good... I am not making all myself, i am using VERY thinks of this forum, and it's behing cool but i am using the Filter scripts like Filter scripts coz when i try to add some stuff to GM script it give errors...

When i try to add a fricken simple engine system, it give me errors.... I really don't know what to do! I will post the engine system code and if you can say me what i need add on GM to it work.. I will say thanks very mutch!

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#if defined FILTERSCRIPT

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define COLOR_GREEN 0x008000FF

#define COLOR_RED 0xFF0000FF

#define COLOR_YELLOW 0xFFFF00FF

new Engine[MAX_VEHICLES];

forward EngineTimer(playerid);

public OnFilterScriptInit()
{
        print("Engine System loaded.");
        return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
        TogglePlayerControllable(playerid,1);
        return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if(newstate == PLAYER_STATE_DRIVER)
                {
                    new vehicleid = GetPlayerVehicleID(playerid);
                        if(Engine[vehicleid] == 0)
                        {
                        TogglePlayerControllable(playerid, 0);
                        SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
                        }
                        else if(Engine[vehicleid] == 1)
                        {
                        SendClientMessage(playerid, COLOR_GREEN, "Engine Running...");
                        }
}
                return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new vehicleid = GetPlayerVehicleID(playerid);
        if(IsPlayerInAnyVehicle(playerid))
        {
        if(Engine[vehicleid] == 0)
        {
        if(newkeys & KEY_SECONDARY_ATTACK)
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else if(newkeys & KEY_JUMP)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Starting...");
        SetTimerEx("EngineTimer", 2000, 0, "i", playerid);
        }
        }
}
        return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
        dcmd(exitveh, 7, cmdtext);
        dcmd(engine, 6, cmdtext);
        return 0;
}

public EngineTimer(playerid)
{
    new rand = random(2);

        if(rand == 0)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Started...");
        SendClientMessage(playerid, COLOR_YELLOW, "To turn off the vehicle, Type (/engine)");
        new vehicleid = GetPlayerVehicleID(playerid);
        Engine[vehicleid] = 1;
        TogglePlayerControllable(playerid, 1);
        }

        if(rand == 1)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Failed...");
    SendClientMessage(playerid, COLOR_YELLOW, "Try Again");
        }

}

dcmd_engine(playerid, params[])
{
        #pragma unused params
        new vehicleid = GetPlayerVehicleID(playerid);
        if(Engine[vehicleid] == 0)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Starting...");
        SetTimerEx("EngineTimer", 2000, 0, "i", playerid);
        }
        else if(Engine[vehicleid] == 1)
        {
        Engine[vehicleid] = 0;
        SendClientMessage(playerid, COLOR_RED, "Engine Stopped...");
        SendClientMessage(playerid, COLOR_YELLOW, "To exit the vehicle press (F Key) Or (Enter)");
    SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
        TogglePlayerControllable(playerid,0);
        }
        return 1;
}

dcmd_exitveh(playerid, params[])
{
        #pragma unused params
        if(IsPlayerInAnyVehicle(playerid))
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else
        {
        SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle");
        }
        return 1;
}
#endif
Reply
#2

Jo Ricardo.
Please post your errors. Without it, I / we can't help you!
Reply
#3

Код:
Jo Ricardo.
Please post your errors. Without it, I / we can't help you!
Ok, i forgeted.... When i add all happen this:

Код:
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(118) : error 055: start of function body without function header
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(120) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(181) : error 055: start of function body without function header
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(182) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(183) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(184) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(191) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(194) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(254) : error 055: start of function body without function header
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(256) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(263) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(273) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(356) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(413) : warning 203: symbol is never used: "dcmd_engine"
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(413) : warning 203: symbol is never used: "dcmd_exitveh"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
GM code(alried not mutch coz its all on FS's)

pawn Код:
#include <a_samp>
#include <file>
#include <a_samp>
#include <mapicon>
#include <newf>
#include <dcmd>
#include <cpstream>
#include <md5>
#include <streamer>

#pragma dynamic 145000
#define FILTERSCRIPT
//-----------------------------------------------------------------
main()
{
    print("\n----------------------------------");
    print(" RR-RP by Ricardo_Rodrigues");
    print("----------------------------------\n");
}
//-----------------------------------------------------------------
#define MAX_SLOTS 30
#define OWNER_NAME "Ricardo_Rodrigues
#define DEFINE_NAME INT"
#define SendMessage(%0, %1, %2)
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//---------------[COLORS/TEAMS]------------------------------------------
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_SYSTEM 0xFFA500AA
#define COLOR_SUSPECT 0xFF8000AA
#define COLOR_NEWS 0x0259EAAA
#define COLOR_DARKRED 0x8B0000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_PINK 0xDC00DDAA
#define COLOR_BLUE 0x0259EAAA
#define COLOR_GREEN 0x00A800AA
#define COLOR_ORANGE 0xFF8000AA
#define COLOR_CYAN 0xFF8080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DARKBLUE 0x0000A0AA
#define COLOR_BLACK 0x000000AA
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_PURPLE 0xFF00FFAA
#define COLOR_BROWN 0x804000AA

#define TEAMCOLOR_NONE 0xAFAFAFAA
#define TEAMCOLOR_GROVE 0x00A800AA
#define TEAMCOLOR_BALLAS 0xFF00FFAA
#define TEAMCOLOR_AZTECAS 0x33CCFFAA
#define TEAMCOLOR_VAGOS 0xFFFF00AA
#define TEAMCOLOR_RIFA 0x33CCFFAA
#define TEAMCOLOR_BIKER 0xFF0080AA
#define TEAMCOLOR_FIREMAN 0xB22222AA
#define TEAMCOLOR_MEDIC 0x87CEEBAA
#define TEAMCOLOR_COP 0x0259EAAA
#define TEAMCOLOR_NORMAL 0xFFFFFFAA
#define TEAMCOLOR_ARMY 0x556B2FAA
#define TEAMCOLOR_NEWS 0x3CB371AA

#define TEAM_NONE 0
#define TEAM_GROVE 1
#define TEAM_BALLAS 2
#define TEAM_AZTECAS 3
#define TEAM_VAGOS 4
#define TEAM_RIFA 5
#define TEAM_BIKER 6
#define TEAM_MEDIC 7
#define TEAM_FIREMAN 8
#define TEAM_COP 9
#define TEAM_NORMAL 10
#define TEAM_ARMY 11
#define TEAM_NEWS 12
//---------------[COLORS FROM SEIFADMIN]---------------------------
#define GREEN       0x21DD00FF
#define RED         0xE60000FF
#define ADMIN_RED   0xFB0000FF
#define YELLOW      0xFFFF00FF
#define ORANGE      0xF97804FF
#define LIGHTRED    0xFF8080FF
#define LIGHTBLUE   0x00C2ECFF
#define PURPLE      0xB360FDFF
#define BLUE        0x1229FAFF
#define LIGHTGREEN  0x38FF06FF
#define DARKPINK    0xE100E1FF
#define DARKGREEN   0x008040FF
#define AQUAGREEN   0x00CACAFB
#define NICESKY     0x99FFFFAA
#define GREY        0xCECECEFF
#define WHITE       0xFFFFFFFF

#define blue 0x375FFFFF
#define red 0xFF0000AA
#define green 0x33FF33AA
#define yellow 0xFFFF00AA
#define grey 0xC0C0C0AA
#define blue1 0x2641FEAA
#define lightblue 0x33CCFFAA
#define orange 0xFF9900AA
#define black 0x2C2727AA
#define COLOR_BLACK 0x000000AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN1 0x33AA33AA

new Engine[MAX_VEHICLES];

forward EngineTimer(playerid);

public OnGameModeInit()
{
    SetGameModeText("RR-RP");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}
//------------------------[EGINE SYSTEM THINKS]-------------------------------
{
    print("Engine System loaded.");
    return 1;
}
//---------------------------------------------------------------------------
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s has joined the server. Welcome!",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid,2229.348388,-1159.111653,25.806554);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
        SendClientMessageToAll(0xFFFF00AA, str);
        return 1;
    }
    return 0;
}
//---------------------------[ENGINE THINKS]-------------------------------------
{
        dcmd(exitveh, 7, cmdtext);
        dcmd(engine, 6, cmdtext);
        return 0;
}

public EngineTimer(playerid)
{
    new rand = random(2);

        if(rand == 0)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Started...");
        SendClientMessage(playerid, COLOR_YELLOW, "To turn off the vehicle, Type (/engine)");
        new vehicleid = GetPlayerVehicleID(playerid);
        Engine[vehicleid] = 1;
        TogglePlayerControllable(playerid, 1);
        }

        if(rand == 1)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Failed...");
    SendClientMessage(playerid, COLOR_YELLOW, "Try Again");
        }

}

dcmd_engine(playerid, params[])
{
        #pragma unused params
        new vehicleid = GetPlayerVehicleID(playerid);
        if(Engine[vehicleid] == 0)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Starting...");
        SetTimerEx("EngineTimer", 2000, 0, "i", playerid);
        }
        else if(Engine[vehicleid] == 1)
        {
        Engine[vehicleid] = 0;
        SendClientMessage(playerid, COLOR_RED, "Engine Stopped...");
        SendClientMessage(playerid, COLOR_YELLOW, "To exit the vehicle press (F Key) Or (Enter)");
    SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
        TogglePlayerControllable(playerid,0);
        }
        return 1;
}

dcmd_exitveh(playerid, params[])
{
        #pragma unused params
        if(IsPlayerInAnyVehicle(playerid))
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else
        {
        SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle");
        }
        return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SendClientMessage(playerid, 0x1229FAFF, " [RR-RP]You are entering a State car! Drive careful!");
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    SendClientMessage(playerid, 0x1229FAFF, "[RR-RP]You Leaved the car, DON'T Forget to park it rigth!");
    return 1;
}

{
    TogglePlayerControllable(playerid,1);
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if(newstate == PLAYER_STATE_DRIVER)
                {
                    new vehicleid = GetPlayerVehicleID(playerid);
                        if(Engine[vehicleid] == 0)
                        {
                        TogglePlayerControllable(playerid, 0);
                        SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
                        }
                        else if(Engine[vehicleid] == 1)
                        {
                        SendClientMessage(playerid, COLOR_GREEN, "Engine Running...");
                        }
}
                return 1;
}
//----------------------------------------------------------------------------------------------------------

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
//--------------------------------[VEHICLE ENGINE THINKS]-----------------------------------------------
{
new vehicleid = GetPlayerVehicleID(playerid);
        if(IsPlayerInAnyVehicle(playerid))
        {
        if(Engine[vehicleid] == 0)
        {
        if(newkeys & KEY_SECONDARY_ATTACK)
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else if(newkeys & KEY_JUMP)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Starting...");
        SetTimerEx("EngineTimer", 2000, 0, "i", playerid);
        }
        }
}
        return 1;
}
//-----------------------------------------------------------------------------------------------------
public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}
public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
I know thats some stupid problem or noob think i didn0t do but, like i am new, i need help
Reply
#4

First of all, If you use it as an FS, don't use "OnGameModeInit"/"OnGameModeExit" but "OnFilterScriptInit"/"OnFilterScriptExit".
As second, you have:
pawn Код:
return 1;
}
//------------------------[EGINE SYSTEM THINKS]-------------------------------
{
    print("Engine System loaded.");
    return 1;
}
What the fuck is that kind of a function? You just use an "open" bracket without an callback!
That give some errors. As third, you have this:
pawn Код:
}
//---------------------------[ENGINE THINKS]-------------------------------------
{
        dcmd(exitveh, 7, cmdtext);
        dcmd(engine, 6, cmdtext);
        return 0;
}
The same shit again. Add that stuff in "OnPlayerCommandText".
And OMG again..
pawn Код:
{
    TogglePlayerControllable(playerid,1);
    return 1;
}
I think, if you fix this, it should give no errors / less errors,
try to fix that and then give the new errors (I won't fix it for you. If you do/try it yourself, you'll get more experience with scripting)

- Kevin

p.s.
Stupid questions don't exists! So don't say your question is stupid, or something like that.
My first filterscript was one big shit! I had this in OnPlayerCommandText:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(IsPlayerAdmin(playerid))
    {
        if(strcmp(cmdtext, "/kevintest", true) == 0)
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "It is working!");
        }
    }
    else
    {
        SendClientMessage(playerid, 0x00000000, "You are not an RCON admin!");
    }
    return 1;
}
Output: If you typ ANY command as an non-RCON admin it says: "" You are not an RCON admin! "" and only the fommand /kevintest was working as an RCON admin. BIG FAIL. Did I ask for help? YES I DID. It was still not a stupid question, 'Whats wrong with this'. So stfu. YOUR QUESTION IS NOT STUPID/NOOBISH
Reply
#5

If i understood all and corrected all rigth now it have only 5 errors...

Код:
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(202) : error 055: start of function body without function header
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(203) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(204) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(205) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(209) : error 010: invalid function or declaration
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(354) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(377) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(380) : warning 217: loose indentation
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(430) : warning 203: symbol is never used: "dcmd_engine"
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(430) : warning 203: symbol is never used: "dcmd_exitveh"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
GameMode code(idk what is alried bad... I want to put the engine sysetm on the gamemode!) It was all going rigth BEFORE add the engine system(engine system code is on my first post )

pawn Код:
#include <a_samp>
#include <file>
#include <a_samp>
#include <mapicon>
#include <newf>
#include <dcmd>
#include <cpstream>
#include <md5>
#include <streamer>

#pragma dynamic 145000
//-----------------------------------------------------------------
main()
{
    print("\n----------------------------------");
    print(" RR-RP by Ricardo_Rodrigues");
    print("----------------------------------\n");
}
//-----------------------------------------------------------------
#define MAX_SLOTS 30
#define OWNER_NAME "Ricardo_Rodrigues
#define DEFINE_NAME INT"
#define SendMessage(%0, %1, %2)
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//---------------[COLORS/TEAMS]------------------------------------------
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_SYSTEM 0xFFA500AA
#define COLOR_SUSPECT 0xFF8000AA
#define COLOR_NEWS 0x0259EAAA
#define COLOR_DARKRED 0x8B0000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_PINK 0xDC00DDAA
#define COLOR_BLUE 0x0259EAAA
#define COLOR_GREEN 0x00A800AA
#define COLOR_ORANGE 0xFF8000AA
#define COLOR_CYAN 0xFF8080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DARKBLUE 0x0000A0AA
#define COLOR_BLACK 0x000000AA
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_PURPLE 0xFF00FFAA
#define COLOR_BROWN 0x804000AA

#define TEAMCOLOR_NONE 0xAFAFAFAA
#define TEAMCOLOR_GROVE 0x00A800AA
#define TEAMCOLOR_BALLAS 0xFF00FFAA
#define TEAMCOLOR_AZTECAS 0x33CCFFAA
#define TEAMCOLOR_VAGOS 0xFFFF00AA
#define TEAMCOLOR_RIFA 0x33CCFFAA
#define TEAMCOLOR_BIKER 0xFF0080AA
#define TEAMCOLOR_FIREMAN 0xB22222AA
#define TEAMCOLOR_MEDIC 0x87CEEBAA
#define TEAMCOLOR_COP 0x0259EAAA
#define TEAMCOLOR_NORMAL 0xFFFFFFAA
#define TEAMCOLOR_ARMY 0x556B2FAA
#define TEAMCOLOR_NEWS 0x3CB371AA

#define TEAM_NONE 0
#define TEAM_GROVE 1
#define TEAM_BALLAS 2
#define TEAM_AZTECAS 3
#define TEAM_VAGOS 4
#define TEAM_RIFA 5
#define TEAM_BIKER 6
#define TEAM_MEDIC 7
#define TEAM_FIREMAN 8
#define TEAM_COP 9
#define TEAM_NORMAL 10
#define TEAM_ARMY 11
#define TEAM_NEWS 12
//---------------[COLORS FROM SEIFADMIN]---------------------------
#define GREEN       0x21DD00FF
#define RED         0xE60000FF
#define ADMIN_RED   0xFB0000FF
#define YELLOW      0xFFFF00FF
#define ORANGE      0xF97804FF
#define LIGHTRED    0xFF8080FF
#define LIGHTBLUE   0x00C2ECFF
#define PURPLE      0xB360FDFF
#define BLUE        0x1229FAFF
#define LIGHTGREEN  0x38FF06FF
#define DARKPINK    0xE100E1FF
#define DARKGREEN   0x008040FF
#define AQUAGREEN   0x00CACAFB
#define NICESKY     0x99FFFFAA
#define GREY        0xCECECEFF
#define WHITE       0xFFFFFFFF

#define blue 0x375FFFFF
#define red 0xFF0000AA
#define green 0x33FF33AA
#define yellow 0xFFFF00AA
#define grey 0xC0C0C0AA
#define blue1 0x2641FEAA
#define lightblue 0x33CCFFAA
#define orange 0xFF9900AA
#define black 0x2C2727AA
#define COLOR_BLACK 0x000000AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN1 0x33AA33AA
//---------------[SETTINGS]----------------------------------------
#define GAMEMODE_NAME "RR-RP"
#define GAMEMODE_MAP "Los Santos"
#define GAMEMODE_SITE "Coming Soon!"
#define GAMEMODE_IRC "Coming Soon!"
#define GAMEMODE_TS "Coming Soon!"
#define GAMEMODE_VERSION "V1.0"
#define GAMEMODE_DATUM "09/09/2010"
#define BOT_NAME "[BOT]Time"
#define PLAYER_JAILED_SECONDS 1000
#define VEHICLE_RESPAWN 300
#define HOUSECAR_RESPAWN 600
#define FIXHOUSECAR_MONEY 1000
#define GARBAGE_MONEY 100
#define RENTCAR_MONEY 500
#define INVALID_VEHICLE 755
#define DEATH_MONEY 10
#define KILL_MONEY 50
#define MAX_SPEED 500
#define RAMP_MODEL 1632
#define RAMP_DISTANCE 0
#define RAMP_TIME 0
#define MAX_HOUSES 110
#define STANDARD_HOUSEVEHICLE 516
#define INVALID_HOUSE_ID 255
#define MAX_BUSINESSES 14
#define INVALID_BUSINESS_ID 255
#define MAX_BUSINESS_ENTERPRICE 1000
#define BUSINESS_PAYDAY_EARNS 10000

new Engine[MAX_VEHICLES];

forward EngineTimer(playerid);

public OnGameModeInit()
{
    SetGameModeText("RR-RP");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s has joined the server. Welcome!",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid,2229.348388,-1159.111653,25.806554);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
        SendClientMessageToAll(0xFFFF00AA, str);
        return 1;
    }
    return 0;
}
{
        dcmd(exitveh, 7, cmdtext);
        dcmd(engine, 6, cmdtext);
        return 0;
}
{
    TogglePlayerControllable(playerid,1);
    return 1;
}

dcmd_engine(playerid, params[])
{
        #pragma unused params
        new vehicleid = GetPlayerVehicleID(playerid);
        if(Engine[vehicleid] == 0)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Starting...");
        SetTimerEx("EngineTimer", 2000, 0, "i", playerid);
        }
        else if(Engine[vehicleid] == 1)
        {
        Engine[vehicleid] = 0;
        SendClientMessage(playerid, COLOR_RED, "Engine Stopped...");
        SendClientMessage(playerid, COLOR_YELLOW, "To exit the vehicle press (F Key) Or (Enter)");
    SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
        TogglePlayerControllable(playerid,0);
        }
        return 1;
}

dcmd_exitveh(playerid, params[])
{
        #pragma unused params
        if(IsPlayerInAnyVehicle(playerid))
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else
        {
        SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle");
        }
        return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SendClientMessage(playerid, 0x1229FAFF, " [RR-RP]You are entering a State car! Drive careful!");
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    SendClientMessage(playerid, 0x1229FAFF, "[RR-RP]You Leaved the car, DON'T Forget to park it rigth!");
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
  new vehicleid = GetPlayerVehicleID(playerid);
  if(Engine[vehicleid] == 0)
  {
  TogglePlayerControllable(playerid, 0);
  SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
  }
  else if(Engine[vehicleid] == 1)
    {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Running...");
    }
}
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new vehicleid = GetPlayerVehicleID(playerid);
        if(IsPlayerInAnyVehicle(playerid))
        {
        if(Engine[vehicleid] == 0)
        {
        if(newkeys & KEY_SECONDARY_ATTACK)
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        }
        else if(newkeys & KEY_JUMP)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Starting...");
        SetTimerEx("EngineTimer", 2000, 0, "i", playerid);
        }
        }
}
        return 1;
}

public EngineTimer(playerid)
{
    new rand = random(2);

        if(rand == 0)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Started...");
        SendClientMessage(playerid, COLOR_YELLOW, "To turn off the vehicle, Type (/engine)");
        new vehicleid = GetPlayerVehicleID(playerid);
        Engine[vehicleid] = 1;
        TogglePlayerControllable(playerid, 1);
        }

        if(rand == 1)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Failed...");
    SendClientMessage(playerid, COLOR_YELLOW, "Try Again");
        }
}
public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}
public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Reply
#6

The loose indentation:
This means the code is a bit messy. That doesn't matter, as an beginner.
A tip, to make a clean code:

Код:
After using an bracket (open bracket) or an if statement, use on the new line a TAB. Example:
pawn Код:
if(this){ //And after this an TAB [= 4 spaces]    print("this is true!"); }//close bracket. Same line as the bracket opener
or, a better code:
pawn Код:
if(this)    print("this is true!");
You had, for example:

pawn Код:
public EngineTimer(playerid)
{
    new rand = random(2);

        if(rand == 0)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Started...");
        SendClientMessage(playerid, COLOR_YELLOW, "To turn off the vehicle, Type (/engine)");
        new vehicleid = GetPlayerVehicleID(playerid);
        Engine[vehicleid] = 1;
        TogglePlayerControllable(playerid, 1);
        }

        if(rand == 1)
        {
    SendClientMessage(playerid, COLOR_GREEN, "Engine Failed...");
    SendClientMessage(playerid, COLOR_YELLOW, "Try Again");
        }

}
And now the "clean" version

pawn Код:
public EngineTimer(playerid)
{
    new rand = random(2);

    if(rand == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Started...");
        SendClientMessage(playerid, COLOR_YELLOW, "To turn off the vehicle, Type (/engine)");
        new vehicleid = GetPlayerVehicleID(playerid);
        Engine[vehicleid] = 1;
        TogglePlayerControllable(playerid, 1);
    }
    else if(rand == 1) //else if instead of 'if'
    {
        SendClientMessage(playerid, COLOR_GREEN, "Engine Failed...");
        SendClientMessage(playerid, COLOR_YELLOW, "Try Again");
    }
}
You see the difference? With an "clean" code, you can find error's faster. It also looks more pro and it is a better overview if you look for something.

- Kevin

p.s.
I've editted my previous post. Read the 'p.s.'
Reply
#7

Nice... I noticed that, all GOOD scripts have 1 TAB.....
Reply
#8

Quote:
Originally Posted by Ricardo187
Посмотреть сообщение
Nice... I noticed that, all GOOD scripts have 1 TAB.....
Yes.. It's called good indentation.
Reply
#9

The part below OnPlayerCommandText is even worser now man..
pawn Код:
}
{
        dcmd(exitveh, 7, cmdtext);
        dcmd(engine, 6, cmdtext);
        return 0;
}
{
    TogglePlayerControllable(playerid,1);
    return 1;
}
Double errors. Whatever another tip.
Example, one error line is this:
Код:
C:\Users\Ricardo\Desktop\Meu GM\MeuGm\gamemodes\RR-RP.pwn(202) : error 055: start of function body without function header
You see: (202). That's line 202 of the script. Press CTRL+G and fill in '202'. After that, press 'OK' on the screen or 'ENTER' on your keyboard. Your pawno will go to that line. There is the error. Maybe you see the problem better then, and then you can fix it. Please try this for all errors (and warnings). If it's still not working then, I'll try (or better, MAKE) your script without errors (+warnings).

- Kevin
Reply
#10

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
The part below OnPlayerCommandText is even worser now man..
pawn Код:
}
{
        dcmd(exitveh, 7, cmdtext);
        dcmd(engine, 6, cmdtext);
        return 0;
}
{
    TogglePlayerControllable(playerid,1);
    return 1;
}
WTF?

What made you think that would work.. :S
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)