/repair help -
CaTaLinU - 01.01.2012
I have this /repair command
PHP код:
if(strcmp(cmd, "/repair", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 7)
{
SendClientMessage(playerid, COLOR_GREY, "Nu esti Mecanic sau nu faci parte din Need For Speed!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /repair [playerid/PartOfName] [price]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(money < 1 || money > 2000) { SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1, or above 2000!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, " Can't do that!"); return 1; }
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You offerd %s to fix his car for $%d .",giveplayer,money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Car Mechanic %s wants to repair your car for $%d, (type /accept repair) to accept.",sendername,money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RepairOffer[playa] = playerid;
RepairPrice[playa] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you / not in a car.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
return 1;
}
I don't know how to edit this command to make it work for faction with ID 16
....
i have tryied with
PHP код:
if(PlayerInfo[playerid][pJob] != 7 || PlayerInfo[playerid][pMember] != 16)
{
SendClientMessage(playerid, COLOR_GREY, "Nu esti Mecanic sau nu faci parte din Need For Speed!");
return 1;
}
but nothing
Thankyou
Respuesta: /repair help -
[Nikk] - 02.01.2012
pawn Код:
if(strcmp(cmd, "/repair", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 16)
{
SendClientMessage(playerid, COLOR_GREY, "Nu esti Mecanic sau nu faci parte din Need For Speed!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /repair [playerid/PartOfName] [price]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(money < 1 || money > 2000) { SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1, or above 2000!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, " Can't do that!"); return 1; }
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You offerd %s to fix his car for $%d .",giveplayer,money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Car Mechanic %s wants to repair your car for $%d, (type /accept repair) to accept.",sendername,money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RepairOffer[playa] = playerid;
RepairPrice[playa] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you / not in a car.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
return 1;
}
Job 16.
But if faction, how is faction enum ?
Re: /repair help -
Ballu Miaa - 02.01.2012
Try this one! I hope it works. [UNTESTED]
pawn Код:
if(strcmp(cmd, "/repair", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 16)
{
SendClientMessage(playerid, COLOR_GREY, "Nu esti Mecanic sau nu faci parte din Need For Speed!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /repair [playerid/PartOfName] [price]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(money < 1 || money > 2000) { SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1, or above 2000!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(PlayerInfo[playerid][pMember] == 16)
{
if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, " Can't do that!"); return 1; }
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You offerd %s to fix his car for $%d .",giveplayer,money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Car Mechanic %s wants to repair your car for $%d, (type /accept repair) to accept.",sendername,money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RepairOffer[playa] = playerid;
RepairPrice[playa] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you / not in a car.");
}
}
else { SendClientMessage(playerid,COLOR_GREY,"Your not a member of faction 16");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline.");
}
}
return 1;
}
Re: /repair help -
RuSke - 02.01.2012
Код:
if(strcmp(cmd, "/repair", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_GREY,"Nu esti in masina de mecanic");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " {FFA500}[INFO]:{ffffff} /repair [Player id] [price]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(money < 1 || money > 100) { SendClientMessage(playerid, COLOR_GREY, "{ffffff}Pretul nu poate fi mai mic de 1$, sau mai mare de 100$!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "{ffffff}Nu poate face asta!"); return 1; }
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Ai propus playerului %s sa repari masina la pret de $%d .",giveplayer,money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Mecanic %s iti propune sa repari masina la pret de $%d, (( /accept repair ))",sendername,money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RepairOffer[playa] = playerid;
RepairPrice[playa] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{ffffff}Acest player nu este langa tine / nu este in masina.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{ffffff}Acest player este offline.");
}
}
return 1;
}