Garbage job won't throw
#1

My code:
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <streamer>

#define COLOR_YELLOW 0xFFFF00AA

new Trash[3];
new Trasher[MAX_PLAYERS];
new HasTrash;
forward Clearanim(playerid);

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}


public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddStaticVehicle(408, 2039.8792, 1339.7240, 10.6719, 179.8416, 0, 0);
    AddStaticVehicle(411, 2039.8792, 1339.7240, 10.6719, 179.8416, 0, 0);
    CreateDynamic3DTextLabel("Join the Taxi job now\nwith /join", COLOR_YELLOW, 1704.91, 1302.10, 10.83, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // TAXI JOB LV
    CreateDynamic3DTextLabel("Join the Lawyer job now\nwith /join", COLOR_YELLOW, 2183.0159, 2295.1296, 10.8203, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // LAWYER JOB LV
    CreateDynamic3DTextLabel("Join the Arms Dealer job now\nwith /join", COLOR_YELLOW, 2538.8462, 2076.7151, 11.1016, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // ARMS DEALER JOB LV
    CreateDynamic3DTextLabel("Join the Fisher job now\nwith /join", COLOR_YELLOW, 2359.9363, 554.5175, 7.6619, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // FISHER JOB LV
    CreateDynamic3DTextLabel("Join the Fisher job now\nwith /join", COLOR_YELLOW, 2294.1880, 554.8746, 7.7474, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // FISHER JOB LV
    CreateDynamic3DTextLabel("Join the Garbage Man job now\nwith /join", COLOR_YELLOW, 1713.2800, 1049.5554, 10.8203, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // GARBAGE MAN JOB LV
    CreateDynamic3DTextLabel("Join the Drug Smuggler job now\nwith /join", COLOR_YELLOW, 1692.1166, 917.9744, 10.7970, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // DRUG SMUGGLER JOB LV
    CreateDynamic3DTextLabel("Join the Gun Smuggler job now\nwith /join", COLOR_YELLOW, 2212.8438, 940.8475, 10.8203, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // GUN SMUGGLER JOB LV
    CreateDynamic3DTextLabel("Join the Mehanic job now\nwith /join", COLOR_YELLOW, 2383.9033, 1485.9469, 10.8203, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // MEHANIC JOB LV
    CreateDynamic3DTextLabel("Join the Farmer job now\nwith /join", COLOR_YELLOW, 289.1208, 1141.8276, 8.5859, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // FARMER JOB LV
    CreateDynamic3DTextLabel("Join the Miner job now\nwith /join", COLOR_YELLOW, 822.5881, 858.6284, 12.0469, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1); // MINER JOB LV

    //INFORMATION ICONDS FOR JOBS
    CreatePickup(1239, 23, 1704.91, 1302.10, 10.83, -1);
    CreatePickup(1239, 23, 2183.0159, 2295.1296, 10.8203, -1);
    CreatePickup(1239, 23, 2538.8462, 2076.7151, 11.1016, -1);
    CreatePickup(1239, 23, 2359.9363, 554.5175, 7.6619, -1);
    CreatePickup(1239, 23, 2294.1880, 554.8746, 7.7474, -1);
    CreatePickup(1239, 23, 1713.2800, 1049.5554, 10.8203, -1);
    CreatePickup(1239, 23, 1692.1166, 917.9744, 10.7970, -1);
    CreatePickup(1239, 23, 2212.8438, 940.8475, 10.8203, -1);
    CreatePickup(1239, 23, 2383.9033, 1485.9469, 10.8203, -1);
    CreatePickup(1239, 23, 289.1208, 1141.8276, 8.5859, -1);
    CreatePickup(1239, 23, 822.5881, 858.6284, 12.0469, -1);
    //1264
   
    //TRASH MAN PICKUPS
    Trash[0] = CreatePickup(1264, 2, 2035.4866, 1363.1678, 10.8203, -1);
    Trash[1] = CreatePickup(1264, 2, 2035.3230, 1373.0492, 10.8203, -1);
    Trash[2] = CreatePickup(1264, 2, 2035.1285, 1384.7987, 10.8125, -1);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    Trasher[playerid] = 0;
    HasTrash = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    Trasher[playerid] = 0;
    HasTrash = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/join", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, 1704.91, 1302.10, 10.83))
        {
            SendClientMessage(playerid,COLOR_YELLOW,"Good luck with you're new employemt! INFO: Enter a Taxi and use /starttrash");
            Trasher[playerid] = 1;
           
        }
        else
        {
       
            SendClientMessage(playerid,5,"ERROR: You're not near the Taxi job icon to join the taxi job!");
        }
        return 1;
    }
    if (strcmp("/starttrash", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInVehicle(playerid, 408))
        {
            if(Trasher[playerid] == 1)
            {
                SendClientMessage(playerid,4,"You have started you're trash mission! INFO: Find trash bags around Las Vegas, first time we help you.");
            }
            else
            {
                SendClientMessage(playerid,12,"You can't start a trash mission if you're not in a 'Trash Master'");
            }
        }
        return 1;
    }
    if (strcmp("/throw", cmdtext, true, 10) == 0)
    {
        if(Trasher[playerid] == 1)
        {
            if(HasTrash > 1)
            {
                new Float:XXO, Float:YXO, Float:ZXO;
                GetVehiclePos(408, XXO, YXO, ZXO);
                if(IsPlayerInRangeOfPoint(playerid, 1.5, XXO, YXO, ZXO))
                {
                    SendClientMessage(playerid, -1, "Good Job! Keep it up! You throwed a Trash bag.");
                    GivePlayerMoney(playerid, 1000);
                    HasTrash --;
                }
                else if(HasTrash == 0)
                {
                    SendClientMessage(playerid, -1, "You're not near any Trash Master or you don't have a Trash Bag.");
                }
            }
        }
        return 1;
    }
    if (strcmp("/mytrash", cmdtext, true, 10) == 0)
    {
        if(Trasher[playerid] == 1)
        {
            new string[64];
            format(string,sizeof(string),"You're trashes are: %d", HasTrash);
            SendClientMessage(playerid,0xFFFFFFAA,string);
        }
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(Trasher[playerid] == 1)
    {
        if(pickupid == Trash[0] || Trash[1] || Trash[2])
        {
            SetPlayerAttachedObject(playerid, 9, 1264, 1, -0.064613, 0.520760, 0.000000, 0.000000, 84.217391, 0.000000, 1.000000, 1.000000, 1.000000);
            ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 1, 1, 1, 1, 1);
            //SetTimer("Clearanim", 5000, false); // Set a timer of 5000 miliseconds (5 second)
            SendClientMessage(playerid,-1,"You're dragging a trash bag, walk to you're Trash Master and type: /throw .");
            HasTrash += 1;
        }
    }
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
public Clearanim(playerid)
{
    ClearAnimations(playerid);
    return 1;
}
Well if you pickup a Trashbag as a Trasher it works when you walk to the Trash Master and type /throw it won't work.
Reply
#2

Explain more please?
Reply
#3

Well.. If I go to join place I join it. Then I go inside a Trash Master and type, /starttrash it works, then you go to the pickups, you pick them. you walk to the Trash Master and type /throw no message nothing happends, No Money. Please help
Reply
#4

try
pawn Код:
if (strcmp("/throw", cmdtext, true, 10) == 0)
    {
        if(Trasher[playerid] == 1)
        {
            if(HasTrash > 1)
            {
                new Float:XXO, Float:YXO, Float:ZXO;
                GetVehiclePos(408, Float:XXO, Float:YXO, Float:ZXO);
                if(IsPlayerInRangeOfPoint(playerid, 2.0, XXO, YXO, ZXO))
                {
                    SendClientMessage(playerid, -1, "Good Job! Keep it up! You throwed a Trash bag.");
                    GivePlayerMoney(playerid, 1000);
                    HasTrash --;
                }
                else if(HasTrash == 0)
                {
                    SendClientMessage(playerid, -1, "You're not near any Trash Master or you don't have a Trash Bag.");
                }
            }
        }
        return 1;
    }
Reply
#5

Well its not working.
Reply
#6

Quote:
Originally Posted by Mey6155
Посмотреть сообщение
pawn Код:
GetVehiclePos(408, XXO, YXO, ZXO);
that's just wrong, the params of GetVehiclePos are: vehicleid, x, y, z
you're using the modelid instead od the vehicleid

do it like this, make a new var and assign the vehicleid of the car when the player types /starttrash to that var

example:
pawn Код:
new somevar[MAX_PLAYERS];

//in your starttrash cmd:
somevar[playerid] = GetVehicleID(playerid);

//in your /throw cmd, use somevar[playerid] instead of the model id:
GetVehiclePos(somevar[playerid],XXO, YXO, ZXO);
i'd also recommend making "HashTrash" a player specific variable. (as in HasTrash[playerid])
also, you should remove that filterscript stuff, like "OnFilterscriptInit"
you got stuff in OnGamemodeInit so im assuming that that's a GM not a FS.

you're also creating vehicles at the same spot, just sayin'
Reply
#7

Quote:
Originally Posted by CutX
Посмотреть сообщение
that's just wrong, the params of GetVehiclePos are: vehicleid, x, y, z
you're using the modelid instead od the vehicleid

do it like this, make a new var and assign the vehicleid of the car when the player types /starttrash to that var

example:
pawn Код:
new somevar[MAX_PLAYERS];

//in your starttrash cmd:
somevar[playerid] = GetVehicleID(playerid);

//in your /throw cmd, use somevar[playerid] instead of the model id:
GetVehiclePos(somevar[playerid],XXO, YXO, ZXO);
i'd also recommend making "HashTrash" a player specific variable. (as in HasTrash[playerid])
also, you should remove that filterscript stuff, like "OnFilterscriptInit"
you got stuff in OnGamemodeInit so im assuming that that's a GM not a FS.

you're also creating vehicles at the same spot, just sayin'
Well that guy in the last thread he said the vehicle id is 408 not model , so all my codes based on vehicle id 408
anyway he should store vehicle id on AddStaticVehicle in his case for ex
pawn Код:
new VEHXO = AddStaticVehicle(411, 2039.8792, 1339.7240, 10.6719, 179.8416, 0, 0);
and then
pawn Код:
GetVehiclePos(VEHXO,XXO, YXO, ZXO);
Reply
#8

It won't throw it.
Reply
#9

maybe you need to hold the garbage, swing it, and drop it.
Reply
#10

Aannd. How I do that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)