SA-MP Forums Archive
[Help]2 Errors 1 Warning Can you help me?:) - 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: [Help]2 Errors 1 Warning Can you help me?:) (/showthread.php?tid=144929)



[Help]2 Errors 1 Warning Can you help me?:) - eDz0r - 29.04.2010

I Have This 2 Errors and 1 Warning
Код:
C:\Users\Edy\Desktop\cardel1.pwn(44) : error 029: invalid expression, assumed zero
C:\Users\Edy\Desktop\cardel1.pwn(44) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\Users\Edy\Desktop\cardel1.pwn(60) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
My Code

pawn Код:
#include <a_samp>
//Car Deliver Job #1
#define cardelckp1 2296.0818,1956.2855,9.5943
new cardel1;
new cardeljob1 = 0;
new cardelpik1;
public OnFilterScriptInit()
{
  cardel1=AddStaticVehicleEx(411,1099.0938,-1775.5436,13.0715,90.0586,3,3,30); //Deliver Car #1
  cardelpik1 = CreatePickup(1239,23,1111.0721,-1798.0670,16.5938);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/startdeliver", cmdtext, true, 10) == 0)
{
new VehicleID = GetPlayerVehicleID(playerid);
if(VehicleID == cardel1)
{
SetPlayerCheckpoint(playerid, cardelckp1, 3.0);
cardeljob1 = 1;
GameTextForPlayer(playerid, "~g~Started The Deliver, Good Luck!", 3000, 3);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s I Deliver A Car.", name );
SendClientMessageToAll(0xF60000F6, string);
return 1;
}
SendClientMessage(playerid, 0xF60000F6,"You Have To Be In The Car to Start The Deliver");
}

if (strcmp("/deliverinfo", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
{
SendClientMessage(playerid, 0xF6F600F6, "Deliver Location: Las Venturas.");
SendClientMessage(playerid, 0xF6F600F6, "Deliver Reward 1000$.");
return 1;
}
return 0;
}

public OnPlayerEnterCheckpoint(playerid)//Line44-----------------------------------------------------------------------------------
{
new VehicleID = GetPlayerVehicleID(playerid);
if(VehicleID == cardel1)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
{
SetPlayerCheckpoint(playerid, cardelckp1, 7.0);
}
GivePlayerMoney(playerid, 10000);
GameTextForPlayer(playerid, "~g~You Completed The Deliver, Well Done!", 3000, 3);
SetVehicleToRespawn(2);
cardeljob1 = 0;
DisablePlayerCheckpoint(playerid);
}
}
}//Line60--------------------------------------------------------------------------------------------------------------------------

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new VehicleID = GetPlayerVehicleID(playerid);
if(VehicleID == cardel1)
{
SendClientMessage(playerid, 0xF60000F6, "You Can Start The Deliver by writing /startdeliver");
}
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
if((cardeljob1) == 1)
{
cardeljob1 = 0;
SendClientMessage(playerid, 0xF60000F6, "You Left Deliver Car Behind, Get In Again If You Want To Continue Your Deliver.");

}else if((cardeljob1) == 0){
}
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == cardelpik1)
{
GameTextForPlayer(playerid, "~g~Type /deliverinfo to see te deliver info", 3000, 3);
}
}



Re: [Help]2 Errors 1 Warning Can you help me?:) - MadeMan - 29.04.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/startdeliver", cmdtext, true) == 0)
    {
        new VehicleID = GetPlayerVehicleID(playerid);
        if(VehicleID == cardel1)
        {
            SetPlayerCheckpoint(playerid, cardelckp1, 3.0);
            cardeljob1 = 1;
            GameTextForPlayer(playerid, "~g~Started The Deliver, Good Luck!", 3000, 3);
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "%s I Deliver A Car.", name );
            SendClientMessageToAll(0xF60000F6, string);
            return 1;
        }
        SendClientMessage(playerid, 0xF60000F6,"You Have To Be In The Car to Start The Deliver");
    }

    if (strcmp("/deliverinfo", cmdtext, true) == 0)
    {
        if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
        {
            SendClientMessage(playerid, 0xF6F600F6, "Deliver Location: Las Venturas.");
            SendClientMessage(playerid, 0xF6F600F6, "Deliver Reward 1000$.");
        }
        return 1;
    }
    return 0;
}
You had a bracket missing.


Re: [Help]2 Errors 1 Warning Can you help me?:) - biltong - 29.04.2010

pawn Код:
#include <a_samp>
//Car Deliver Job #1
#define cardelckp1 2296.0818,1956.2855,9.5943
new cardel1;
new cardeljob1 = 0;
new cardelpik1;
public OnFilterScriptInit()
{
  cardel1=AddStaticVehicleEx(411,1099.0938,-1775.5436,13.0715,90.0586,3,3,30); //Deliver Car #1
  cardelpik1 = CreatePickup(1239,23,1111.0721,-1798.0670,16.5938);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/startdeliver", cmdtext, true, 10) == 0)
    {
        new VehicleID = GetPlayerVehicleID(playerid);
        if(VehicleID == cardel1)
        {
            SetPlayerCheckpoint(playerid, cardelckp1, 3.0);
            cardeljob1 = 1;
            GameTextForPlayer(playerid, "~g~Started The Deliver, Good Luck!", 3000, 3);
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "%s I Deliver A Car.", name );
            SendClientMessageToAll(0xF60000F6, string);
            return 1;
        }
        SendClientMessage(playerid, 0xF60000F6,"You Have To Be In The Car to Start The Deliver");
    }

    if (strcmp("/deliverinfo", cmdtext, true, 10) == 0)
    {
        if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
        {
            SendClientMessage(playerid, 0xF6F600F6, "Deliver Location: Las Venturas.");
            SendClientMessage(playerid, 0xF6F600F6, "Deliver Reward 1000$.");
            return 1;
        //note how you're missing a brace here? thats this one --> }
    }
    return 0;
}

public OnPlayerEnterCheckpoint(playerid)
{
    new VehicleID = GetPlayerVehicleID(playerid);
    if(VehicleID == cardel1)
    {
        if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
        {
            SetPlayerCheckpoint(playerid, cardelckp1, 7.0);
        }
        GivePlayerMoney(playerid, 10000);
        GameTextForPlayer(playerid, "~g~You Completed The Deliver, Well Done!", 3000, 3);
        SetVehicleToRespawn(2);
        cardeljob1 = 0;
        DisablePlayerCheckpoint(playerid);
    }
}
//} see the extra brace here?

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new VehicleID = GetPlayerVehicleID(playerid);
    if(VehicleID == cardel1)
    {
        SendClientMessage(playerid, 0xF60000F6, "You Can Start The Deliver by writing /startdeliver");
    }
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    if((cardeljob1) == 1)
    {
        cardeljob1 = 0;
        SendClientMessage(playerid, 0xF60000F6, "You Left Deliver Car Behind, Get In Again If You Want To Continue Your Deliver.");
    }
    else if((cardeljob1) == 0)
    {//empty space... wtf?
    }
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == cardelpik1)
    {
        GameTextForPlayer(playerid, "~g~Type /deliverinfo to see te deliver info", 3000, 3);
    }
}
This is why we indent our code. See how much easier it was to spot that extra and missing brace? See how much neater and uncluttered it is? There is a reason we do it, we're not all that mad.


Re: [Help]2 Errors 1 Warning Can you help me?:) - eDz0r - 30.04.2010

Quote:
Originally Posted by MadeMan
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/startdeliver", cmdtext, true) == 0)
    {
        new VehicleID = GetPlayerVehicleID(playerid);
        if(VehicleID == cardel1)
        {
            SetPlayerCheckpoint(playerid, cardelckp1, 3.0);
            cardeljob1 = 1;
            GameTextForPlayer(playerid, "~g~Started The Deliver, Good Luck!", 3000, 3);
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "%s I Deliver A Car.", name );
            SendClientMessageToAll(0xF60000F6, string);
            return 1;
        }
        SendClientMessage(playerid, 0xF60000F6,"You Have To Be In The Car to Start The Deliver");
    }

    if (strcmp("/deliverinfo", cmdtext, true) == 0)
    {
        if (IsPlayerInRangeOfPoint(playerid, 7.0,cardelckp1))
        {
            SendClientMessage(playerid, 0xF6F600F6, "Deliver Location: Las Venturas.");
            SendClientMessage(playerid, 0xF6F600F6, "Deliver Reward 1000$.");
        }
        return 1;
    }
    return 0;
}
You had a bracket missing.
thank you