SA-MP Forums Archive
Whats wrong? - 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: Whats wrong? (/showthread.php?tid=391951)



Whats wrong? - phil_lendon - 12.11.2012

Whats wrong with this code? it crashes the compiler..
pawn Код:
if(!strcmp(cmdtext, "/open", true)){
            MoveObject(impoundgate1, 1901.51, -1865.99, 14.65, 0.00, 0.00, 274.66);
            MoveObject(impoundgate2, 1892.43, -1865.98, 14.65,   0.00, 0.00, 266.03);
            SendClientMessage(playerid, 0x0000BBAA, "Impound Opened");
            return 1;
        }
    }
        if(!strcmp(cmdtext, "/close", true)){
            MoveObject(impoundgate1, 1901.51, -1865.99, 14.65,   0.00, 0.00, 0.00));
            MoveObject(impoundgate2, 1892.43, -1865.98, 14.65,   0.00, 0.00, 180.00);
            SendClientMessage(playerid, 0xAA3333AA, "Impound Closed");
            return 1;
        }
    }
  return 1;
}
pawn Код:
new impoundgate1;
new impoundgate2;
pawn Код:
impoundgate1 = CreateDynamicObject(3049, 1901.51, -1865.99, 14.65,   0.00, 0.00, 0.00); //gate1
impoundgate2 = CreateDynamicObject(3050, 1892.43, -1865.98, 14.65,   0.00, 0.00, 180.00); //gate2



Re: Whats wrong? - Konstantinos - 12.11.2012

You closed "}" brackets which were useless, that's why.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/open", true))
    {
        MoveObject(impoundgate1, 1901.51, -1865.99, 14.65, 0.00, 0.00, 274.66);
        MoveObject(impoundgate2, 1892.43, -1865.98, 14.65,   0.00, 0.00, 266.03);
        SendClientMessage(playerid, 0x0000BBAA, "Impound Opened");
        return 1;
    }

    if(!strcmp(cmdtext, "/close", true))
    {
        MoveObject(impoundgate1, 1901.51, -1865.99, 14.65,   0.00, 0.00, 0.00));
        MoveObject(impoundgate2, 1892.43, -1865.98, 14.65,   0.00, 0.00, 180.00);
        SendClientMessage(playerid, 0xAA3333AA, "Impound Closed");
        return 1;
    }
    return 0;
}



Re: Whats wrong? - phil_lendon - 12.11.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
You closed "}" brackets which were useless, that's why.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/open", true))
    {
        MoveObject(impoundgate1, 1901.51, -1865.99, 14.65, 0.00, 0.00, 274.66);
        MoveObject(impoundgate2, 1892.43, -1865.98, 14.65,   0.00, 0.00, 266.03);
        SendClientMessage(playerid, 0x0000BBAA, "Impound Opened");
        return 1;
    }

    if(!strcmp(cmdtext, "/close", true))
    {
        MoveObject(impoundgate1, 1901.51, -1865.99, 14.65,   0.00, 0.00, 0.00));
        MoveObject(impoundgate2, 1892.43, -1865.98, 14.65,   0.00, 0.00, 180.00);
        SendClientMessage(playerid, 0xAA3333AA, "Impound Closed");
        return 1;
    }
    return 0;
}
Still crashes when I try to compile..
Fixed.


Re: Whats wrong? - Plovix - 12.11.2012

Try this:
PHP код:
if(!strcmp(cmdtext"/open"true)){
            
MoveObject(impoundgate11901.51, -1865.9914.650.000.00274.66);
            
MoveObject(impoundgate21892.43, -1865.9814.65,   0.000.00266.03);
            
SendClientMessage(playerid0x0000BBAA"Impound Opened");
            return 
1;
        }
        if(!
strcmp(cmdtext"/close"true)){
            
MoveObject(impoundgate11901.51, -1865.9914.65,   0.000.000.00);
            
MoveObject(impoundgate21892.43, -1865.9814.65,   0.000.00180.00);
            
SendClientMessage(playerid0xAA3333AA"Impound Closed");
            return 
1;
        }
  return 
1;