A Small Favour
#1

i got a Problem

PHP код:
AirportMissionStart(playerid) {
    if(
MissionStage[playerid] == STAGE_IDLE) {
        new 
vehiclemod GetVehicleModel(GetPlayerVehicleID(playerid));
       if(
vehiclemod == 519 || vehiclemod == (593) || vehiclemod == (553) )
      {
            new
                
idx,
                
Floattmp,
                
Floatdist GetPlayerDistanceFromPoint(playeridgAirports[0][0], gAirports[0][1], gAirports[0][2])
            ;
            for(new 
1sizeof gAirports; ++i) {
                
tmp GetPlayerDistanceFromPoint(playeridgAirports[i][0], gAirports[i][1], gAirports[i][2]);
                if(
tmp dist) {
                    
dist tmp;
                    
idx i;
                }
            }
            
MissionStage[playerid] = STAGE_LOAD idx;
            return 
SetPlayerCheckpoint(playeridgAirports[idx][0], gAirports[idx][1], gAirports[idx][2], 20.0);
        }
    }
    return 
false;

when a player enter a shamal or dodo or naveda and type /work it will start a work and creates a new cp for loading
but i want to make it load if the player is only in a shamal or naveda or dodo..

here is my cp codes

PHP код:
public OnPlayerEnterCheckpoint(playerid) {
    switch(
MissionStage[playerid]) {
        case 
STAGE_IDLE: {} // do not remove
        
case STAGE_UNLOAD: {
            new
                
string[64]
            ;
            
//FreezePlayer(playerid, 3000);//i disable that for test
            
DisablePlayerCheckpoint(playerid);
            
GameTextForPlayer(playerid"~g~Passengers UnLoading !"20004);
            
//SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            
SetPVarInt(playerid"PVarScore"1);
            
//GivePlayerMoney(playerid, 4000 + random(4000));
            
SetPVarInt(playerid"PVarMoney"4000 random(4000));
            
GetPlayerName(playeridstringMAX_PLAYER_NAME);
            
strcat(string" Completed a Flight!");
            
SendClientMessageToAll(COLOR_ORANGEstring);
            
SendClientMessage(playeridCOLOR_GREY"All Passengers had Been UnBoarded!");
            
MissionStage[playerid] = STAGE_IDLE;
        }
        default: { 
// STAGE_LOAD
            
new
                
rand random(sizeof gAirports 1)
            ;
            if(
rand == (MissionStage[playerid] - STAGE_LOAD)) {
                
rand++;
            }
            
//FreezePlayer(playerid, 3000); //i disable that for test
            
DisablePlayerCheckpoint(playerid);
            
GameTextForPlayer(playerid"~g~Passengers Boarding !"20004);
            
SetPlayerCheckpoint(playeridgAirports[rand][0], gAirports[rand][1], gAirports[rand][2], 10.0);
            
SendClientMessage(playeridCOLOR_GREY"All Passengers has Been Boarded and Fastened Their Seat Belts!");
            
MissionStage[playerid] = STAGE_UNLOAD;
        }
    }
    return 
false;

Reply
#2

PHP код:
public OnPlayerEnterCheckpoint(playerid) {
    switch(
MissionStage[playerid]) {
        case 
STAGE_IDLE: {} // do not remove
        
case STAGE_UNLOAD: {
            new
                
string[64]
            ;
            
//FreezePlayer(playerid, 3000);//i disable that for test
            
DisablePlayerCheckpoint(playerid);
            
GameTextForPlayer(playerid"~g~Passengers UnLoading !"20004);

            
//SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            
SetPVarInt(playerid"PVarScore"1);
            
//GivePlayerMoney(playerid, 4000 + random(4000));
            
SetPVarInt(playerid"PVarMoney"4000 random(4000));
            
GetPlayerName(playeridstringMAX_PLAYER_NAME);
            
strcat(string" Completed a Flight!");
            
SendClientMessageToAll(COLOR_ORANGEstring);
            if(
GetVehicleModel(vehicleid) == 519// 411 is the Infernus model
            
else
            return 
0;
            
SendClientMessage(playeridCOLOR_GREY"All Passengers had Been UnBoarded!");
            
MissionStage[playerid] = STAGE_IDLE;
        }
        default: { 
// STAGE_LOAD
            
new
                
rand random(sizeof gAirports 1)
            ;
            if(
rand == (MissionStage[playerid] - STAGE_LOAD)) {
                
rand++;
            }
            
//FreezePlayer(playerid, 3000); // disable that for test
            
DisablePlayerCheckpoint(playerid);
            
GameTextForPlayer(playerid"~g~Passengers Boarding !"20004);
            
SetPlayerCheckpoint(playeridgAirports[rand][0], gAirports[rand][1], gAirports[rand][2], 10.0);
            
SendClientMessage(playeridCOLOR_GREY"All Passengers has Been Boarded and Fastened Their Seat Belts!");

            
MissionStage[playerid] = STAGE_UNLOAD;
        }
    }
    return 
false;

giving these errors
PHP код:
C:\Users\Farha\Desktop\New folder\filterscripts\Untitled11.pwn(136) : error 029invalid expressionassumed zero
C
:\Users\Farha\Desktop\New folder\filterscripts\Untitled11.pwn(136 -- 137) : warning 215expression has no effect
C
:\Users\Farha\Desktop\New folder\filterscripts\Untitled11.pwn(137) : error 001expected token";"but found "return"
C:\Users\Farha\Desktop\New folder\filterscripts\Untitled11.pwn(138) : warning 225unreachable code
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase 
Reply
#3

still looking for help
Reply
#4

Try this:

Код:
public OnPlayerEnterCheckpoint(playerid) {
    switch(MissionStage[playerid]) {
        case STAGE_IDLE: {} // do not remove
        case STAGE_UNLOAD: {
            new
                string[64]
            ;
            //FreezePlayer(playerid, 3000);//i disable that for test
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "~g~Passengers UnLoading !", 2000, 4);

            //SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            SetPVarInt(playerid, "PVarScore", 1);
            //GivePlayerMoney(playerid, 4000 + random(4000));
            SetPVarInt(playerid, "PVarMoney", 4000 + random(4000));
            GetPlayerName(playerid, string, MAX_PLAYER_NAME);
            strcat(string, " Completed a Flight!");
            SendClientMessageToAll(COLOR_ORANGE, string);
            if(GetVehicleModel(vehicleid) == 519) // 411 is the Infernus model
            else return 0;
            SendClientMessage(playerid, COLOR_GREY, "All Passengers had Been UnBoarded!");
            MissionStage[playerid] = STAGE_IDLE;
        }
        default: { // STAGE_LOAD
            new
                rand = random(sizeof gAirports - 1)
            ;
            if(rand == (MissionStage[playerid] - STAGE_LOAD)) {
                rand++;
            }
            //FreezePlayer(playerid, 3000); // disable that for test
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "~g~Passengers Boarding !", 2000, 4);
            SetPlayerCheckpoint(playerid, gAirports[rand][0], gAirports[rand][1], gAirports[rand][2], 10.0);
            SendClientMessage(playerid, COLOR_GREY, "All Passengers has Been Boarded and Fastened Their Seat Belts!");

            MissionStage[playerid] = STAGE_UNLOAD;
        }
    }
    return false;
}
Reply
#5

Quote:
Originally Posted by K0P
Посмотреть сообщение
Try this:

Код:
public OnPlayerEnterCheckpoint(playerid) {
    switch(MissionStage[playerid]) {
        case STAGE_IDLE: {} // do not remove
        case STAGE_UNLOAD: {
            new
                string[64]
            ;
            //FreezePlayer(playerid, 3000);//i disable that for test
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "~g~Passengers UnLoading !", 2000, 4);

            //SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            SetPVarInt(playerid, "PVarScore", 1);
            //GivePlayerMoney(playerid, 4000 + random(4000));
            SetPVarInt(playerid, "PVarMoney", 4000 + random(4000));
            GetPlayerName(playerid, string, MAX_PLAYER_NAME);
            strcat(string, " Completed a Flight!");
            SendClientMessageToAll(COLOR_ORANGE, string);
            if(GetVehicleModel(vehicleid) == 519) // 411 is the Infernus model
            else return 0;
            SendClientMessage(playerid, COLOR_GREY, "All Passengers had Been UnBoarded!");
            MissionStage[playerid] = STAGE_IDLE;
        }
        default: { // STAGE_LOAD
            new
                rand = random(sizeof gAirports - 1)
            ;
            if(rand == (MissionStage[playerid] - STAGE_LOAD)) {
                rand++;
            }
            //FreezePlayer(playerid, 3000); // disable that for test
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "~g~Passengers Boarding !", 2000, 4);
            SetPlayerCheckpoint(playerid, gAirports[rand][0], gAirports[rand][1], gAirports[rand][2], 10.0);
            SendClientMessage(playerid, COLOR_GREY, "All Passengers has Been Boarded and Fastened Their Seat Belts!");

            MissionStage[playerid] = STAGE_UNLOAD;
        }
    }
    return false;
}
giving same errors
Reply
#6

Quote:
Originally Posted by Shaheen
Посмотреть сообщение
giving same errors
Код:
 if(rand == (MissionStage[playerid] - STAGE_LOAD)) {
You shouldn't use that in that way.

- STAGE_LOAD is probably causing the issue.


Add some // comments with some line numbers in so they are visible for us to find the errors.
Reply
#7

errors is not the problem but i want to check if the player is in shamal,dodo or naveda when enterting a cp
Reply
#8

Quote:
Originally Posted by Shaheen
Посмотреть сообщение
errors is not the problem but i want to check if the player is in shamal,dodo or naveda when enterting a cp
give the lines with the errors...
Reply
#9

Код:
public OnPlayerEnterCheckpoint(playerid) {
    switch(MissionStage[playerid]) {
        case STAGE_IDLE: {} // do not remove
        case STAGE_UNLOAD: {
            new
                string[64]
            ;
            //FreezePlayer(playerid, 3000);//i disable that for test
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "~g~Passengers UnLoading !", 2000, 4);

            //SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            SetPVarInt(playerid, "PVarScore", 1);
            //GivePlayerMoney(playerid, 4000 + random(4000));
            SetPVarInt(playerid, "PVarMoney", 4000 + random(4000));
            GetPlayerName(playerid, string, MAX_PLAYER_NAME);
            strcat(string, " Completed a Flight!");
            SendClientMessageToAll(COLOR_ORANGE, string);
            if(GetVehicleModel(vehicleid) == 519) // 411 is the Infernus model
            else
            return 0;
            SendClientMessage(playerid, COLOR_GREY, "All Passengers had Been UnBoarded!");
            MissionStage[playerid] = STAGE_IDLE;
        }
        default: { // STAGE_LOAD
            new
                rand = random(sizeof gAirports - 1)
            ;
            if(rand == (MissionStage[playerid] - STAGE_LOAD)) {
                rand++;
            }
            //FreezePlayer(playerid, 3000); // disable that for test
            DisablePlayerCheckpoint(playerid);
            GameTextForPlayer(playerid, "~g~Passengers Boarding !", 2000, 4);
            SetPlayerCheckpoint(playerid, gAirports[rand][0], gAirports[rand][1], gAirports[rand][2], 10.0);
            SendClientMessage(playerid, COLOR_GREY, "All Passengers has Been Boarded and Fastened Their Seat Belts!");

            MissionStage[playerid] = STAGE_UNLOAD;
        }
    }
    return false;
}
Here is the code and i need a vehicle check when he enters checkpoint
Reply
#10

Try these

PHP код:
public OnPlayerEnterCheckpoint(playerid) {
     if(
GetVehicleModel(vehicleid) !=519 || GetVehicleModel(vehicleid) !=593 ) return 0//check player in shamal or dodo
switch(MissionStage[playerid]) {
    
    case 
STAGE_IDLE: {} // do not remove
        
case STAGE_UNLOAD: {
            new
                
string[64]
            ;
            
//FreezePlayer(playerid, 3000);//i disable that for test
            
DisablePlayerCheckpoint(playerid);
            
GameTextForPlayer(playerid"~g~Passengers UnLoading !"20004);
            
//SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            
SetPVarInt(playerid"PVarScore"1);
            
//GivePlayerMoney(playerid, 4000 + random(4000));
            
SetPVarInt(playerid"PVarMoney"4000 random(4000));
            
GetPlayerName(playeridstringMAX_PLAYER_NAME);
            
strcat(string" Completed a Flight!");
            
SendClientMessageToAll(COLOR_ORANGEstring);
           
            
            
SendClientMessage(playeridCOLOR_GREY"All Passengers had Been UnBoarded!");
            
MissionStage[playerid] = STAGE_IDLE;
        }
        default: { 
// STAGE_LOAD
            
new
                
rand random(sizeof gAirports 1)
            ;
            if(
rand == (MissionStage[playerid] - STAGE_LOAD)) {
                
rand++;
            }
            
//FreezePlayer(playerid, 3000); // disable that for test
            
DisablePlayerCheckpoint(playerid);
            
GameTextForPlayer(playerid"~g~Passengers Boarding !"20004);
            
SetPlayerCheckpoint(playeridgAirports[rand][0], gAirports[rand][1], gAirports[rand][2], 10.0);
            
SendClientMessage(playeridCOLOR_GREY"All Passengers has Been Boarded and Fastened Their Seat Belts!");
            
MissionStage[playerid] = STAGE_UNLOAD;
        }
    }
    return 
false;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)