Different functions - Same command
#1

Introduction: Command 'carica' for job (ID: 3).

Request: I would to add others functions for others jobs by using the same command.

PHP код:
CMD:carica(playerid,params[])
{
        new 
Float:soPos[3];
        new 
vehicleid GetNearestVehicle(playerid);
        new 
string[135];
        
GetVehiclePos(vehicleidsoPos[0], soPos[1], soPos[2]);
        if(
camionjob[playerid] == 200)return SendClientMessage(playerid,COLOR_DARKRED,"Il camion и pieno. Vai a scaricare prima di continuare");
        {
            if(
playerVariables[playerid][pJob] == 3)
            {
                if(
vehicleVariables[vehicleid][vVehicleJob] == 3)
                {
                    if(
IsPlayerAttachedObjectSlotUsed(playerid,0)) RemovePlayerAttachedObject(playerid0);
                    
format(string,sizeof(string),"* %s carica la cassa sul retro del camion.",PlayerName(playerid));
                    
nearByMessage(playerid,COLOR_PURPLE,string);
                    
ClearAnimations(playerid);
                    
carico[playerid] = 0;
                    
camionjob[playerid] += 50;
                }
                else 
SendClientMessage(playerid,COLOR_DARKRED,"Devi andare vicino il tuo camion per caricare il materiale.");
            }
            else 
SendClientMessage(playerid,COLOR_DARKRED,"Non sei un autotrasportatore.");
        }
        return 
1;

Reply
#2

Do you mean: You want to use the command "carica" for every job?
Reply
#3

Like this?

pawn Код:
CMD:carica(playerid,params[])
{
        new Float:soPos[3];
        new vehicleid = GetNearestVehicle(playerid);
        new string[135];
        GetVehiclePos(vehicleid, soPos[0], soPos[1], soPos[2]);
        if(camionjob[playerid] == 200)return SendClientMessage(playerid,COLOR_DARKRED,"Il camion и pieno. Vai a scaricare prima di continuare");
        {
            if(playerVariables[playerid][pJob] == 3)
            {
                if(vehicleVariables[vehicleid][vVehicleJob] == 3)
                {
                    if(IsPlayerAttachedObjectSlotUsed(playerid,0)) RemovePlayerAttachedObject(playerid, 0);
                    format(string,sizeof(string),"* %s carica la cassa sul retro del camion.",PlayerName(playerid));
                    nearByMessage(playerid,COLOR_PURPLE,string);
                    ClearAnimations(playerid);
                    carico[playerid] = 0;
                    camionjob[playerid] += 50;
                }
                else SendClientMessage(playerid,COLOR_DARKRED,"Devi andare vicino il tuo camion per caricare il materiale.");
            }
            else if(playerVariables[playerid][pJob] == 4) //CHANGE THIS TO YOUR OTHER ID.
            {
                //effect if their Job ID is 4.
            }
            else SendClientMessage(playerid,COLOR_DARKRED,"Non sei un autotrasportatore.");
        }
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)