SA-MP Forums Archive
ERRORS ! - 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: ERRORS ! (/showthread.php?tid=498965)



ERRORS ! - howtodo - 05.03.2014



How to fix it? need quick help please...


Re: ERRORS ! - Ryan_Undering - 05.03.2014

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


How to fix it? need quick help please...
Need to see your code buddy...


Re: ERRORS ! - howtodo - 05.03.2014

PHP код:
/*    if(strcmp(cmd, "/takestretcher", true) == 0) //HOSPITAL (NEW)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid ,3.0, 1216.8700, -1370.1622, 1017.8790))
            {
                   if(PlayerInfo[playerid][pMember] != 4 || PlayerInfo[playerid][pLeader] != 4)
                   {
                    AttachObjectToPlayer( hospybed, playerid, 0, 1.5, -0.5, 0, 0, 0 ); // add the co-ordinates on the player skin
                    return 1;
                }
            }
        }
    }
    if(strcmp(cmd, "/dropstretcher", true) == 0) //HOSPITAL (NEW)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid ,25.0, 1216.8700, -1370.1622, 1017.8790))
            {
                   if(PlayerInfo[playerid][pMember] != 4 || PlayerInfo[playerid][pLeader] != 4)
                   {
                       DestroyObject(hospybed);
                        hospybed = CreateDynamicObject(2146, 1217.627441, -1370.959229, 1017.364563, 0.0000, 0.0000, 90.0000);
                    return 1;
                }
            }
            else
            {
                 SendClientMessage(playerid, COLOR_GREY, "   You are Not inside the hospital!");
                return 1;
            }
            else
            {
                 SendClientMessage(playerid, COLOR_GREY, "   You are Not High Enough Leader!");
                return 1;
            }
        }
    }*/ 



Re: ERRORS ! - Ryan_Undering - 05.03.2014

Okay, let's start on fixing this script.

FIRST: Make sure you have actually defined hospybed as something (You haven't included any definition line in this code paste.)

SECOND:

pawn Код:
if(strcmp(cmd, "/takestretcher", true) == 0) //HOSPITAL (NEW)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid ,3.0, 1216.8700, -1370.1622, 1017.8790))
            {
                   if(PlayerInfo[playerid][pMember] != 4 || PlayerInfo[playerid][pLeader] != 4)
                   {
                    AttachObjectToPlayer( hospybed, playerid, 0, 1.5, -0.5, 0, 0, 0 ); // add the co-ordinates on the player skin
                    return 1;
                }
            }
        }
    }
    if(strcmp(cmd, "/dropstretcher", true) == 0) //HOSPITAL (NEW)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid ,25.0, 1216.8700, -1370.1622, 1017.8790))
            {
                if(PlayerInfo[playerid][pMember] != 4 || PlayerInfo[playerid][pLeader] != 4)
                {
                    DestroyObject(hospybed);
                    hospybed = CreateDynamicObject(2146, 1217.627441, -1370.959229, 1017.364563, 0.0000, 0.0000, 90.0000);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are Not High Enough Leader!");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are Not inside the hospital!");
                return 1;
            }
        }
    }
You had two else's in the same if statement, so I've moved that around slightly for you... It's untested of course, so I don't know if I've fixed it completely, but tell me if I'm wrong..


Lastly, you haven't provided the lines for your WARNINGS, it'll be handy to have a look at those too.


Re: ERRORS ! - howtodo - 06.03.2014

OK, thanks for the help.