09.04.2011, 03:17
Lo que pasa es que estoy creando un servidor TDM y quiero implementar la funcion del GM Rivershell donde hay que robar un "objetivo" que es un coche, auto, etc del equipo contrario. Copie los codigos lo adapte a mi server , me copila pero al momento de probar si esta bien NO SIRVE porque no se marca el Objetivo y al momento de entrar al Coche que seria el Objetivo que hay que capturar la funcion no se cumple.
Ejem: Soy Rojo, spawneo y me marca el objetivo Rojo (el que tengo que protejer para que no sea robado) pero voi a capturar el Objetivo Azul y no lo marca y al entrar en el "coche objetivo" no se cumple ninguna funcion.
Es como si entrara en cualquier coche.
ACLARO por las dudas: Mi GM son 4 equipos y El Rivershell 2 equipos.
Bueno aqui el code
Eso seria lo que es la funcion de capturar el objetivo.
Porfavor si alguien sabe como solucionarlo se lo agradesco mucho
Ejem: Soy Rojo, spawneo y me marca el objetivo Rojo (el que tengo que protejer para que no sea robado) pero voi a capturar el Objetivo Azul y no lo marca y al entrar en el "coche objetivo" no se cumple ninguna funcion.
Es como si entrara en cualquier coche.
ACLARO por las dudas: Mi GM son 4 equipos y El Rivershell 2 equipos.
Bueno aqui el code
pawn Код:
#define TEAM_Dragones 1
#define TEAM_Caliguas 2
#define TEAM_ILEGALS 3
#define TEAM_EJERCITO 4
#define OBJECTIVE_VEHICLE_Eje 1
#define OBJECTIVE_VEHICLE_Ile 2
#define OBJECTIVE_VEHICLE_Dra 3
#define OBJECTIVE_VEHICLE_Cal 4
#define OBJECTIVE_COLOR 0xFFFFFFFF
new gObjectiveDraPlayer=(-1);
new gObjectiveCalPlayer=(-1);
new gObjectiveIlePlayer=(-1);
new gObjectiveEjePlayer=(-1);
public OnPlayerEnterCheckpoint(playerid)
{
new playervehicleid = GetPlayerVehicleID(playerid);
if(playervehicleid == OBJECTIVE_VEHICLE_Dra && gTeam[playerid] == TEAM_Dragones)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
SetVehicleToRespawn(OBJECTIVE_VEHICLE_Dra);
return;
}
else if(playervehicleid == OBJECTIVE_VEHICLE_Cal && gTeam[playerid] == TEAM_Caliguas)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
SetVehicleToRespawn(OBJECTIVE_VEHICLE_Cal);
return;
}
if(playervehicleid == OBJECTIVE_VEHICLE_Ile && gTeam[playerid] == TEAM_ILEGALS)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
SetVehicleToRespawn(OBJECTIVE_VEHICLE_Ile);
return;
}
else if(playervehicleid == OBJECTIVE_VEHICLE_Eje && gTeam[playerid] == TEAM_EJERCITO)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
SetVehicleToRespawn(OBJECTIVE_VEHICLE_Eje);
return;
}
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid;
if(newstate == PLAYER_STATE_DRIVER)
{
vehicleid = GetPlayerVehicleID(playerid);
if(gTeam[playerid] == TEAM_Dragones && vehicleid == OBJECTIVE_VEHICLE_Dra)
{ // It's the objective vehicle
SetPlayerColor(playerid,OBJECTIVE_COLOR);
GameTextForPlayer(playerid,"~w~Toma el ~y~Objetivo ~w~y vuelve a ~r~la base!!",3000,5);
SetPlayerCheckpoint(playerid,1982.6150,-220.6680,-0.2432,12.0);
gObjectiveDraPlayer = playerid;
}
if(gTeam[playerid] == TEAM_Caliguas && vehicleid == OBJECTIVE_VEHICLE_Cal)
{
SetPlayerColor(playerid,OBJECTIVE_COLOR);
GameTextForPlayer(playerid,"~w~Toma el ~y~Objetivo ~w~y vuelve a ~r~la base!!",3000,5);
SetPlayerCheckpoint(playerid,2328.2935,531.8324,0.0094,12.0);
gObjectiveCalPlayer = playerid;
}
if(gTeam[playerid] == TEAM_EJERCITO && vehicleid == OBJECTIVE_VEHICLE_Eje)
{
SetPlayerColor(playerid,OBJECTIVE_COLOR);
GameTextForPlayer(playerid,"~w~Toma el ~y~Objetivo ~w~y vuelve a ~r~la base!!",3000,5);
SetPlayerCheckpoint(playerid,1982.6150,-220.6680,-0.2432,12.0);
gObjectiveEjePlayer = playerid;
}
if(gTeam[playerid] == TEAM_ILEGALS && vehicleid == OBJECTIVE_VEHICLE_Ile)
{
SetPlayerColor(playerid,OBJECTIVE_COLOR);
GameTextForPlayer(playerid,"~w~Toma el ~y~Objetivo ~w~y vuelve a ~r~la base!!",3000,5);
SetPlayerCheckpoint(playerid,2328.2935,531.8324,0.0094,12.0);
gObjectiveIlePlayer = playerid;
}
}
else if(newstate == PLAYER_STATE_ONFOOT)
{
if(playerid == gObjectiveDraPlayer) {
gObjectiveDraPlayer = (-1);
SetPlayerToTeamColor(playerid);
DisablePlayerCheckpoint(playerid);
}
if(playerid == gObjectiveCalPlayer) {
gObjectiveCalPlayer = (-1);
SetPlayerToTeamColor(playerid);
DisablePlayerCheckpoint(playerid);
}
if(playerid == gObjectiveEjePlayer) {
gObjectiveEjePlayer = (-1);
SetPlayerToTeamColor(playerid);
DisablePlayerCheckpoint(playerid);
}
if(playerid == gObjectiveIlePlayer) {
gObjectiveIlePlayer = (-1);
SetPlayerToTeamColor(playerid);
DisablePlayerCheckpoint(playerid);
}
}
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
// Note for SA-MP 0.3:
// As the vehicle streams in, player team dependant params are applied. They can't be
// applied to vehicles that don't exist in the player's world.
if(vehicleid == OBJECTIVE_VEHICLE_Dra)
{
if(gTeam[forplayerid] == TEAM_Dragones) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Dra,forplayerid,1,1); // objective; locked
}
else if(gTeam[forplayerid] == TEAM_Caliguas) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Cal,forplayerid,1,0); // objective; unlocked
}
else if(gTeam[forplayerid] == TEAM_EJERCITO) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Eje,forplayerid,1,0); // objective; Unlocked
}
else if(gTeam[forplayerid] == TEAM_ILEGALS) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Ile,forplayerid,1,0); // objective; unlocked
}
}
else if(vehicleid == OBJECTIVE_VEHICLE_Cal)
{
if(gTeam[forplayerid] == TEAM_Caliguas) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Cal,forplayerid,1,1); // objective; locked
}
else if(gTeam[forplayerid] == TEAM_Dragones) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Dra,forplayerid,1,0); // objective; unlocked
}
else if(gTeam[forplayerid] == TEAM_EJERCITO) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Eje,forplayerid,1,0); // objective; Unlocked
}
else if(gTeam[forplayerid] == TEAM_ILEGALS) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Ile,forplayerid,1,0); // objective; unlocked
}
}
else if(vehicleid == OBJECTIVE_VEHICLE_Eje)
{
if(gTeam[forplayerid] == TEAM_EJERCITO) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Eje,forplayerid,1,1); // objective; locked
}
else if(gTeam[forplayerid] == TEAM_Dragones) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Dra,forplayerid,1,0); // objective; unlocked
}
else if(gTeam[forplayerid] == TEAM_Caliguas) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Cal,forplayerid,1,0); // objective; Unlocked
}
else if(gTeam[forplayerid] == TEAM_ILEGALS) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Ile,forplayerid,1,0); // objective; unlocked
}
}
else if(vehicleid == OBJECTIVE_VEHICLE_Ile)
{
if(gTeam[forplayerid] == TEAM_ILEGALS) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Ile,forplayerid,1,1); // objective; locked
}
else if(gTeam[forplayerid] == TEAM_Dragones) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Dra,forplayerid,1,0); // objective; unlocked
}
else if(gTeam[forplayerid] == TEAM_Caliguas) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Cal,forplayerid,1,0); // objective; Unlocked
}
else if(gTeam[forplayerid] == TEAM_EJERCITO) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_Eje,forplayerid,1,0); // objective; unlocked
}
}
return 1;
//printf("GameMode: VehicleStreamIn(%d,%d)",vehicleid,forplayerid);
}
public OnGameModeInit()
{
// OBJECTIVE VEHICLES
AddStaticVehicle(498,1690.2379,2292.5535,10.8878,271.4328,20,117); // Obje Eje
AddStaticVehicle(498,2821.7068,1252.1603,10.8276,358.3698,20,117); // Obje Ile
AddStaticVehicle(498,1994.1971,1072.0791,10.8880,248.0873,20,117); // Obje Dra
AddStaticVehicle(498,2161.3838,1645.5818,11.1646,15.9158,20,117); // Obje Cal
return 1;
}
Porfavor si alguien sabe como solucionarlo se lo agradesco mucho