15.12.2010, 19:30
(
Последний раз редактировалось Ricardo187; 15.12.2010 в 20:32.
)
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!
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