give gun to a player
#2

PHP код:
new Requested[MAX_PLAYER]; //EDIT
CMD:spray(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < || PlayerInfo[playerid][pFaction] != 5
        return 
SCM(playeridCOLOR_LIGHTRED"Nu esti mechanic.");
    if(
IsPlayerInRangeOfPoint(playerid20.02180.9875,-1979.7583,13.5606)) //Optional - CHANGE
    
{
        new 
string[128], sendername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], pID;
         
GetPlayerName(playeridsendernamesizeof(sendername));
        
//GetPlayerName(pID, targetname, sizeof(targetname)); //EDIT
        
if(sscanf(params"uii"pIDpickcolor)) 
        return 
SendClientMessage(playerid, -1"[FOLOSIRE] /spray [ID/Name][Culoare 1/2][culoare]");
        if(
pID == INVALID_PLAYER_ID || !IsPlayerConnected(pID))
            return 
SendClientMessage(playeridCOLOR_RED"Invalid PlayerID/PlayerName.");
        if(
pick || pick 1
            return 
SendClientMessage(playeridCOLOR_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(playeridCOLOR_RED,"Color ID can't be lower than 0 and higher than 255.");
        
GetPlayerName(pIDtargetnamesizeof(targetname)); //EDIT
        
vehid GetPlayerVehicleID(pID);
        
format(stringsizeof(string), "%s vrea sa-ti vopseasca vehiculul. Slot Culoare: {FFFFFF}%d{468CFF}, ID Culoare: {FFFFFF}%d"PlayerName(playerid), pickcolor);
        
SendClientMessage(pIDCOLOR_LIGHTBLUEstring);
        
SendClientMessage(pIDCOLOR_LIGHTBLUE"Foloseste /acceptmeh pentru a accepta.");
        
Service[pID][0] = 1;
        
//Suggestion
        
Requested[pID] = playerid//EDIT
    
}
    else 
        return 
SendClientMessage(playeridCOLOR_RED"Trebuie sa fii in garaj pentru a repara!");
    return 
1;
}
CMD:acceptmeh(playeridparams[])
{
    new 
FloatXFloatYFloatZpID;
    
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(vehidXYZ);
        
Car[1] = X;
        
Car[2] = Y;
        
Car[3] = Z;
        
Spray[pID] = 1;
        
GivePlayerWeapon(pID41500);
    }
    else if(
Service[playerid][1] == 1)
    {
        new 
panels,doors,lights,tires;
           
SendClientMessage(playeridCOLOR_LIGHTBLUE"Ai acceptat serviciul, te rugam asteapta!");
        
vehid GetPlayerVehicleID(playerid);
        
tires encode_tires(0000); // fix all tires
        
panels encode_panels(0000000); // fix all panels
        
doors encode_doors(000000); // fix all doors
        
lights encode_lights(0000); // fix all lights
        
UpdateVehicleDamageStatus(vehidpanelsdoorslightstires);
        
Service[playerid][1] = 0;
        
SendClientMessage(playeridCOLOR_GREEN"Caroseria vehiculului a fost reparata!");
    }
    else if(
Service[playerid][2] == 1)
    {
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"Ai acceptat serviciul, te rugam asteapta!");
        
vehid GetPlayerVehicleID(playerid);
        
SetVehicleHealth(vehid1000.0);
        
Service[playerid][2] = 0;
        
SendClientMessage(playeridCOLOR_GREEN"Motorul vehiculului a fost reparat!");
    }
    else return 
SendClientMessage(playeridCOLOR_RED"Nu ti-a oferit nimeni sa-ti repare masina!");
    return 
1;
}
forward OnPlayerSpray(playerid);
public 
OnPlayerSpray(playerid)
{
    if(
pick == 1)
    {
        
ChangeVehicleColor(vehidcolor0);
        
VehicleColor[playerid][0] = color;
    }
    else
    {   
//new pID;
        //new color2 = strval(inputtext);
        
ChangeVehicleColor(vehid0color);
        
VehicleColor[playerid][1] = color;
        
KillTimer(SprayT);
        
Spray[playerid] = 0;
        
Service[playerid][0] = 0;
        
SaveVehicle(playerid);
        
SendClientMessage(playeridCOLOR_GREEN"Ai vopsit masina cu succes!");
    }
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
newkeys KEY_FIRE)
    {
        if(
IsPlayerInRangeOfPoint(playerid3.0Car[1], Car[2], Car[3]))
        {
            if(
Spray[playerid] == 1)
            {
                
SprayT SetTimer("OnPlayerSpray"5000false);
            }
        }
    }
    else return 
KillTimer(SprayT);
    return 
1;

Reply


Messages In This Thread
give gun to a player - by AndreiWow - 21.12.2015, 10:44
Re: give gun to a player - by Mic_H - 21.12.2015, 12:56
Re: give gun to a player - by AndreiWow - 21.12.2015, 19:10

Forum Jump:


Users browsing this thread: 1 Guest(s)