Sziasztok!
Gyorsan összedobtam egy motor indító script-et!
Neve: Motor Indító 1.0
Készítette: Cosmo
Készítés idõ: 15 perc
Parancsok: /engine /kiszall
Teljes kód (ZCMD-vel)
// Motor Indító 1.0 By Cosmo
#include <a_samp>
#include <zcmd>
#define HIBA 0xFF0000FF
#define ZOLD 0x33AA33AA
new motor[MAX_VEHICLES];
forward MotorI(playerid);
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Motor Indító 1.0 by Cosmo\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
main()
{
print(\"\\n----------------------------------\");
print(\" Motor Indító 1.0 by Cosmo\");
print(\"----------------------------------\\n\");
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehid = GetPlayerVehicleID(playerid);
if(motor[vehid] == 0)
{
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid,-1,\"Indísd be a motort! (/engine)\");
}
else if(motor[vehid] == 1)
{
SendClientMessage(playerid,-1,\"A motor már be van indítva!\");
}
}
return 1;
}
CMD:engine(playerid,params[])
{
new vehid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(motor[vehid] == 0)
{
mIndit(playerid);
SendClientMessage(playerid,ZOLD,\"Motor indítása...\");
}
else if(motor[vehid] == 1)
{
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,HIBA,\"Motor leállítva!\");
}
}
else
{
SendClientMessage(playerid,HIBA,\"Nem vagy kocsiban!\");
}
return 1;
}
CMD:kiszall(playerid,params[])
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid,1);
return 1;
}
stock mIndit(playerid)
{
SetTimerEx(\"MotorI\",3000,false,\"u\",playerid);
}
public MotorI(playerid)
{
new vehid = GetPlayerVehicleID(playerid);
motor[vehid] = 1;
SendClientMessage(playerid,ZOLD,\"Motor beindítva!\");
TogglePlayerControllable(playerid,1);
}
Teljes kód (STRCMP-vel)
// Motor Indító 1.0 By Cosmo
#include <a_samp>
#include <zcmd>
#define HIBA 0xFF0000FF
#define ZOLD 0x33AA33AA
new motor[MAX_VEHICLES];
forward MotorI(playerid);
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Motor Indító 1.0 by Cosmo\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
main()
{
print(\"\\n----------------------------------\");
print(\" Motor Indító 1.0 by Cosmo\");
print(\"----------------------------------\\n\");
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehid = GetPlayerVehicleID(playerid);
if(motor[vehid] == 0)
{
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid,-1,\"Indísd be a motort! (/engine)\");
}
else if(motor[vehid] == 1)
{
SendClientMessage(playerid,-1,\"A motor már be van indítva!\");
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/engine\", cmdtext, true, 10) == 0)
{
new vehid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(motor[vehid] == 0)
{
mIndit(playerid);
SendClientMessage(playerid,ZOLD,\"Motor indítása...\");
}
else
{
motor[vehid] = 0;
TogglePlayerControllable(playerid,0);
}
}
else
{
SendClientMessage(playerid,HIBA,\"Nem vagy kocsiban!\");
}
return 1;
}
if (strcmp(\"/kiszall\", cmdtext, true, 10) == 0)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid,1);
return 1;
}
return 0;
}
CMD:engine(playerid,params[])
{
new vehid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(motor[vehid] == 0)
{
mIndit(playerid);
SendClientMessage(playerid,ZOLD,\"Motor indítása...\");
}
else if(motor[vehid] == 1)
{
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,HIBA,\"Motor leállítva!\");
}
}
else
{
SendClientMessage(playerid,HIBA,\"Nem vagy kocsiban!\");
}
return 1;
}
CMD:kiszall(playerid,params[])
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid,1);
return 1;
}
stock mIndit(playerid)
{
SetTimerEx(\"MotorI\",3000,false,\"u\",playerid);
}
public MotorI(playerid)
{
new vehid = GetPlayerVehicleID(playerid);
motor[vehid] = 1;
SendClientMessage(playerid,ZOLD,\"Motor beindítva!\");
TogglePlayerControllable(playerid,1);
}