SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/10/2019, 10:48 PM   #1
TAKTAK26
Little Clucker
 
Join Date: Nov 2018
Posts: 24
Reputation: 0
Default Command Errors

hello could you help not solve this server shuts down when you type this command?


pawn Code:
CMD:yeniesya(playerid, params[])
{
    if (!IsPlayerAdmin(playerid))
    {
        return SendClientMessage(playerid, 6, "{FFFF00}[HATA] {FFFFFF} Bu Komutu Kullanabilmek išin Y÷netici olmanız gerekir.");
    }

    new itemName[MAX_ITEM_NAME], itemModelid;
    if (sscanf(params, "is[64]", itemModelid, itemName))
    {
        return SendClientMessage(playerid, 6, "{6699FF}[KULLANIM] {FFFFFF}/yeniesya [Model ID] [Eşya İsim]");
    }

    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    new Float:ang;
    GetPlayerFacingAngle(playerid, ang);
    x += (1.5 * floatsin(-ang, degrees));
    y += (1.5 * floatcos(-ang, degrees));
    new itemid = Inv_AddItem(itemModelid, itemName, x, y, z);
    if (itemid == -1)
    {
        return SendClientMessage(playerid, COLOR_TOMATO, "{FFFF00}[HATA] Başka Íğe ekleyemezsiniz, envanter dolu!");
    }

    new string[128];
    format(string, sizeof string, "{6699FF}[ENVANTER] {FFFFFF}Oluşturulan Íğe: %s [Eşya ID: %i | Model ID: %i]", itemName, itemid, itemModelid);

    createdItems[createdItemsCount++] = itemid;
    SendClientMessage(playerid, 8, "{6699FF}[BILGI] {FFFFFF}/esya listesine eklenen ÷ğe, Bu ÷ğeyi šoğaltmak istiyorsanız, /esyaekle yazın.");
    return 1;
}
TAKTAK26 is offline   Reply With Quote
Old 11/10/2019, 01:18 AM   #2
KittyChloe
Little Clucker
 
KittyChloe's Avatar
 
Join Date: Oct 2019
Posts: 26
Reputation: 13
Default Re: Command Errors

Most likely this line:

new itemid = Inv_AddItem(itemModelid, itemName, x, y, z);


Can you show us the snippet for that function?
__________________
KittyChloe is offline   Reply With Quote
Old 11/10/2019, 03:50 AM   #3
TAKTAK26
Little Clucker
 
Join Date: Nov 2018
Posts: 24
Reputation: 0
Default Re: Command Errors

pawn Code:
Inv_AddItem(modelid, const name[], Float:x, Float:y, Float:z, Float:rx = 0.0, Float:ry = 0.0, Float:rz = 0.0)
{
    new index = -1;
    for (new i; i < MAX_ITEMS; i++)
    {
        if (!item[i][E_ITEM_VALID])
        {
            index = i;
            break;
        }
    }

    if (index == -1)
    {
        return -1;
    }

    if (index > itemPoolSize)
    {
        itemPoolSize = index;
    }

    item[index][E_ITEM_VALID] = true;

    format(item[index][E_ITEM_NAME], MAX_ITEM_NAME, name);

    CA_FindZ_For2DCoord(x, y, z);
    item[index][E_ITEM_OBJECTID] = CreateDynamicObject(modelid, x, y, z, rx, ry, rz);

    new Float:unused, Float:radius;
    CA_GetModelBoundingSphere(modelid, unused, unused, unused, radius);
    CA_DestroyObject(index);
    new BaslatX, BaslatY, BaslatZ, SonX, SonY, SonZ, Float:sayiX, Float:sayiY, Float:sayiZ;
    CA_RayCastLine(BaslatX, BaslatY, BaslatZ, SonX, SonY, SonZ, sayiX, sayiY, sayiZ);
    item[index][E_ITEM_AREAID] = CreateDynamicCircle(x, y, radius + 2.0);

    item[index][E_ITEM_ROTX] = rx;
    item[index][E_ITEM_ROTY] = ry;
    item[index][E_ITEM_ROTZ] = rz;

    item[index][E_ITEM_ZPUSH] = 0.0;

    item[index][E_ITEM_PLAYERID] = INVALID_PLAYER_ID;

    item[index][E_ITEM_MODELID] = modelid;
    return index;
}

I threw.
TAKTAK26 is offline   Reply With Quote
Old 11/10/2019, 04:57 PM   #4
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 327
Reputation: 22
Default Re: Command Errors

Btw, i just noticed something that you missed to use SendClientMessage for this string format
Code:
    new string[128];
    format(string, sizeof string, "{6699FF}[ENVANTER] {FFFFFF}Oluşturulan Íğe: %s [Eşya ID: %i | Model ID: %i]", itemName, itemid, itemModelid);
SendClientMessage(playerid, -1, string);

   // can be -1 since you use RBG formats
   SendClientMessage(playerid, -1, "{6699FF}[BILGI] {FFFFFF}/esya listesine eklenen ÷ğe, Bu ÷ğeyi šoğaltmak istiyorsanız, /esyaekle yazın.");
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun
SiaReyes is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/me command errors Eymeric69 Scripting Help 4 29/05/2016 05:28 PM
Errors with this command Rydur Scripting Help 9 02/01/2014 02:06 PM
Command Errors. Need help. Champ Scripting Help 6 05/07/2013 08:30 AM
Command Errors San1 Scripting Help 1 28/06/2013 06:24 AM
Errors with a command. MrSnapp Scripting Help 2 03/12/2012 09:08 AM


All times are GMT. The time now is 06:52 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.