Simple question
#1

Hello guys. I am a beginner at PAWN scripting.
I have made some /enter and /exit commands to enter/exit interiors.
The way i have done it works fine, but i wanna ask you guys if this is a good way to do it or not.
Here it is:

pawn Код:
if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
        // LSPD Roof enter
        if IsPlayerInRangeOfPoint(playerid, 2, 1582.0098,-1678.0596,5.8948)
        *then SetPlayerPos(playerid, 1564.8649,-1666.4268,28.3956);
        else
        // LVPD Roof enter
        if IsPlayerInRangeOfPoint(playerid, 2, 2296.5417,2468.7595,10.8203)
        *then SetPlayerPos(playerid, 2258.4199,2446.0029,38.6837);
        else
        //Cityhall enter
        if IsPlayerInRangeOfPoint(playerid, 2, 1482.6467,-1771.3864,18.7958)
        *then SetPlayerInterior(playerid, 3)
        && SetPlayerPos(playerid, 389.8038,173.7481,1008.3828)
        && SendClientMessage(playerid, 0x00FF00FF, "( ! ) Welcome to the City Hall")
        && SendClientMessage(playerid, 0xFF0000FF, "( ! ) Fighting is Forbidden Here");
        else
        // Bank enter
        if IsPlayerInRangeOfPoint(playerid, 2, 1459.5046,-1010.9807,26.8438)
        *then SetPlayerInterior(playerid, 3)
        && SetPlayerVirtualWorld(playerid, 1)
        && SetPlayerPos(playerid, 344.6455,177.8833,1014.1875)
        && SendClientMessage(playerid, 0x00FF00FF, "( ! ) Welcome to the Bank")
        && SendClientMessage(playerid, 0xFF0000FF, "( ! ) Fighting is Forbidden Here");
        else
        // LSPD enter
        if IsPlayerInRangeOfPoint(playerid, 2, 1554.7009,-1675.6124,16.1953)
        *then SetPlayerInterior(playerid, 6)
        && SetPlayerPos(playerid, 246.7726,62.9369,1003.6406);
        else
        // House-test1 enter
        if IsPlayerInRangeOfPoint(playerid, 2, 652.5432,-1619.8052,15.0000)
        *then SetPlayerInterior(playerid, 8)
        && SetPlayerPos(playerid, 2365.2734,-1135.2139,1050.8750);
        // Negative
        else SendClientMessage(playerid, 0xFF0000FF, "( ! ) You can not enter here");
        return 1;
    }
   
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
        // LSPD Roof exit
        if IsPlayerInRangeOfPoint(playerid, 2, 1564.8649,-1666.4268,28.3956)
        *then SetPlayerPos(playerid, 1582.0098,-1678.0596,5.8948);
        else
        // LVPD Roof exit
        if IsPlayerInRangeOfPoint(playerid, 2, 2258.4199,2446.0029,38.6837)
        *then SetPlayerPos(playerid, 2296.5417,2468.7595,10.8203);
        else
        // Cityhall exit
        if IsPlayerInRangeOfPoint(playerid, 2, 389.8038,173.7481,1008.3828)
        *then SetPlayerPos(playerid, 1482.6467,-1771.3864,18.7958)
        && SetPlayerInterior(playerid, 0)
        && SendClientMessage(playerid, 0xFFFF00FF, "( ! ) You leave the City Hall");
        else
        // Bank exit
        if IsPlayerInRangeOfPoint(playerid, 2, 344.6455,177.8833,1014.1875)
        *then SetPlayerInterior(playerid, 0)
        && SetPlayerVirtualWorld(playerid, 0)
        && SetPlayerPos(playerid, 1459.5046,-1010.9807,26.8438)
        && SendClientMessage(playerid, 0xFFFF00FF, "( ! ) You leave the Bank");
        else
        // LSPD exit
        if IsPlayerInRangeOfPoint(playerid, 2, 246.7726,62.9369,1003.6406)
        *then SetPlayerInterior(playerid, 0)
        && SetPlayerPos(playerid, 1554.7009,-1675.6124,16.1953);
        else
        // House-test1 exit
        if IsPlayerInRangeOfPoint(playerid, 2, 2365.2734,-1135.2139,1050.8750)
        *then SetPlayerInterior(playerid, 0)
        && SetPlayerPos(playerid, 652.5432,-1619.8052,15.0000);
        // Negative
        else SendClientMessage(playerid, 0xFF0000FF, "( ! ) You can not exit here");
        return 1;
    }
And how do i add PAWN code to this forum with PAWN highlightings? xD
Reply
#2

You should use zcmd for cmds, it is alot faster than strcmp

Use [ pawn ] [ /pawn ]
Reply
#3

Quote:
Originally Posted by xir
Посмотреть сообщение
You should use zcmd for cmds, it is alot faster than strcmp

Use [ pawn ] [ /pawn ]
Thank you. But yes, i know that, but i mean the way i used
pawn Код:
if ---------
*then -----
Etc.
Reply
#4

Yeah you can do that

but why you added the "*" also you dont need to add the "&&"
Reply
#5

Quote:
Originally Posted by xir
Посмотреть сообщение
Yeah you can do that

but why you added the "*" also you dont need to add the "&&"
Thank you very much. I added the "*" because pawno said: "Expected token "*then""
Reply
#6

Whenever I add those like you did I get erors why dont you xD?
Reply
#7

Hmm, idk xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)