CMD:spray(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 2 || PlayerInfo[playerid][pFaction] != 5) return SCM(playerid, COLOR_LIGHTRED, "Nu esti mechanic."); if(IsPlayerInRangeOfPoint(playerid, 20.0, 2180.9875,-1979.7583,13.5606)) //Optional - CHANGE { new string[128], sendername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], pID; GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(pID, targetname, sizeof(targetname)); if(sscanf(params, "uii", pID, pick, color)) return SendClientMessage(playerid, -1, "[FOLOSIRE] /spray [ID/Name][Culoare 1/2][culoare]"); if(pick > 2 || pick < 1) return SendClientMessage(playerid, COLOR_RED,"Colorpick can't be lower than 1 and higher than 2."); if(color > 126 || color < 0) return SendClientMessage(playerid, COLOR_RED,"Color ID can't be lower than 0 and higher than 126."); vehid = GetPlayerVehicleID(pID); format(string, sizeof(string), "%s vrea sa-ti vopseasca vehiculul. Slot Culoare: {FFFFFF}%d{468CFF}, ID Culoare: {FFFFFF}%d", PlayerName(playerid), pick, color); SendClientMessage(pID, COLOR_LIGHTBLUE, string); SendClientMessage(pID, COLOR_LIGHTBLUE, "Foloseste /acceptmeh pentru a accepta."); Service[pID][0] = 1; } else return SendClientMessage(playerid, COLOR_RED, "Trebuie sa fii in garaj pentru a repara!"); return 1; }
CMD:acceptmeh(playerid, params[]) { new Float: X, Float: Y, Float: Z, pID; if(Service[playerid][0] == 1) { SendClientMessage(playerid, -1, "Ai acceptat serviciul, te rugam asteapta!"); GetVehiclePos(vehid, X, Y, Z); Car[1] = X; Car[2] = Y; Car[3] = Z; Spray[pID] = 1; GivePlayerWeapon(pID, 41, 500); } else if(Service[playerid][1] == 1) { new panels,doors,lights,tires; SendClientMessage(playerid, COLOR_LIGHTBLUE, "Ai acceptat serviciul, te rugam asteapta!"); vehid = GetPlayerVehicleID(playerid); tires = encode_tires(0, 0, 0, 0); // fix all tires panels = encode_panels(0, 0, 0, 0, 0, 0, 0); // fix all panels doors = encode_doors(0, 0, 0, 0, 0, 0); // fix all doors lights = encode_lights(0, 0, 0, 0); // fix all lights UpdateVehicleDamageStatus(vehid, panels, doors, lights, tires); Service[playerid][1] = 0; SendClientMessage(playerid, COLOR_GREEN, "Caroseria vehiculului a fost reparata!"); } else if(Service[playerid][2] == 1) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "Ai acceptat serviciul, te rugam asteapta!"); vehid = GetPlayerVehicleID(playerid); SetVehicleHealth(vehid, 1000.0); Service[playerid][2] = 0; SendClientMessage(playerid, COLOR_GREEN, "Motorul vehiculului a fost reparat!"); } else return SendClientMessage(playerid, COLOR_RED, "Nu ti-a oferit nimeni sa-ti repare masina!"); return 1; }
forward OnPlayerSpray(playerid); public OnPlayerSpray(playerid) { if(pick == 1) { ChangeVehicleColor(vehid, color, 0); VehicleColor[playerid][0] = color; } else { //new pID; //new color2 = strval(inputtext); ChangeVehicleColor(vehid, 0, color); VehicleColor[playerid][1] = color; KillTimer(SprayT); Spray[playerid] = 0; Service[playerid][0] = 0; SaveVehicle(playerid); SendClientMessage(playerid, COLOR_GREEN, "Ai vopsit masina cu succes!"); } return 1; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_FIRE) { if(IsPlayerInRangeOfPoint(playerid, 3.0, Car[1], Car[2], Car[3])) { if(Spray[playerid] == 1) { SprayT = SetTimer("OnPlayerSpray", 5000, false); } } } else return KillTimer(SprayT); return 1; }
new Requested[MAX_PLAYER]; //EDIT
CMD:spray(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2 || PlayerInfo[playerid][pFaction] != 5)
return SCM(playerid, COLOR_LIGHTRED, "Nu esti mechanic.");
if(IsPlayerInRangeOfPoint(playerid, 20.0, 2180.9875,-1979.7583,13.5606)) //Optional - CHANGE
{
new string[128], sendername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], pID;
GetPlayerName(playerid, sendername, sizeof(sendername));
//GetPlayerName(pID, targetname, sizeof(targetname)); //EDIT
if(sscanf(params, "uii", pID, pick, color))
return SendClientMessage(playerid, -1, "[FOLOSIRE] /spray [ID/Name][Culoare 1/2][culoare]");
if(pID == INVALID_PLAYER_ID || !IsPlayerConnected(pID))
return SendClientMessage(playerid, COLOR_RED, "Invalid PlayerID/PlayerName.");
if(pick > 2 || pick < 1)
return SendClientMessage(playerid, COLOR_RED,"Colorpick can't be lower than 1 and higher than 2.");
if(color > 255 || color < 0) //Refer: https://sampwiki.blast.hk/wiki/Vehicle_Color_IDs 0 - 255 COlors EDIT
return SendClientMessage(playerid, COLOR_RED,"Color ID can't be lower than 0 and higher than 255.");
GetPlayerName(pID, targetname, sizeof(targetname)); //EDIT
vehid = GetPlayerVehicleID(pID);
format(string, sizeof(string), "%s vrea sa-ti vopseasca vehiculul. Slot Culoare: {FFFFFF}%d{468CFF}, ID Culoare: {FFFFFF}%d", PlayerName(playerid), pick, color);
SendClientMessage(pID, COLOR_LIGHTBLUE, string);
SendClientMessage(pID, COLOR_LIGHTBLUE, "Foloseste /acceptmeh pentru a accepta.");
Service[pID][0] = 1;
//Suggestion
Requested[pID] = playerid; //EDIT
}
else
return SendClientMessage(playerid, COLOR_RED, "Trebuie sa fii in garaj pentru a repara!");
return 1;
}
CMD:acceptmeh(playerid, params[])
{
new Float: X, Float: Y, Float: Z, pID;
pID = Requested[playerid]; // You were not assigning pID to anything.. So pID was always 0..
if(Service[playerid][0] == 1)
{
SendClientMessage(playerid, -1, "Ai acceptat serviciul, te rugam asteapta!");
GetVehiclePos(vehid, X, Y, Z);
Car[1] = X;
Car[2] = Y;
Car[3] = Z;
Spray[pID] = 1;
GivePlayerWeapon(pID, 41, 500);
}
else if(Service[playerid][1] == 1)
{
new panels,doors,lights,tires;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Ai acceptat serviciul, te rugam asteapta!");
vehid = GetPlayerVehicleID(playerid);
tires = encode_tires(0, 0, 0, 0); // fix all tires
panels = encode_panels(0, 0, 0, 0, 0, 0, 0); // fix all panels
doors = encode_doors(0, 0, 0, 0, 0, 0); // fix all doors
lights = encode_lights(0, 0, 0, 0); // fix all lights
UpdateVehicleDamageStatus(vehid, panels, doors, lights, tires);
Service[playerid][1] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Caroseria vehiculului a fost reparata!");
}
else if(Service[playerid][2] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Ai acceptat serviciul, te rugam asteapta!");
vehid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehid, 1000.0);
Service[playerid][2] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Motorul vehiculului a fost reparat!");
}
else return SendClientMessage(playerid, COLOR_RED, "Nu ti-a oferit nimeni sa-ti repare masina!");
return 1;
}
forward OnPlayerSpray(playerid);
public OnPlayerSpray(playerid)
{
if(pick == 1)
{
ChangeVehicleColor(vehid, color, 0);
VehicleColor[playerid][0] = color;
}
else
{ //new pID;
//new color2 = strval(inputtext);
ChangeVehicleColor(vehid, 0, color);
VehicleColor[playerid][1] = color;
KillTimer(SprayT);
Spray[playerid] = 0;
Service[playerid][0] = 0;
SaveVehicle(playerid);
SendClientMessage(playerid, COLOR_GREEN, "Ai vopsit masina cu succes!");
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, Car[1], Car[2], Car[3]))
{
if(Spray[playerid] == 1)
{
SprayT = SetTimer("OnPlayerSpray", 5000, false);
}
}
}
else return KillTimer(SprayT);
return 1;
}