SA-MP Forums Archive
what wrong with this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: what wrong with this? (/showthread.php?tid=275545)



what wrong with this? - Horrible - 10.08.2011

TY For leong who remembered me...


Re: what wrong with this? - dowster - 10.08.2011

i think you had an opening bracket where there should have been a closing bracket, and a couple too many closing brackets at the end


Re: what wrong with this? - ElieJabbour - 10.08.2011

Код:
if(strcmp(cmd, "/rentcar", true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid,15.0, 1738.2720,-1862.1799,13.5766))
    {
    if(GetPlayerMoney(playerid) <= 1000)return SendClientMessage(playerid, COLOR_GREEN, "You Need $1000 To Rent Car ");//You can change the price
    if(sscanf(params, "ii", carId, slot)) return SendClientMessage(playerid, COLOR_GREEN, "Usage: /rentcar carId slot");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, COLOR_GREEN, "Invalid car Id, (400 - 611)");
    if(slot < 1 || slot > 3) return SendClientMessage(playerid, COLOR_GREEN, "Invalid slot Id, (1 - 3)");
    if(slot != 1))
    }
    if(GetPVarInt(playerid, "rent1") == 10)return SendClientMessage(playerid, COLOR_YELLOW, "This Slot Is In Use");
    GetPlayerPos(playerid, x, y, z);
    rentcar1[playerid] = CreateVehicle(carId, x, y, z, 0,-1, -1, -1);
    PutPlayerInVehicle(playerid, rentcar1[playerid],0);
    timer1 = SetTimer("car1", time, true);
    DeletePVar(playerid,"unrent1");
    GivePlayerMoney(playerid,-price);
    SetPVarInt(playerid , "rent1", 10);
    {
    if(slot ==2))
    {
    if(GetPVarInt(playerid, "rent2") == 11)return SendClientMessage(playerid, COLOR_YELLOW, "This Slot Is In Use");
    GetPlayerPos(playerid, x, y, z);
    rentcar2[playerid] = CreateVehicle(carId, x, y, z, 0,-1, -1, -1);
    PutPlayerInVehicle(playerid, rentcar2[playerid],0);
    timer2 = SetTimer("car2", time, true);
    DeletePVar(playerid,"unrent2");
    GivePlayerMoney(playerid,-price);
    SetPVarInt(playerid , "rent2", 11);
    }
    if(slot != 3))
    {
    if(GetPVarInt(playerid, "rent3") == 12)return SendClientMessage(playerid, COLOR_YELLOW, "This Slot Is In Use");
    GetPlayerPos(playerid, x, y, z);
    rentcar3[playerid] = CreateVehicle(carId, x, y, z, 0,-1, -1, -1);
    PutPlayerInVehicle(playerid, rentcar3[playerid],0);
    timer3 = SetTimer("car3", time, true);
    DeletePVar(playerid,"unrent3");
    GivePlayerMoney(playerid,-price);
    SetPVarInt(playerid , "rent3", 12);
    }
    if(IsPlayerInRangeOfPoint(playerid,15.0, 1703.1957,-1470.1140,13.5469))
    {

    if(GetPlayerMoney(playerid) <= 1000)return SendClientMessage(playerid, COLOR_GREEN, "You Need $1000 To Rent Car ");//You can change the price
    if(sscanf(params, "ii", carId, slot)) return SendClientMessage(playerid, COLOR_GREEN, "Usage: /rentcar carId slot");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, COLOR_GREEN, "Invalid car Id, (400 - 611)");
    if(slot < 1 || slot > 3) return SendClientMessage(playerid, COLOR_GREEN, "Invalid slot Id, (1 - 3)");
    if(slot != 1))
    }
    if(GetPVarInt(playerid, "rent1") == 10)return SendClientMessage(playerid, COLOR_YELLOW, "This Slot Is In Use");
    GetPlayerPos(playerid, x, y, z);
    rentcar1[playerid] = CreateVehicle(carId, x, y, z, 0,-1, -1, -1);
    PutPlayerInVehicle(playerid, rentcar1[playerid],0);
    timer1 = SetTimer("car1", time, true);
    DeletePVar(playerid,"unrent1");
    GivePlayerMoney(playerid,-price);
    SetPVarInt(playerid , "rent1", 10);
    {
    if(slot ==2))
    {
    if(GetPVarInt(playerid, "rent2") == 11)return SendClientMessage(playerid, COLOR_YELLOW, "This Slot Is In Use");
    GetPlayerPos(playerid, x, y, z);
    rentcar2[playerid] = CreateVehicle(carId, x, y, z, 0,-1, -1, -1);
    PutPlayerInVehicle(playerid, rentcar2[playerid],0);
    timer2 = SetTimer("car2", time, true);
    DeletePVar(playerid,"unrent2");
    GivePlayerMoney(playerid,-price);
    SetPVarInt(playerid , "rent2", 11);
    }
    if(slot != 3))
    {
    if(GetPVarInt(playerid, "rent3") == 12)return SendClientMessage(playerid, COLOR_YELLOW, "This Slot Is In Use");
    GetPlayerPos(playerid, x, y, z);
    rentcar3[playerid] = CreateVehicle(carId, x, y, z, 0,-1, -1, -1);
    PutPlayerInVehicle(playerid, rentcar3[playerid],0);
    timer3 = SetTimer("car3", time, true);
    DeletePVar(playerid,"unrent3");
    GivePlayerMoney(playerid,-price);
    SetPVarInt(playerid , "rent3", 12);
    }
    }
    }
    return 1;
}
Try this


Re: what wrong with this? - leong124 - 10.08.2011

pawn Код:
if(slot != 1))
Why there's one more bracket?
Why it is != ?

Also, improve your indentation with the tab key.
You'll find many improper/reversed brackets.