Limit a player to a certain amount of characters when using a command[+REP]
#1

Hey guys,
I got a car system on which is handled via the /car command. It has a variety of options, however, when a player types in something very long after the word /car instead of an actual parameter, the server crashes and gets restarted.

Here's the begining of the CMD, would love it if someone could help me.
PHP код:
    new tmp15 ], tmp215 ], tmp3128 ];
    if(
sscanf(params"szz"tmptmp2tmp3)) return SCP(playerid"[ buy / sell / unsell / park / lock / help / tow / find / respray / savemod / unmod / dupekey / takekey / factionize / scrap / paintjob / nitro / plate / control ]"); 
Basically I want to limit a player to 10 characters in this certain command. In other words, if the player uses the command and types in something that is longer than 10 characters, it'll return a string and do nothing but the string.
When I tried it, it didn't work so.. >:

+REPing the helper
Reply
#2

Код:
if (strlen(params) > 10)
{
    // return your string
    return 1;
}
Reply
#3

Код:
if(sscanf(params, "s[15]S[15]S[128]", tmp, tmp2, tmp3))
Also z is depreciated so just use a capital S for optional strings.

EDIT: Whoops I think I may of read the post wrong also, but my point of using S for optional still stands at least
Reply
#4

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
Код:
if (strlen(params) > 10)
{
    // return your string
    return 1;
}
tried that, didnt work.
Trying the S[10] thing..
BRB.
Reply
#5

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
Код:
if (strlen(params) > 10)
{
    // return your string
    return 1;
}
Quote:
Originally Posted by Burridge
Посмотреть сообщение
Код:
if(sscanf(params, "s[15]S[15]S[128]", tmp, tmp2, tmp3))
Also z is depreciated so just use a capital S for optional strings.

EDIT: Whoops I think I may of read the post wrong also, but my point of using S for optional still stands at least
both don't work >:
Reply
#6

Well mine should work regardless, it's your code logic, nothing else. Show us the code and we'll spot the mistake right away!
Reply
#7

זזזזזזזזזזזזזזזזזז
Reply
#8

I only did the first few, I don't get paid enough to do the full 300+ lines.
pawn Код:
COMMAND:car(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientError(playerid, "You are not in any vehicle!");
    if(!strlen(params))
        return SCP(playerid, "[ buy / sell / unsell / park / lock / help / tow / find / respray / savemod / unmod / dupekey / takekey / factionize / scrap / paintjob / nitro / plate / control ]");

    new tmp2, tmp3;
    if(!sscanf(params, "'respray'ii", tmp2, tmp3))
    {
        if(PlayerTemp[playerid][sm] < dini_Int("Pay_N_Spray.txt", "entrance"))
            return SendClientError(playerid, "Not enough money!");
           
        new vid = GetPlayerVehicleID(playerid);
        if(strlen(Vehicles[vid][carowner] && strcmp(PlayerName(playerid), Vehicles[vid][carowner], false))
            return SendClientError(playerid, "You do not own this vehicle!");

        new bizz = IsPlayerOutBiz(playerid);
        if(bizz != -1 && biz[bizz][biztype] == 11)
        {
            if(!(0 <= tmp2 <= 255 && 0 <= tmp3 <= 255))
                return SendClientWarning(playerid, "Invalid colour ID!");
            dini_IntSet(CarFile(vid), "color1", tmp2);
            dini_IntSet(CarFile(vid), "color2", tmp3);
            ChangeVehicleColor(vid, tmp2, tmp3);
            Vehicles[vid][color1] = tmp2;
            Vehicles[vid][color2] = tmp3;
            GameTextForPlayer(playerid, "~g~resprayed", 3000, 1);
            GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
            dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
            dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
            //GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
            //dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
            //dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
            format(iStr, sizeof(iStr), "6[VEHICLE] %s has resprayed their %s to %d and %d for $%d.", PlayerName(playerid), GetVehicleName(vid), tmp2, tmp3, dini_Int("Pay_N_Spray.txt", "entrance"));
            iEcho(iStr);
        }
        // else...?
        return 1;
    }
    else if(!strcmp(params, "neon", true))
    {
        if(PlayerTemp[playerid][sm] < dini_Int("Car_Neon.txt", "entrance"))
            return SendClientError(playerid, "Not enough money!");

        new bizz = IsPlayerOutBiz(playerid);
        if(bizz != -1 && biz[bizz][biztype] == 25)
        {
            GivePlayerMoneyEx(playerid, -dini_Int("Car_Neon.txt", "entrance"));
            dini_IntSet("Car_Neon.txt", "bizcash", dini_Int("Car_Neon.txt", "bizcash") + dini_Int("Car_Neon.txt", "entrance"));
            dini_IntSet("Car_Neon.txt", "cmps", dini_Int("Car_Neon.txt", "comps") - 2);
            format(iStr, sizeof(iStr), "6[VEHICLE] %s has instaled neon on their %s for $%d.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), dini_Int("Car_Neon.txt", "entrance"));
            iEcho(iStr);
            ShowPlayerDialog(playerid, 52, DIALOG_STYLE_LIST, "{FFFF00} Car Neon", "DarkBlue\nRed\nGreen\nWhite\nViolet\nYellow\nCyan\nLightBlue\nPink\nOrange\nLightGreen\nLightYellow\nDelete Neon", "Select", "Cancel");
        }
        return 1;
    }
    else if(!strcmp(params, "control", true))
    {
        ShowPlayerDialog(playerid, 50, DIALOG_STYLE_LIST, "{FFFF00} Car Control", "Lighting   [ On / Off ]\nBonnect   [ Open / Close ]\nBoot/Trunk   [ Open / Close ]", "Select", "Cancel");
        return 1;
    }
    else if(!strcmp(params, "plate", true))
    {
        if(PlayerInfo[playerid][premium])
            return SendClientError(playerid, CANT_USE_CMD);
        ShowPlayerDialog(playerid, 45, DIALOG_STYLE_INPUT,"{FFFF00} Plate Registration", "{ea150a}What should the {17a005}plate {ffffff}be?", "{ffffff}Set", " ");
        return 1;
    }
// etc.
If you continue with that format, you'll eventually get to a command where you're not relying on so many variables and string comparisons.

If the parameter requires additional parameters (i.e. "respray" or "paintjob" etc.), then use sscanf lines. If you don't require any more than 1 parameter, use strcmp.
Reply
#9

Quote:
Originally Posted by Threshold
Посмотреть сообщение
I only did the first few, I don't get paid enough to do the full 300+ lines.
pawn Код:
COMMAND:car(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientError(playerid, "You are not in any vehicle!");
    if(!strlen(params))
        return SCP(playerid, "[ buy / sell / unsell / park / lock / help / tow / find / respray / savemod / unmod / dupekey / takekey / factionize / scrap / paintjob / nitro / plate / control ]");

    new tmp2, tmp3;
    if(!sscanf(params, "'respray'ii", tmp2, tmp3))
    {
        if(PlayerTemp[playerid][sm] < dini_Int("Pay_N_Spray.txt", "entrance"))
            return SendClientError(playerid, "Not enough money!");
           
        new vid = GetPlayerVehicleID(playerid);
        if(strlen(Vehicles[vid][carowner] && strcmp(PlayerName(playerid), Vehicles[vid][carowner], false))
            return SendClientError(playerid, "You do not own this vehicle!");

        new bizz = IsPlayerOutBiz(playerid);
        if(bizz != -1 && biz[bizz][biztype] == 11)
        {
            if(!(0 <= tmp2 <= 255 && 0 <= tmp3 <= 255))
                return SendClientWarning(playerid, "Invalid colour ID!");
            dini_IntSet(CarFile(vid), "color1", tmp2);
            dini_IntSet(CarFile(vid), "color2", tmp3);
            ChangeVehicleColor(vid, tmp2, tmp3);
            Vehicles[vid][color1] = tmp2;
            Vehicles[vid][color2] = tmp3;
            GameTextForPlayer(playerid, "~g~resprayed", 3000, 1);
            GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
            dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
            dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
            //GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
            //dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
            //dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
            format(iStr, sizeof(iStr), "6[VEHICLE] %s has resprayed their %s to %d and %d for $%d.", PlayerName(playerid), GetVehicleName(vid), tmp2, tmp3, dini_Int("Pay_N_Spray.txt", "entrance"));
            iEcho(iStr);
        }
        // else...?
        return 1;
    }
    else if(!strcmp(params, "neon", true))
    {
        if(PlayerTemp[playerid][sm] < dini_Int("Car_Neon.txt", "entrance"))
            return SendClientError(playerid, "Not enough money!");

        new bizz = IsPlayerOutBiz(playerid);
        if(bizz != -1 && biz[bizz][biztype] == 25)
        {
            GivePlayerMoneyEx(playerid, -dini_Int("Car_Neon.txt", "entrance"));
            dini_IntSet("Car_Neon.txt", "bizcash", dini_Int("Car_Neon.txt", "bizcash") + dini_Int("Car_Neon.txt", "entrance"));
            dini_IntSet("Car_Neon.txt", "cmps", dini_Int("Car_Neon.txt", "comps") - 2);
            format(iStr, sizeof(iStr), "6[VEHICLE] %s has instaled neon on their %s for $%d.", PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), dini_Int("Car_Neon.txt", "entrance"));
            iEcho(iStr);
            ShowPlayerDialog(playerid, 52, DIALOG_STYLE_LIST, "{FFFF00} Car Neon", "DarkBlue\nRed\nGreen\nWhite\nViolet\nYellow\nCyan\nLightBlue\nPink\nOrange\nLightGreen\nLightYellow\nDelete Neon", "Select", "Cancel");
        }
        return 1;
    }
    else if(!strcmp(params, "control", true))
    {
        ShowPlayerDialog(playerid, 50, DIALOG_STYLE_LIST, "{FFFF00} Car Control", "Lighting   [ On / Off ]\nBonnect   [ Open / Close ]\nBoot/Trunk   [ Open / Close ]", "Select", "Cancel");
        return 1;
    }
    else if(!strcmp(params, "plate", true))
    {
        if(PlayerInfo[playerid][premium])
            return SendClientError(playerid, CANT_USE_CMD);
        ShowPlayerDialog(playerid, 45, DIALOG_STYLE_INPUT,"{FFFF00} Plate Registration", "{ea150a}What should the {17a005}plate {ffffff}be?", "{ffffff}Set", " ");
        return 1;
    }
// etc.
If you continue with that format, you'll eventually get to a command where you're not relying on so many variables and string comparisons.

If the parameter requires additional parameters (i.e. "respray" or "paintjob" etc.), then use sscanf lines. If you don't require any more than 1 parameter, use strcmp.

basically if I change the sscanf and strcmp(Where I need to ofc) it won't crash after ppl input a lot of text?
Reply
#10

Quote:
Originally Posted by Threshold
Посмотреть сообщение
..

Hmm, that's the new command, however the /car sell , /car respray and /car find are bugged.
They don't seem to work and return the syntax. I assume it's because I'm trying to convert the string (tmp2,tmp3) to an int ? I couldn't find a way to fix it without fucking up the rest of the system so I'd love it if someone who could lead me to the solution <:

PHP код:
COMMAND:car(playeridparams[])
{
    if(!
strlen(params)) return SCP(playerid"[ buy / sell / unsell / park / lock / help / tow / find / respray / savemod / unmod / dupekey / takekey / factionize / scrap / paintjob / nitro / plate / control ]");
    new 
tmp2[MAX_STRING], tmp3[MAX_STRING];
 if(!
sscanf(params"respray"tmp2tmp3))
{
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(
PlayerTemp[playerid][sm] < dini_Int("Pay_N_Spray.txt""entrance"))
            return 
SendClientError(playerid"Not enough money!");
        new 
bizz IsPlayerOutBiz(playerid);
        if(
bizz != -&& biz[bizz][biztype] == 11)
        {
            if(!
strlen(tmp2) || !IsNumeric(tmp2) || !strlen(tmp3) || !IsNumeric(tmp3)) return SCP(playerid"respray [ colour1 ] [ colour2 ]");
            if(
strlen(tmp2) > || strlen(tmp3) > 5) return SendClientWarning(playerid"Invalid colour ID!");
            new 
c1 strval(tmp2);
            new 
c2 strval(tmp3);
            if(
c1 || c2 0) return SendClientWarning(playerid"Invalid colour ID!");
            
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "color1"c1);
            
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "color2"c2);
            
ChangeVehicleColor(GetPlayerVehicleID(playerid), c1c2);
            
Vehicles[GetPlayerVehicleID(playerid)][color1] = c1;
            
Vehicles[GetPlayerVehicleID(playerid)][color2] = c2;
            
GameTextForPlayer(playerid"~g~resprayed"3000,1);
            
GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt""entrance"));
            
dini_IntSet("Pay_N_Spray.txt""bizcash"dini_Int("Pay_N_Spray.txt""bizcash") + dini_Int("Pay_N_Spray.txt""entrance"));
            
dini_IntSet("Pay_N_Spray.txt""comps"dini_Int("Pay_N_Spray.txt""comps") - 2);
            
//GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt", "entrance"));
            //dini_IntSet("Pay_N_Spray.txt", "bizcash", dini_Int("Pay_N_Spray.txt", "bizcash") + dini_Int("Pay_N_Spray.txt", "entrance"));
            //dini_IntSet("Pay_N_Spray.txt", "comps", dini_Int("Pay_N_Spray.txt", "comps") - 2);
            
format(iStrsizeof(iStr), "6[VEHICLE] %s has resprayed their %s to %d and %d for $%d."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), c1c2dini_Int("Pay_N_Spray.txt""entrance"));
            
iEcho(iStr);
            return 
1;
        }
    }
  else  if(!
strcmp(params,"neon",true4))
    {
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        if(
PlayerTemp[playerid][sm] < dini_Int("Car_Neon.txt""entrance"))
            return 
SendClientError(playerid"Not enough money!");
        new 
bizz IsPlayerOutBiz(playerid);
        if(
bizz != -&& biz[bizz][biztype] == 25)
        {
            
GivePlayerMoneyEx(playerid, -dini_Int("Car_Neon.txt""entrance"));
            
dini_IntSet("Car_Neon.txt""bizcash"dini_Int("Car_Neon.txt""bizcash") + dini_Int("Car_Neon.txt""entrance"));
            
dini_IntSet("Car_Neon.txt""cmps"dini_Int("Car_Neon.txt""comps") - 2);
            
format(iStrsizeof(iStr), "6[VEHICLE] %s has instaled neon on their %s for $%d."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), dini_Int("Car_Neon.txt""entrance"));
            
iEcho(iStr);
            
ShowPlayerDialog(playerid52DIALOG_STYLE_LIST"{FFFF00} Car Neon""DarkBlue\nRed\nGreen\nWhite\nViolet\nYellow\nCyan\nLightBlue\nPink\nOrange\nLightGreen\nLightYellow\nDelete Neon""Select""Cancel");
            return 
1;
        }
    }
  else  if(!
strcmp(params,"control",true7))
    {
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        
ShowPlayerDialog(playerid50DIALOG_STYLE_LIST"{FFFF00} Car Control""Lighting   [ On / Off ]\nBonnect   [ Open / Close ]\nBoot/Trunk   [ Open / Close ]""Select""Cancel");
        return 
1;
    }
  else  if(!
strcmp(params"plate"true5))
    {
        if(
PlayerInfo[playerid][premium]) return SendClientError(playeridCANT_USE_CMD);
        if(!
IsPlayerInAnyVehicle(playerid)) return 1;
        
ShowPlayerDialog(playerid45DIALOG_STYLE_INPUT,"{FFFF00} Plate Registration""{ea150a}What should the {17a005}plate {ffffff}be?""{ffffff}Set"" ");
        return 
1;
    }
   else if(!
strcmp(params,"nitro"true5))
    {
        new 
bizz IsPlayerOutBiz(playerid);
        if(
bizz != -&& biz[bizz][biztype] == 23)
        {
            if(!
IsValidNOSVehicle(GetPlayerVehicleID(playerid))) return SendClientError(playerid"This vehicle cannot have nitro!");
            if(!
IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
            if(
HandMoney(playerid) < 250000) return SendClientError(playerid"You don't have $250.000 to buy infinite nitro!");
            
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "nitro"1);
            
Vehicles[GetPlayerVehicleID(playerid)][nitro] = 1;
            
GameTextForPlayer(playerid"~g~installed"3000,1);
            
GivePlayerMoneyEx(playerid, -250000);
            
dini_IntSet("Nitro_Garage.txt""bizcash"dini_Int("Nitro_Garage.txt""bizcash") + 75000);
            
dini_IntSet("Nitro_Garage.txt""comps"dini_Int("Nitro_Garage.txt""comps") - 5);
            
format(iStrsizeof(iStr), "6[VEHICLE] %s has bought infinite nitro for their %s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
            
iEcho(iStr);
            return 
1;
        }
        else
        {
            
SendClientError(playerid"You are not at the Nitro Garage!");
            
//SetPlayerCheckpoint(playerid,-1922.470336,285.820037,41.046875, 3.0);
            
return 1;
        }
    }
   else  if(!
strcmp(params,"wheels"true6))
    {
        new 
bizz IsPlayerOutBiz(playerid);
        if(
bizz != -&& biz[bizz][biztype] == 24)
        {
            if(!
IsValidNOSVehicle(GetPlayerVehicleID(playerid))) return SendClientError(playerid"This vehicle cannot have modified wheels!");
            if(!
IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
            if(
PlayerTemp[playerid][sm] < dini_Int("Wheel_Mod_Shop.txt""entrance")) return SendClientError(playerid"Not enough money!");
            
dini_IntSet("Wheel_Mod_Shop.txt""bizcash"dini_Int("Wheel_Mod_Shop.txt""bizcash") + dini_Int("Wheel_Mod_Shop.txt""entrance"));
            
dini_IntSet("Wheel_Mod_Shop.txt""comps"dini_Int("Wheel_Mod_Shop.txt""comps") - 1);
            
format(iStrsizeof(iStr), "6[VEHICLE] %s is chosing wheels for their %s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
            
iEcho(iStr);
            new 
iStrr512 ], tmpzz24 ];
            for(new 
isizeof(CarWheels); i++)
            {
                
format(tmpzz24"%s\n"CarWheels[i][whName]);
                
strcat(iStrrtmpzz);
            }
            
ShowPlayerDialog(playerid42DIALOG_STYLE_LIST"Wheel Mods"iStrr"Preview""Cancel");
            return 
1;
        }
        else
        {
            
SendClientError(playerid"You are not at the Wheel Mod Shop!");
            
//SetPlayerCheckpoint(playerid,-2730.668457,74.234832,4.335937, 3.0);
            
return 1;
        }
    }
    else if(!
sscanf(params"paintjob"tmp2))
    {
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(
PlayerTemp[playerid][sm] < dini_Int("Pay_N_Spray.txt""entrance"))
            return 
SendClientError(playerid"Not enough money!");
        new 
bizz IsPlayerOutBiz(playerid);
        if(
bizz != -&& biz[bizz][biztype] == 11)
        {
            new 
mid GetVehicleModel(GetPlayerVehicleID(playerid));
            if(
mid != 483 && mid != 534 && mid != 535 && mid != 567 && mid != 536 && mid != 558 && mid != 559 && mid != 560 && mid != 558 && mid != 562 && mid != 561 && mid != 565 && mid != 576)
                return 
SendClientError(playerid"You can't change the paintjob on this model!");
            if(!
strlen(tmp2) || !IsNumeric(tmp2)) return SCP(playerid"paintjob [ paintjobID ]");
            if(
strlen(tmp2) > 5) return SendClientWarning(playerid"Invalid paintjob ID!");
            new 
c1 strval(tmp2);
            if(
c1 < -|| c1 2) return SendClientWarning(playerid"Invalid paintjob ID!");
            
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "paintjob"c1);
            
Vehicles[GetPlayerVehicleID(playerid)][paintjob] = c1;
            
ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), c1);
            
GivePlayerMoneyEx(playerid, -dini_Int("Pay_N_Spray.txt""entrance"));
            
dini_IntSet("Pay_N_Spray.txt""bizcash"dini_Int("Pay_N_Spray.txt""bizcash") + dini_Int("Pay_N_Spray.txt""entrance"));
            
dini_IntSet("Pay_N_Spray.txt""comps"dini_Int("Pay_N_Spray.txt""comps") - 2);
            
format(iStrsizeof(iStr), "6[VEHICLE] %s has paintjobbed their %s to %d for $%d."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), c1,  dini_Int("Pay_N_Spray.txt""entrance"));
            
iEcho(iStr);
            return 
1;
        }
        else
        {
            
SendClientError(playerid"You are not at the Pay N Spray Shop!");
            
//SetPlayerCheckpoint(playerid,-2730.668457,74.234832,4.335937, 3.0);
            
return 1;
        }
    }
    else if(!
sscanf(params"dupekey"tmp2))
    {
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(!
strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid"dupekey [ PLAYERID ]");
        new 
giveplayerid strval(tmp2);
        if(!
IsPlayerConnected(giveplayerid)) return SendClientError(playerid"Player not found!");
        if(
GetDistanceBetweenPlayers(playeridgiveplayerid) > 10)
            return 
SendClientError(playerid"He is too far away!");
        
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "dupekey"PlayerName(giveplayerid));
        
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][dupekey], PlayerName(giveplayerid));
        
format(iStrsizeof(iStr),"has given the keys of their %s to %s."GetVehicleName(GetPlayerVehicleID(playerid)), MaskedName(giveplayerid));
           
Action(playeridiStr);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has given their %s dupe-key to %s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), PlayerName(giveplayerid));
        
iEcho(iStr);
    }
    else if(!
strcmp(params"takekey"true7))
    {
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "dupekey""NoBodY");
        
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][dupekey], "NoBodY");
        
SendClientMessage(playeridCOLOR_LIGHTGREY,"Info: The key has been taken away!");
    }
   else  if(!
strcmp(params"factionize"true10))
    {
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(
PlayerInfo[playerid][playerteam] == CIV)
            return 
SendClientError(playerid"You are not in a faction!");
        if(
FactionCarCount(PlayerInfo[playerid][playerteam]) >=  FactionCarMax(playerid))
                return 
SendClientError(playerid"Your faction has reached the limit of factioncars!");
        
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "dupekey""NoBodY");
        
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][dupekey], "NoBodY");
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "carteam"PlayerInfo[playerid][playerteam]);
        
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "owner""NoBodY");
        
SendClientInfo(playerid"Success: The vehicle is now bound to the faction.");
        
Vehicles[GetPlayerVehicleID(playerid)][carteam] = PlayerInfo[playerid][playerteam];
        
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][carowner], "NoBodY");
        
UnlockVehicle(GetPlayerVehicleID(playerid));
        
SendClientInfo(playerid"Your vehicle has been factionized! You will not ever receive a refund for it.");
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has factionized their %s to %s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), PlayerInfo[playerid][PTeamName]);
        
iEcho(iStr);
        
format(iStrsizeof(iStr), "## [%s] %s %s has just factionized a %s"PlayerInfo[playerid][PTeamName], PlayerInfo[playerid][rankname], RPName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
        
SendClientMessageToTeam(PlayerInfo[playerid][playerteam], iStrCOLOR_PLAYER_VLIGHTBLUE);
    }
    else if(!
sscanf(params"sell"tmp2))
    {
        if(!
IsPlayerInAnyVehicle(playerid))
            return 
SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(!
strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 9) return SCP(playerid"sell [amount]");
        new 
themodel strval(tmp2);
        if(
themodel || themodel 50000000) return SendClientWarning(playerid"Invalid amount!");
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "price"themodel);
        
format(iStrsizeof(iStr), "~r~sale: ~w~$%d"themodel);
        
GameTextForPlayer(playeridiStr3000,1);
        
Vehicles[GetPlayerVehicleID(playerid)][carprice] = themodel;
        
SendClientMessage(playeridCOLOR_LIGHTGREY,"Info: Your vehicle is now on sale. Other people are able to buy it!");
        
TogglePlayerControllable(playeridtrue);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has put their %s on sale for $%d."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), themodel);
        
iEcho(iStr);
    }
    else if(!
strcmp(params"tow"true3))
    {
        if(!
strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid"tow [vehicleID (/myvehicles)]");
        new 
themodel strval(tmp2);
        if(
themodel || themodel sizeof(Vehicles)) return SendClientError(playerid"Invalid vehicle ID!");
        if(
strcmp(PlayerName(playerid),Vehicles[themodel][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(
IsVehicleOccupied(themodel))
            return 
SendClientError(playerid"The vehicle is currently occupied!");
        new 
iPrice;
        if(
PlayerInfo[playerid][playerlvl] < 15iPrice 0;
        else 
iPrice 150;
        if(
HandMoney(playerid) < iPrice) return SendClientError(playerid"You don't have enough money!");
        
ReloadVehicle(themodel);
        
SendClientMessage(playeridCOLOR_LIGHTGREY,"Info: Your vehicle has been towed!");
        if(
iPriceGameTextForPlayer(playerid"~r~$-150"3000,1);
        
GivePlayerMoneyEx(playerid, -iPrice);
        
dini_IntSet("Gov_Land_Company.txt""bizcash"dini_Int("Gov_Land_Company.txt""bizcash") + 150);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has towed their %s."PlayerName(playerid), GetVehicleName(themodel));
        
iEcho(iStr);
    }
/*
    else if(!strcmp(tmp, "call", true, 4))
    {
        if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid, "call [vehicleID (/myvehicles)]");
        new themodel = strval(tmp2);
        if(themodel < 0 || themodel > sizeof(Vehicles)) return SendClientError(playerid, "Invalid vehicle ID!");
        if(strcmp(PlayerName(playerid),Vehicles[themodel][carowner],false))
            return SendClientError(playerid, "You do not own this vehicle!");
        if(IsVehicleOccupied(themodel))
            return SendClientError(playerid, "The vehicle is currently occupied!");
        if(GetPlayerInterior(playerid) || GetPlayerVirtualWorld(playerid))
            return SendClientError(playerid, "You cannot call your vehicle while in an interior.");
        SendClientMessage(playerid, COLOR_LIGHTGREY,"Info: Your vehicle should arrive in 10 to 20 seconds.");
        GameTextForPlayer(playerid, "~r~$-100", 3000,1);
        GivePlayerMoneyEx(playerid, -100);
        new loltime = minrand(10,20);
        SetTimerEx("VehicleToPlayer", loltime*1000, false, "ddd", playerid, themodel, 0);
        dini_IntSet("Gov_Land_Company.txt", "bizcash", dini_Int("Gov_Land_Company.txt", "bizcash") + 100);
        format(iStr, sizeof(iStr), "6[VEHICLE] %s has called their vehicle #%d", PlayerName(playerid), themodel);
        iEcho(iStr);
        format(iStr, sizeof(iStr), "(( Local: %s[%d] has called their %s to himself. (%d sec) ))", RPName(playerid), playerid, GetVehicleName(themodel), loltime);
        NearMessage(playerid,iStr,COLOR_LIGHTGREY);
    }*/
    
else if(!sscanf(params"find"tmp2))
    {
        if(!
strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid"find [vehicleID (/myvehicles)]");
        new 
themodel strval(tmp2);
        if(
themodel || themodel sizeof(Vehicles)) return SendClientError(playerid"Invalid vehicle ID!");
        if(
strcmp(PlayerName(playerid),Vehicles[themodel][carowner],false))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(
IsVehicleOccupied(themodel))
            return 
SendClientError(playerid"The vehicle is currently occupied!");
        if(
GetVehicleVirtualWorld(themodel) != 0)
            return 
SendClientError(playerid"The vehicle is in an interior.");
        new 
Float:carpos[3], zone40 ];
        
GetVehiclePos(themodelcarpos[0], carpos[1], carpos[2]);
        
GetZone(carpos[0], carpos[1], carpos[2], zone);
        
SetPlayerCheckpoint(playeridcarpos[0], carpos[1], carpos[2], 5.0);
        
format(iStrsizeof(iStr), " Your vehicle is located at %s. Check your radar."zone);
        
SendClientMessage(playeridCOLOR_LIGHTGREYiStr);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has used /car find for his %s."PlayerName(playerid), GetVehicleName(themodel));
        
iEcho(iStr);
    }
    else if(!
strcmp(params"buy"true4))
    {
        if(
GetPlayerCars(playerid) >= && PlayerInfo[playerid][premium] == 0) return SendClientError(playerid"Sorry, you have no slots left! You may donate to get more slots!");
//        if(GetPlayerCars(playerid) >= 6 && PlayerInfo[playerid][premium] != 0) return SendClientError(playerid, "Sorry, you have no slots left!");
        
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
        if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientError(playerid"You must be the driver!");
        if(!
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid"You cannot buy your own vehicle!");
        if(
Vehicles[GetPlayerVehicleID(playerid)][carprice] == 0) return SendClientError(playerid"You cannot buy this vehicle!");
        if(
PlayerTemp[playerid][sm] < Vehicles[GetPlayerVehicleID(playerid)][carprice]) return SendClientError(playerid"You don't have enough cash!");
        if(
PlayerID(Vehicles[GetPlayerVehicleID(playerid)][carowner]) == INVALID_PLAYER_ID && strcmp(Vehicles[GetPlayerVehicleID(playerid)][carowner],"NoBodY")) return SendClientError(playerid"You cannot buy the vehicle untill he's online.");
        
format(iStrsizeof(iStr), "~r~-$%d"Vehicles[GetPlayerVehicleID(playerid)][carprice]);
        
GameTextForPlayer(playeridiStr3000,1);
        
SetBank(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],Vehicles[GetPlayerVehicleID(playerid)][carprice]); // procedure
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has bought a %s of %s for $%d."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)),Vehicles[GetPlayerVehicleID(playerid)][carowner],Vehicles[GetPlayerVehicleID(playerid)][carprice] );
        
iEcho(iStr);
        
AppendTo(moneylogiStr);
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "price"0);
        
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "owner"PlayerName(playerid));
        
myStrcpy(Vehicles[GetPlayerVehicleID(playerid)][carowner], PlayerName(playerid));
        
format(iStrsizeof(iStr), "Info: You have bought this vehicle for $%d! For help, please use /car help!",Vehicles[GetPlayerVehicleID(playerid)][carprice]);
        
SendClientMessage(playeridCOLOR_LIGHTGREY,iStr);
        
SendClientMessage(playeridCOLOR_LIGHTGREY," Note: Please take a screenshot of /myvehicles!");
        
Vehicles[GetPlayerVehicleID(playerid)][carprice] = 0;
        
TogglePlayerControllable(playeridtrue);
    }
    else if(!
strcmp(params"unsell"true6))
    {
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid"You do not own this vehicle!");
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "price"0);
        
Vehicles[GetPlayerVehicleID(playerid)][carprice] = 0;
        
SendClientMessage(playeridCOLOR_LIGHTGREY"Info: Your vehicle is nolonger on sale. It cannot be bought anymore.");
        
TogglePlayerControllable(playeridtrue);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has put their %s nolonger on sale."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
        
iEcho(iStr);
    }
   else  if(!
strcmp(params"lock"true4))
    {
        new 
vehicleid GetPlayerNearestVehicle(playerid);
        if(
GetDistanceFromPlayerToVehicle(playeridvehicleid) > 5.0)
            return 
SendClientError(playerid"There is no vehicle around you!");
        if(
strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && strcmp(PlayerName(playerid),Vehicles[vehicleid][dupekey],false))
        {
            return 
SendClientError(playerid"You do not own this vehicle and you don't have the dupe keys!");
        }
            if(
Vehicles[vehicleid][tmplocked] == 1)
            {
                
UnlockVehicle(vehicleid);
                
format(iStrsizeof(iStr),"has unlocked the doors of their %s.",GetVehicleName(vehicleid));
                
Action(playeridiStr);
                return 
1;
            }
            else if(
Vehicles[vehicleid][tmplocked] == 0)
            {
                
LockVehicle(-1vehicleid); // nobody can open it
                
format(iStrsizeof(iStr),"has locked the doors of their %s.",GetVehicleName(vehicleid));
                
Action(playeridiStr);
                return 
1;
            }
        return 
1;
    }
  else   if(!
strcmp(params"scrap"true5))
    {
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid"You do not own this vehicle!");
        new 
reward GetVehiclePrice(GetVehicleModel(GetPlayerVehicleID(playerid))) / 110;
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has scrapped their %s and received $%s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)), number_format(reward));
        
iEcho(iStr);
        
AppendTo(moneylog,iStr);
        
GivePlayerMoneyEx(playeridreward);
        
format(iStrsizeof(iStr), "You have scrapped this %s and received $%s, you cannot get it back anymore!"GetVehicleName(GetPlayerVehicleID(playerid)), number_format(reward));
        
SendClientInfo(playeridiStr);
        new 
Float:randx = -2932.5 random(200);
        new 
Float:randy = -2934.5 random(200);
        new 
Float:randz 61.3339 random(200);
        new 
Float:randa random(280);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "x"randx);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "y"randy);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "z"randz);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "a"randa);
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "resetted"1);
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "cartype"0);
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "carteam"0);
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "model"560);
        
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "owner""NoBodY");
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "vw"0);
        new 
GetPlayerVehicleID(playerid);
        
Vehicles[i][fx] = randx;
        
Vehicles[i][fy] = randy;
        
Vehicles[i][fz] = randz;
        
Vehicles[i][fa] = randa;
        
Vehicles[i][reset] = 1;
        
Vehicles[i][vw] = 0;
        
Vehicles[i][carmodel] = 560;
        
myStrcpy(Vehicles[i][carowner], "NoBodY");
        
UnModCar(i);
        
ReloadVehicle(GetPlayerVehicleID(playerid));
        return 
1;
    }
   else  if(!
strcmp(params"park"true4))
    {
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid"You do not own this vehicle!");
        new 
Float:a[4], vww GetPlayerVirtualWorld(playerid);
        
GetVehiclePos(GetPlayerVehicleID(playerid), a[0], a[1], a[2]);
        
GetVehicleZAngle(GetPlayerVehicleID(playerid), a[3]);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "x"a[0]);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "y"a[1]);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "z"a[2]);
        
dini_FloatSet(CarFile(GetPlayerVehicleID(playerid)), "a"a[3]);
        
dini_IntSet(CarFile(GetPlayerVehicleID(playerid)), "vw"vww);
        new 
GetPlayerVehicleID(playerid);
        
Vehicles[i][fx] = a[0];
        
Vehicles[i][fy] = a[1];
        
Vehicles[i][fz] = a[2];
        
Vehicles[i][fa] = a[3];
        
Vehicles[i][vw] = vww;
        
ReloadVehicle(GetPlayerVehicleID(playerid));
        
Up(playerid);
        
SetTimerEx("PutPlayerInVehicleEx"500false"dd"playeridi);
        
SendClientMessage(playeridCOLOR_LIGHTGREY"Info: You have parked your vehicle. From now, it will spawn here!");
        
GameTextForPlayer(playerid"~r~$-150"3000,1);
        
GivePlayerMoneyEx(playerid, -150);
        
dini_IntSet("Gov_Land_Company.txt""bizcash"dini_Int("Gov_Land_Company.txt""bizcash") + 150);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has parked their %s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
        
iEcho(iStr);
    }
   else  if(!
strcmp(params"help"true4))
    {
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car buy{afafaf} - Ability to buy a vehicle, if it is on sale. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car sell [price]{afafaf} - Set your vehicle on sale. Other people may buy it. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car unsell{afafaf} - Stop your vehicle from being sold. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car lock{afafaf} - Toggle the lock of your vehicle from in/outside. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car find [ID]{afafaf} - Find your vehicle, if it isn't occupied. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car respray{afafaf} - Respray your vehicle at the PNS business.. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car tow [ID]{afafaf} - Tow your vehicle ($15000), if it isn't occupied. {228B22}]");
    
//    SendClientMessage(playerid, COLOR_LIGHTGREY, "{228B22}[ {FFFFFF}/car call [ID]{afafaf} - Call your vehicle to you ($9000), if it isn't occupied. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car savemod{afafaf} - Save the tuning of your vehicle. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car unmod{afafaf} - Remove the tuning of your vehicle. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car factionize{afafaf} - Make your car belong to your faction. {228B22}]");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"{228B22}[ {FFFFFF}/car scrap{afafaf} - Delete your vehicle - no refund! {228B22}]");
    }
   else  if(!
strcmp(params"savemod"true7))
    {
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid"You do not own this vehicle!");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"Info: Your modifications have been saved!");
        new 
vehicleid GetPlayerVehicleID(playerid);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid0);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid1);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid2);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid3);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid4);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid5);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid6);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid7);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid8);
        
Vehiclesvehicleid ][ Components ] [ ] = GetVehicleComponentInSlot(vehicleid9);
        
Vehiclesvehicleid ][ Components ] [ 10 ] = GetVehicleComponentInSlot(vehicleid10);
        
Vehiclesvehicleid ][ Components ] [ 11 ] = GetVehicleComponentInSlot(vehicleid11);
        
Vehiclesvehicleid ][ Components ] [ 12 ] = GetVehicleComponentInSlot(vehicleid12);
        
Vehiclesvehicleid ][ Components ] [ 13 ] = GetVehicleComponentInSlot(vehicleid13);
        new 
iString50 ], tmp2210 ];
        for(new 
0CAR_COMPONENTSc++)
        {
            
format(tmp22,sizeof(tmp22),"%d,"Vehicles[GetPlayerVehicleID(playerid)][Components][c]);
            
strcat(iString,tmp22);
        }
        
strdel(iString,strlen(iString)-1strlen(iString));
        
dini_Set(CarFile(GetPlayerVehicleID(playerid)), "components"iString);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has saved the tuning of their %s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
        
iEcho(iStr);
    }
   else  if(!
strcmp(params"unmod"true5))
    {
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid"You are not in any vehicle!");
        if(
strcmp(PlayerName(playerid),Vehicles[GetPlayerVehicleID(playerid)][carowner],false)) return SendClientError(playerid"You do not own this vehicle!");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"Info: Your modifications have been removed! (Paintjob upon respawn)");
        
UnModCar(GetPlayerVehicleID(playerid));
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has removed the tuning of their %s."PlayerName(playerid), GetVehicleName(GetPlayerVehicleID(playerid)));
        
iEcho(iStr);
    }
    else if(!
strcmp(params"payfee"true7))
    {
        if(!
IsPlayerAtImpound(playerid)) return SendClientError(playerid"You are not at the car impound!");
        new 
vehicleid GetPlayerNearestVehicle(playerid);
        if(
GetDistanceFromPlayerToVehicle(playeridvehicleid) > 3.0)
            return 
SendClientError(playerid"There is no vehicle around you! You must stand ON it.");
        if(
strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && strcmp("NoBodY",Vehicles[vehicleid][carowner],true))
            return 
SendClientError(playerid"You do not own this vehicle!");
        if(
HandMoney(playerid) < dini_Int(CarFile(vehicleid), "impoundfee"))
            return 
SendClientError(playerid"You don't have enough money on hand!");
        new 
fee dini_Int(CarFile(vehicleid), "impoundfee");
        if(
fee == 666)
            return 
SendClientError(playerid"You cannot unimpound your vehicle  at this time!");
        
GivePlayerMoneyEx(playerid, -fee);
        
SendClientMSG(playeridCOLOR_HELPEROOC"[IMPOUND] Paid $%d to unimpound your %s!"feeGetVehicleName(vehicleid));
        if(!
dini_Isset(globalstats"unimpoundslot")) dini_IntSet(globalstats"unimpoundslot"0);
        new 
ri dini_Int(globalstats"unimpoundslot");
        if(
ri >= sizeof(unimpoundpos))
        {
            
ri 0;
            
dini_IntSet(globalstats"unimpoundslot"0);
        }
        else
        {
            
dini_IntSet(globalstats"unimpoundslot"ri+1);
        }
        
dini_FloatSet(CarFile(vehicleid), "x"unimpoundpos[ri][spawnx]);
        
dini_FloatSet(CarFile(vehicleid), "y"unimpoundpos[ri][spawny]);
        
dini_FloatSet(CarFile(vehicleid), "z"unimpoundpos[ri][spawnz]);
        
dini_FloatSet(CarFile(vehicleid), "a"unimpoundpos[ri][sangle]);
        
dini_IntSet(CarFile(vehicleid), "impounded"0);
        
dini_IntSet(CarFile(vehicleid), "vw"0);
        
ReloadVehicle(vehicleid);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has un-impounded their %s for $%d."PlayerName(playerid), GetVehicleName(vehicleid), fee);
        
iEcho(iStr);
        return 
1;
    }
    else if(!
sscanf(params"impound"tmp2))
    {
        if(!
IsPlayerFED(playerid)) return SendClientError(playerid"You may not use this.");
        if(!
IsPlayerAtImpound(playerid)) return SendClientError(playerid"You are not at the car impound!");
        if(!
strlen(tmp2) || !IsNumeric(tmp2) || !strlen(tmp3)) return SCP(playerid"impound [ fee ] [ reason ]");
        if(
strval(tmp2) < || strval(tmp2) > 50000) return SendClientError(playerid"Invalid amount!");
        new 
vehicleid GetPlayerNearestVehicle(playerid);
        if(!
Vehicles[vehicleid][carteam] && !strcmp(Vehicles[vehicleid][carowner],"NoBodY",true))
            return 
SendClientError(playerid"You cannot impound unowned vehicles!");
        if(
GetDistanceFromPlayerToVehicle(playeridvehicleid) > 3.0)
            return 
SendClientError(playerid"There is no vehicle around you! You must stand ON it.");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"Info: This car has been impounded!");
        new 
Float:cPos[4];
        
GetVehiclePos(vehicleidcPos[0], cPos[1], cPos[2]);
        
GetVehicleZAngle(vehicleidcPos[3]);
        
dini_FloatSet(CarFile(vehicleid), "x"cPos[0]);
        
dini_FloatSet(CarFile(vehicleid), "y"cPos[1]);
        
dini_FloatSet(CarFile(vehicleid), "z"cPos[2]);
        
dini_FloatSet(CarFile(vehicleid), "a"cPos[3]);
        
dini_IntSet(CarFile(vehicleid), "impounded"1);
        
dini_IntSet(CarFile(vehicleid), "impoundfee"strval(tmp2));
        
dini_Set(CarFile(vehicleid), "impoundreason"tmp3);
        
ReloadVehicle(vehicleid);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has impounded a %s of %s."PlayerName(playerid), GetVehicleName(vehicleid), dini_Get(CarFile(vehicleid), "owner"));
        
iEcho(iStr);
        return 
1;
    }
     else if(!
strcmp(params"unimpound"true9))
    {
        if(!
IsPlayerFED(playerid) && PlayerInfo[playerid][power] < 10)
            return 
SendClientError(playerid"You may not use this.");
        if(!
IsPlayerAtImpound(playerid)) return SendClientError(playerid"You are not at the car impound!");
        new 
vehicleid GetPlayerNearestVehicle(playerid);
        if(
GetDistanceFromPlayerToVehicle(playeridvehicleid) > 3.0)
            return 
SendClientError(playerid"There is no vehicle around you! You must stand ON it.");
        if(
dini_Int(CarFile(vehicleid), "impounded") == 0)
            return 
SendClientError(playerid"This car is not impounded!");
        
SendClientMessage(playeridCOLOR_LIGHTGREY"Info: This car has been un-impounded!");
        if(!
dini_Isset(globalstats"unimpoundslot")) dini_IntSet(globalstats"unimpoundslot"0);
        new 
ri dini_Int(globalstats"unimpoundslot");
        if(
ri >= sizeof(unimpoundpos))
        {
            
ri 0;
            
dini_IntSet(globalstats"unimpoundslot"0);
        }
        else
        {
            
dini_IntSet(globalstats"unimpoundslot"ri+1);
        }
        
dini_FloatSet(CarFile(vehicleid), "x"unimpoundpos[ri][spawnx]);
        
dini_FloatSet(CarFile(vehicleid), "y"unimpoundpos[ri][spawny]);
        
dini_FloatSet(CarFile(vehicleid), "z"unimpoundpos[ri][spawnz]);
        
dini_FloatSet(CarFile(vehicleid), "a"unimpoundpos[ri][sangle]);
        
dini_IntSet(CarFile(vehicleid), "impounded"0);
        
dini_IntSet(CarFile(vehicleid), "vw"0);
        
ReloadVehicle(vehicleid);
        
format(iStrsizeof(iStr), "6[VEHICLE] %s has un-impounded a %s of %s."PlayerName(playerid), GetVehicleName(vehicleid), dini_Get(CarFile(vehicleid), "owner"));
        
iEcho(iStr);
    }
else return 
SCP(playerid,"[ buy / sell / unsell / park / lock / help / tow / find / respray / savemod / unmod / dupekey / takekey / factionize / scrap / paintjob / nitro / plate / control ]");
 return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)