31.03.2011, 04:59
How do i make the script effect everyone except for the playerid who used the command.
command(usekey, playerid, params[])
{
#pragma unused params
new vehicleid = GetPlayerVehicleID(playerid);
new string[128];
new PlayerVehicle = GetVehicleFileID(GetPlayerVehicleID(playerid));
if(Player[playerid][Cuffed] >= 1)
{
SendClientMessage(playerid, WHITE, "You may not execute that action right now.");
return 0;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Player[playerid][AdminLevel] < 1)
{
if(IsAnOwnedCar(vehicleid))
{
if(Player[i][CarLinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it.", Player[i][NickName]);
SendClientMessage(playerid, WHITE, string);
return 0;
}
if(Player[i][Car2LinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it.", Player[i][NickName]);
SendClientMessage(playerid, WHITE, string);
return 0;
}
if(Player[i][Car3LinkID] == vehicleid && Player[i][Car3Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it.", Player[i][NickName]);
SendClientMessage(playerid, WHITE, string);
return 0;
}
if(Player[playerid][Car1Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[playerid][Car1Engine] = 1;
SetVehicleParamsEx(Player[playerid][CarLinkID], Player[playerid][Car1Engine], Player[playerid][Car1Lights], Player[playerid][Car1Alarm], Player[playerid][Car1Doors], Player[playerid][Car1Hood], Player[playerid][Car1Trunk], Player[playerid][Car1Objective]);
return 0;
}
if(Player[playerid][Car2Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[playerid][Car2Engine] = 1;
SetVehicleParamsEx(Player[playerid][Car2LinkID], Player[playerid][Car2Engine], Player[playerid][Car2Lights], Player[playerid][Car2Alarm], Player[playerid][Car2Doors], Player[playerid][Car2Hood], Player[playerid][Car2Trunk], Player[playerid][Car2Objective]);
return 0;
}
if(Player[playerid][Car3Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[playerid][Car3Engine] = 1;
SetVehicleParamsEx(Player[playerid][Car3LinkID], Player[playerid][Car3Engine], Player[playerid][Car3Lights], Player[playerid][Car3Alarm], Player[playerid][Car3Doors], Player[playerid][Car3Hood], Player[playerid][Car3Trunk], Player[playerid][Car3Objective]);
return 0;
}
if(Player[playerid][Car1Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Player[playerid][Car1Engine] = 0;
SetVehicleParamsEx(Player[playerid][CarLinkID], Player[playerid][Car1Engine], Player[playerid][Car1Lights], Player[playerid][Car1Alarm], Player[playerid][Car1Doors], Player[playerid][Car1Hood], Player[playerid][Car1Trunk], Player[playerid][Car1Objective]);
return 0;
}
if(Player[playerid][Car2Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Player[playerid][Car2Engine] = 0;
SetVehicleParamsEx(Player[playerid][Car2LinkID], Player[playerid][Car2Engine], Player[playerid][Car2Lights], Player[playerid][Car2Alarm], Player[playerid][Car2Doors], Player[playerid][Car2Hood], Player[playerid][Car2Trunk], Player[playerid][Car2Objective]);
return 0;
}
if(Player[playerid][Car3Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Player[playerid][Car3Engine] = 0;
SetVehicleParamsEx(Player[playerid][Car3LinkID], Player[playerid][Car3Engine], Player[playerid][Car3Lights], Player[playerid][Car3Alarm], Player[playerid][Car3Doors], Player[playerid][Car3Hood], Player[playerid][Car3Trunk], Player[playerid][Car3Objective]);
return 0;
}
}
else
{
if(Vehicles[PlayerVehicle][CarGroup] != 0 && Vehicles[PlayerVehicle][CarGroup] != Player[playerid][Group])
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it. Stealing it will set off the alarm and raise your wanted level!", Groups[Vehicles[PlayerVehicle][CarGroup]][GroupName]);
SendClientMessage(playerid, WHITE, string);
return 0;
}
if(Vehicles[PlayerVehicle][CarGroup] == 0 && Vehicles[PlayerVehicle][VehicleEngine] == 0)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
SendClientMessage(playerid, WHITE, "You do not own this car, use /hotwire to steal this vehicle. Stealing it will set off the alarm!");
return 0;
}
}
}
else
{
if(IsAnOwnedCar(vehicleid))
{
if(Player[i][Car1Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[i][Car1Engine] = 1;
SetVehicleParamsEx(Player[i][CarLinkID], Player[i][Car1Engine], Player[i][Car1Lights], Player[i][Car1Alarm], Player[i][Car1Doors], Player[i][Car1Hood], Player[i][Car1Trunk], Player[i][Car1Objective]);
return 0;
}
if(Player[i][Car2Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[i][Car2Engine] = 1;
SetVehicleParamsEx(Player[i][Car2LinkID], Player[i][Car2Engine], Player[i][Car2Lights], Player[i][Car2Alarm], Player[i][Car2Doors], Player[i][Car2Hood], Player[i][Car2Trunk], Player[i][Car2Objective]);
return 0;
}
if(Player[i][Car3Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[i][Car3Engine] = 1;
SetVehicleParamsEx(Player[i][Car3LinkID], Player[i][Car3Engine], Player[i][Car3Lights], Player[i][Car3Alarm], Player[i][Car3Doors], Player[i][Car3Hood], Player[i][Car3Trunk], Player[i][Car3Objective]);
return 0;
}
if(Player[i][Car1Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Player[i][Car1Engine] = 0;
SetVehicleParamsEx(Player[i][CarLinkID], Player[i][Car1Engine], Player[i][Car1Lights], Player[i][Car1Alarm], Player[i][Car1Doors], Player[i][Car1Hood], Player[i][Car1Trunk], Player[i][Car1Objective]);
return 0;
}
if(Player[i][Car2Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Player[i][Car2Engine] = 0;
SetVehicleParamsEx(Player[i][Car2LinkID], Player[i][Car2Engine], Player[i][Car2Lights], Player[i][Car2Alarm], Player[i][Car2Doors], Player[i][Car2Hood], Player[i][Car2Trunk], Player[i][Car2Objective]);
return 0;
}
if(Player[i][Car3Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Player[i][Car3Engine] = 0;
SetVehicleParamsEx(Player[i][Car3LinkID], Player[i][Car3Engine], Player[i][Car3Lights], Player[i][Car3Alarm], Player[i][Car3Doors], Player[i][Car3Hood], Player[i][Car3Trunk], Player[i][Car3Objective]);
return 0;
}
}
else
{
if(Vehicles[PlayerVehicle][CarGroup] >= 0 && Vehicles[PlayerVehicle][VehicleEngine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Vehicles[PlayerVehicle][VehicleEngine] = 1;
SetVehicleParamsEx(PlayerVehicle, Vehicles[PlayerVehicle][VehicleEngine], Vehicles[PlayerVehicle][VehicleLights], Vehicles[PlayerVehicle][VehicleAlarm], Vehicles[PlayerVehicle][VehicleDoors], Vehicles[PlayerVehicle][VehicleHood], Vehicles[PlayerVehicle][VehicleTrunk], Vehicles[PlayerVehicle][VehicleObjective]);
return 0;
}
if(Vehicles[PlayerVehicle][CarGroup] >= 0 && Vehicles[PlayerVehicle][VehicleEngine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to stop the car's engine.");
Vehicles[PlayerVehicle][VehicleEngine] = 0;
SetVehicleParamsEx(PlayerVehicle, Vehicles[PlayerVehicle][VehicleEngine], Vehicles[PlayerVehicle][VehicleLights], Vehicles[PlayerVehicle][VehicleAlarm], Vehicles[PlayerVehicle][VehicleDoors], Vehicles[PlayerVehicle][VehicleHood], Vehicles[PlayerVehicle][VehicleTrunk], Vehicles[PlayerVehicle][VehicleObjective]);
return 0;
}
}
}
}
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsAnOwnedCar(vehicleid))
{
if(Player[i][Car1Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[i][Car1Engine] = 1;
SetVehicleParamsEx(Player[i][CarLinkID], Player[i][Car1Engine], Player[i][Car1Lights], Player[i][Car1Alarm], Player[i][Car1Doors], Player[i][Car1Hood], Player[i][Car1Trunk], Player[i][Car1Objective]);
return 0;
}
if(Player[i][CarLinkID] == vehicleid && Player[playerid][CarLinkID] != vehicleid)
{
command(usekey, playerid, params[])
{
#pragma unused params
new string[128];
new vehicleid = GetPlayerVehicleID(playerid);
new PlayerVehicle = GetVehicleFileID(vehicleid);
if(Player[playerid][Cuffed] >= 1)
{
SendClientMessage(playerid, WHITE, "You may not execute that action right now.");
return 1;
}
if(IsAnOwnedCar(vehicleid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Player[playerid][AdminLevel] < 1)
{
if(Player[i][CarLinkID] == vehicleid && Player[playerid][CarLinkID] != vehicleid)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it.", Player[i][NickName]);
SendClientMessage(playerid, WHITE, string);
return 1;
}
if(Player[i][Car2LinkID] == vehicleid && Player[playerid][Car2LinkID] != vehicleid)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it.", Player[i][NickName]);
SendClientMessage(playerid, WHITE, string);
return 1;
}
if(Player[i][Car3LinkID] == vehicleid && Player[playerid][Car3LinkID] != vehicleid)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it.", Player[i][NickName]);
SendClientMessage(playerid, WHITE, string);
return 1;
}
if(Player[i][Car1Engine] == 0 && Player[playerid][CarLinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[playerid][Car1Engine] = 1;
SetVehicleParamsEx(Player[playerid][CarLinkID], Player[playerid][Car1Engine], Player[playerid][Car1Lights], Player[playerid][Car1Alarm], Player[playerid][Car1Doors], Player[playerid][Car1Hood], Player[playerid][Car1Trunk], Player[playerid][Car1Objective]);
return 1;
}
if(Player[i][Car2Engine] == 0 && Player[playerid][Car2LinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[playerid][Car2Engine] = 1;
SetVehicleParamsEx(Player[playerid][Car2LinkID], Player[playerid][Car2Engine], Player[playerid][Car2Lights], Player[playerid][Car2Alarm], Player[playerid][Car2Doors], Player[playerid][Car2Hood], Player[playerid][Car2Trunk], Player[playerid][Car2Objective]);
return 1;
}
if(Player[i][Car3Engine] == 0 && Player[playerid][Car3LinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[playerid][Car3Engine] = 1;
SetVehicleParamsEx(Player[playerid][Car3LinkID], Player[playerid][Car3Engine], Player[playerid][Car3Lights], Player[playerid][Car3Alarm], Player[playerid][Car3Doors], Player[playerid][Car3Hood], Player[playerid][Car3Trunk], Player[playerid][Car3Objective]);
return 1;
}
if(Player[i][Car1Engine] == 1 && Player[playerid][CarLinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You use your keys to turn off the car's engine.");
Player[playerid][Car1Engine] = 0;
SetVehicleParamsEx(Player[playerid][CarLinkID], Player[playerid][Car1Engine], Player[playerid][Car1Lights], Player[playerid][Car1Alarm], Player[playerid][Car1Doors], Player[playerid][Car1Hood], Player[playerid][Car1Trunk], Player[playerid][Car1Objective]);
return 1;
}
if(Player[i][Car2Engine] == 1 && Player[playerid][Car2LinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You use your keys to turn off the car's engine.");
Player[playerid][Car2Engine] = 0;
SetVehicleParamsEx(Player[playerid][Car2LinkID], Player[playerid][Car2Engine], Player[playerid][Car2Lights], Player[playerid][Car2Alarm], Player[playerid][Car2Doors], Player[playerid][Car2Hood], Player[playerid][Car2Trunk], Player[playerid][Car2Objective]);
return 1;
}
if(Player[i][Car3Engine] == 1 && Player[playerid][Car3LinkID] == vehicleid)
{
SendClientMessage(playerid, WHITE, "You use your keys to turn off the car's engine.");
Player[playerid][Car3Engine] = 0;
SetVehicleParamsEx(Player[playerid][Car3LinkID], Player[playerid][Car3Engine], Player[playerid][Car3Lights], Player[playerid][Car3Alarm], Player[playerid][Car3Doors], Player[playerid][Car3Hood], Player[playerid][Car3Trunk], Player[playerid][Car3Objective]);
return 1;
}
}
else
{
if(Player[i][Car1Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[i][Car1Engine] = 1;
SetVehicleParamsEx(Player[i][CarLinkID], Player[i][Car1Engine], Player[i][Car1Lights], Player[i][Car1Alarm], Player[i][Car1Doors], Player[i][Car1Hood], Player[i][Car1Trunk], Player[i][Car1Objective]);
return 1;
}
if(Player[i][Car2Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[i][Car2Engine] = 1;
SetVehicleParamsEx(Player[i][Car2LinkID], Player[i][Car2Engine], Player[i][Car2Lights], Player[i][Car2Alarm], Player[i][Car2Doors], Player[i][Car2Hood], Player[i][Car2Trunk], Player[i][Car2Objective]);
return 1;
}
if(Player[i][Car3Engine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Player[i][Car3Engine] = 1;
SetVehicleParamsEx(Player[i][Car3LinkID], Player[i][Car3Engine], Player[i][Car3Lights], Player[i][Car3Alarm], Player[i][Car3Doors], Player[i][Car3Hood], Player[i][Car3Trunk], Player[i][Car3Objective]);
return 1;
}
if(Player[i][Car1Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to turn off the car's engine.");
Player[i][Car1Engine] = 0;
SetVehicleParamsEx(Player[i][CarLinkID], Player[i][Car1Engine], Player[i][Car1Lights], Player[i][Car1Alarm], Player[i][Car1Doors], Player[i][Car1Hood], Player[i][Car1Trunk], Player[i][Car1Objective]);
return 1;
}
if(Player[i][Car2Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to turn off the car's engine.");
Player[i][Car2Engine] = 0;
SetVehicleParamsEx(Player[i][Car2LinkID], Player[i][Car2Engine], Player[i][Car2Lights], Player[i][Car2Alarm], Player[i][Car2Doors], Player[i][Car2Hood], Player[i][Car2Trunk], Player[i][Car2Objective]);
return 1;
}
if(Player[i][Car3Engine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to turn off the car's engine.");
Player[i][Car3Engine] = 0;
SetVehicleParamsEx(Player[i][Car3LinkID], Player[i][Car3Engine], Player[i][Car3Lights], Player[i][Car3Alarm], Player[i][Car3Doors], Player[i][Car3Hood], Player[i][Car3Trunk], Player[i][Car3Objective]);
return 1;
}
}
}
}
else
{
if(Player[playerid][AdminLevel] < 1)
{
if(Vehicles[PlayerVehicle][CarGroup] != 0 && Vehicles[PlayerVehicle][CarGroup] != Player[playerid][Group])
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
format(string, sizeof(string), "This vehicle belongs to %s. Use /hotwire to steal it. Stealing it will set off the alarm and raise your wanted level!", Groups[Vehicles[PlayerVehicle][CarGroup]][GroupName]);
SendClientMessage(playerid, WHITE, string);
return 1;
}
if(Vehicles[PlayerVehicle][CarGroup] == 0 && Vehicles[PlayerVehicle][VehicleEngine] == 0)
{
SendClientMessage(playerid, WHITE, "You do not have the keys for this vehicle.");
SendClientMessage(playerid, WHITE, "You do not own this car, use /hotwire to steal this vehicle. Stealing it will set off the alarm!");
return 1;
}
}
else
{
if(Vehicles[PlayerVehicle][VehicleEngine] == 0)
{
SendClientMessage(playerid, WHITE, "You use your keys to start the car's engine.");
Vehicles[PlayerVehicle][VehicleEngine] = 1;
SetVehicleParamsEx(PlayerVehicle, Vehicles[PlayerVehicle][VehicleEngine], Vehicles[PlayerVehicle][VehicleLights], Vehicles[PlayerVehicle][VehicleAlarm], Vehicles[PlayerVehicle][VehicleDoors], Vehicles[PlayerVehicle][VehicleHood], Vehicles[PlayerVehicle][VehicleTrunk], Vehicles[PlayerVehicle][VehicleObjective]);
return 1;
}
if(Vehicles[PlayerVehicle][VehicleEngine] == 1)
{
SendClientMessage(playerid, WHITE, "You use your keys to turn off the car's engine.");
Vehicles[PlayerVehicle][VehicleEngine] = 0;
SetVehicleParamsEx(PlayerVehicle, Vehicles[PlayerVehicle][VehicleEngine], Vehicles[PlayerVehicle][VehicleLights], Vehicles[PlayerVehicle][VehicleAlarm], Vehicles[PlayerVehicle][VehicleDoors], Vehicles[PlayerVehicle][VehicleHood], Vehicles[PlayerVehicle][VehicleTrunk], Vehicles[PlayerVehicle][VehicleObjective]);
return 1;
}
}
}
return 1;
}