[SUGGESTION] Inventory System
#1

Hello everyone!, i was scripting a gamemode and i wanted to do some nice inventory system, a little bit different from what you see around. I Recentley played in a server where you got your house, veh key and everything in your inventory. (I'm posting a screen a little bit down the thread) and i wanted to get some advice on how to make a similar system because i really liked it. I Don't need the whole script. Just a little example and some words should be enough.


Screen Here
Reply
#2

You will need to create a TextDraw and update the text, just like this example:

https://sampwiki.blast.hk/wiki/TextDrawCreate
https://sampwiki.blast.hk/wiki/TextDrawDestroy
https://sampwiki.blast.hk/wiki/TextDrawSetString

pawn Код:
#include <a_samp>
#include <zcmd>

new Text:invTD[MAX_PLAYERS], var[MAX_PLAYERS][3], invTimer[MAX_PLAYERS];

public OnPlayerConnect(playerid){
    invTD[playerid] = TextDrawCreate(240.0,580.0,"Inventory\n");
    UpdateInvTD(playerid);
    TextDrawShowForPlayer(playerid, invTD[playerid]);
   
    invTimer[playerid] = SetTimerEx("UpdateInvTD", 3000, true, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason){
    TextDrawHideForPlayer(playerid, invTD[playerid]);
    TextDrawDestroy(invTD[playerid]);
   
    KillTimer(invTimer[playerid]);
    return 1;
}

forward UpdateInvTD(playerid);
public UpdateInvTD(playerid){
    new longStr[300];
    if(var[playerid][1] == 1) //change to your vars
    {
        format(longStr, sizeof(longStr), "%sVar 1\n");
    }
   
    if(var[playerid][2] == 2) //change to your vars
    {
        format(longStr, sizeof(longStr), "%sVar 2");
    }
   
    TextDrawSetString(invTD[playerid], longStr);

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)