Different functions - Same command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Different functions - Same command (
/showthread.php?tid=316200)
Different functions - Same command -
fabriziobondi - 05.02.2012
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(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 SendClientMessage(playerid,COLOR_DARKRED,"Non sei un autotrasportatore.");
}
return 1;
}
Re: Different functions - Same command -
Mosslah - 05.02.2012
Do you mean: You want to use the command "carica" for every job?
Re: Different functions - Same command -
2KY - 05.02.2012
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;
}