SA-MP Forums Archive
Car tow help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Car tow help (/showthread.php?tid=578606)



Car tow help - TheLegend1 - 20.06.2015

hey guys.
i am trying to make car tow with dialog but i really cant make it i am getting problems that i've never seen before.
here is my script please if u can do something tell me

PHP код:
else if(!strcmp(tmp"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 5000
        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~$-5000"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); 
    } 



Re: Car tow help - Dusan01 - 20.06.2015

here u go:

at top of script add:
pawn Код:
#define DIALOG_TOW 5512
then on Public OnPlayerDialogResponse add:
pawn Код:
if(dialogid == DIALOG_TOW)
{
if(!response) return 1;
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strlen(inputtext) > 5) return ShowPlayerDialog(playerid,DIALOG_TOW,DIALOG_STYLE_INPUT, "Towing" ,"vehicleID (/myvehicles)","Tow","cancel");  
     new themodel = strval(inputtext);  
        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!");  
        new iPrice;  
        if(PlayerInfo[playerid][playerlvl] < 15) iPrice = 0;  
        else iPrice = 5000;  
        if(HandMoney(playerid) < iPrice) return SendClientError(playerid, "You don't have enough money!");  
        ReloadVehicle(themodel);  
        SendClientMessage(playerid, COLOR_LIGHTGREY,"Info: Your vehicle has been towed!");  
        if(iPrice) GameTextForPlayer(playerid, "~r~$-5000", 3000,1);  
        GivePlayerMoneyEx(playerid, -iPrice);  
        dini_IntSet("Gov_Land_Company.txt", "bizcash", dini_Int("Gov_Land_Company.txt", "bizcash") + 150);  
        format(iStr, sizeof(iStr), "6[VEHICLE] %s has towed their %s.", PlayerName(playerid), GetVehicleName(themodel));  
        iEcho(iStr);  
}
}
command:
pawn Код:
if(!strcmp(cmdtext, "/towcar", true))
{
ShowPlayerDialog(playerid,DIALOG_TOW,DIALOG_STYLE_INPUT, "Towing" ,"Type vehicle id to tow","Tow","cancel");  
return 1;
}
you will get some errors cuz i dont have full script to recopy it to dialog, but i just give u and example how u sholud do it...


Re: Car tow help - TheLegend1 - 21.06.2015

"File of function was not found ..."


Re: Car tow help - Dusan01 - 21.06.2015

hmm, i think problem is in command:
PHP код:
if (strcmp("/tow"cmdtexttrue4) == 0)
{
ShowPlayerDialog(playerid,DIALOG_TOW,DIALOG_STYLE_INPUT"Towing" ,"Type vehicle id to tow","Tow","cancel");  
return 
1;

if still u have same problem try disabeling that dialog and run server so u can make sure in what is problem...


Re: Car tow help - TheLegend1 - 21.06.2015

i fixed it but i mean the owned vehicles to be in list and just click on it and spawn xD


Re: Car tow help - TheLegend1 - 21.06.2015

someone please help me out