22.06.2011, 18:52
Can you show me something with a command? For example /engine. Look at this:
Here is the full /engine part ( if you need )
pawn Код:
if(!strcmp(cmd, "/engine", true))
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
//How does it go on?
//In my script it goes on with this:
if(!engineOn[GetPlayerVehicleID(playerid)])
{
//But this is with Freeze ( TogglePlayerControllable )
//What do I have to change?
pawn Код:
if(!strcmp(cmd, "/engine", true))
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(!engineOn[GetPlayerVehicleID(playerid)])
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 59 || idcar == 60)
{
return 1;
}
if(idcar >= 135 && idcar <= 154)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAPlane(idcar))
{
return 1;
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
if(gEngine[playerid] == 1) { return 1; }
new playerveh = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(playerid, playerveh, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s dreht den Schlьssel und versucht den Motor zu starten.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("StartingTheVehicle",1500,0,"i",playerid);
GameTextForPlayer(playerid, "~w~Starte Motor",1500,1);
gEngine[playerid] = 1;
return 1;
}
if(engineOn[GetPlayerVehicleID(playerid)])
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 59 || idcar == 60)
{
return 1;
}
if(idcar >= 135 && idcar <= 154)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsAPlane(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
engineOn[GetPlayerVehicleID(playerid)] = false;
//RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s dreht den Schlьssel und stellt den Motor aus.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
gEngine[playerid] = 0;
/* new keycar = PlayerInfo[playerid][pPcarkey];
new keycar2 = PlayerInfo[playerid][pPcarkey2];
new keycar3 = PlayerInfo[playerid][pPcarkey3];
if(IsAnOwnableCar(idcar))
{
if(keycar == idcar)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,1);
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
CarInfo[keycar][cLock] = 1;
}
}
else if(keycar2 == idcar)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar2,i,0,1);
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
CarInfo[keycar2][cLock] = 1;
}
}
else if(keycar3 == idcar)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar3,i,0,1);
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
CarInfo[keycar3][cLock] = 1;
}
}
}*/
return 1;
}
}
}
return 1;
}