accept command -
thaKing - 19.01.2015
/*
Hello!
Well this is my accept cmd for now, and I can't find the problem, why it's not working.
I tried many ways, but usless. I trink problem is with 'tid', I'm not sure.
Anyway, please help me fix this, and even you can 'ieteikt' something, to make it better,
that would be geate.
Bye, Runcias
*/
pawn Код:
CMD:accept(playerid, params[])
{
new type[5], tid, string[64];
new vehid = GetPlayerVehicleID(playerid);
if(sscanf(params,"s[5]i",type,tid)){
SCM(playerid,-1,"[{D2B48C}help{FFFFFF}]: /accept [offer] [playerid]");
SCM(playerid,-1,"[{D2B48C}offers{FFFFFF}]: wheels, repair");
return 1;
}else if(!strcmp(type, "wheels", true)){
if(WheelsOffer[playerid] == 1){
if (sscanf(string, "u",tid))
return SCM(playerid,-1,"[{D2B48C}help{FFFFFF}]: /accept wheels [playerid]");
if(tid == MechanicID[playerid]){
SCM(playerid,COLOR_LGREEN,"You have accepted the offer! Choose your new wheels.");
SCM(playerid,COLOR_YELLOW,"Click on wheels only once! (It will automatly take your cash -$1000)");
PlayerInfo[playerid][Cash] -= 200;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][Cash]);
PlayerInfo[tid][Cash] += 200;
ResetPlayerMoney(tid);
GivePlayerMoney(tid,PlayerInfo[tid][Cash]);
MechanicID[playerid] = -1;
WheelsOffer[playerid] = 0;
ShowWheels(playerid);
}else{
SCM(playerid,COLOR_GREY,"You must enter mechanic's id, who offered you to change wheels.");
}
}else{
SCM(playerid,COLOR_GREY,"You have no offered wheels change!");
}
}else if(!strcmp(type, "repair", true)){
if(RepairOffer[playerid] == 1){
if (sscanf(string, "u",tid))
return SCM(playerid,-1,"[{D2B48C}help{FFFFFF}]: /accept repair [playerid]");
if(tid == MechanicID[playerid]){
RepairVehicle(vehid);
SCM(playerid,COLOR_LGREEN,"Your car has been repaired!");
RepairOffer[playerid] = 0;
MechanicID[playerid] = -1;
PlayerInfo[playerid][Cash] -= OfferPrice[playerid];
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][Cash]);
PlayerInfo[tid][Cash] += OfferPrice[playerid];
ResetPlayerMoney(tid);
GivePlayerMoney(tid,PlayerInfo[tid][Cash]);
OfferPrice[playerid] = -1;
MechanicID[playerid] = -1;
RepairOffer[playerid] = 0;
}else{
SCM(playerid,COLOR_GREY,"You must enter mechanic's id, who offered you to repair vehicle.");
}
}else{
SCM(playerid,COLOR_GREY,"You have no offered vehicle repair!");
}
}
return 1;
}
Re: accept command -
Matess - 19.01.2015
pawn Код:
CMD:accept(playerid, params[])
{
new type[5], tid;//, string[64];
new vehid = GetPlayerVehicleID(playerid);
if(sscanf(params,"s[5]i",type,tid)){
SCM(playerid,-1,"[{D2B48C}help{FFFFFF}]: /accept [offer] [playerid]");
SCM(playerid,-1,"[{D2B48C}offers{FFFFFF}]: wheels, repair");
return 1;
}else if(!strcmp(type, "wheels", true)){
if(WheelsOffer[playerid] == 1){
//if (sscanf(string, "u",tid))//string is empty
//return SCM(playerid,-1,"[{D2B48C}help{FFFFFF}]: /accept wheels [playerid]");
if(tid == MechanicID[playerid]){
SCM(playerid,COLOR_LGREEN,"You have accepted the offer! Choose your new wheels.");
SCM(playerid,COLOR_YELLOW,"Click on wheels only once! (It will automatly take your cash -$1000)");
PlayerInfo[playerid][Cash] -= 200;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][Cash]);
PlayerInfo[tid][Cash] += 200;
ResetPlayerMoney(tid);
GivePlayerMoney(tid,PlayerInfo[tid][Cash]);
MechanicID[playerid] = -1;
WheelsOffer[playerid] = 0;
ShowWheels(playerid);
}else{
SCM(playerid,COLOR_GREY,"You must enter mechanic's id, who offered you to change wheels.");
}
}else{
SCM(playerid,COLOR_GREY,"You have no offered wheels change!");
}
}else if(!strcmp(type, "repair", true)){
if(RepairOffer[playerid] == 1){
//if (sscanf(string, "u",tid))//string is empty
//return SCM(playerid,-1,"[{D2B48C}help{FFFFFF}]: /accept repair [playerid]");
if(tid == MechanicID[playerid]){
RepairVehicle(vehid);
SCM(playerid,COLOR_LGREEN,"Your car has been repaired!");
RepairOffer[playerid] = 0;
MechanicID[playerid] = -1;
PlayerInfo[playerid][Cash] -= OfferPrice[playerid];
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][Cash]);
PlayerInfo[tid][Cash] += OfferPrice[playerid];
ResetPlayerMoney(tid);
GivePlayerMoney(tid,PlayerInfo[tid][Cash]);
OfferPrice[playerid] = -1;
MechanicID[playerid] = -1;
RepairOffer[playerid] = 0;
}else{
SCM(playerid,COLOR_GREY,"You must enter mechanic's id, who offered you to repair vehicle.");
}
}else{
SCM(playerid,COLOR_GREY,"You have no offered vehicle repair!");
}
}
return 1;
}
Re: accept command -
thaKing - 19.01.2015
Okey, thanks.