[Include] cSelection - Class Selection Textdraws
#1

Creating a good selection is a problem for beginners. Also using GameText will sucks. You can use Textdraws also but making it dynamic is not a good point for newbies.

So i made a one Library. which allows you to create a better Class Selection Informations.

Here is a one showcase picture :


i Think this will be very good for CnR Servers!

So let's use this

We Have these functions*:
pawn Код:
native cS_Show(playerid);
native cS_Hide(playerid);
native cS_Update(playerid, color, teamName[], cInfo[]);
* They aren't native, just for showing in right side of Pawno

Functions

cS_Show(playerid);
@param int playerid The player id to show him the cSelection Textdraws
Example :
pawn Код:
if(!gcSDisplayed[playerid])
    {
        cS_Show(playerid);
    }


cS_Hide(playerid);
@param int playerid The player id to hide for him the cSelection Textdraws
Example :
pawn Код:
if(gcSDisplayed[playerid])
    {
        cS_Hide(playerid);
    }


cS_Update(playerid, color, teamName[], cInfo[]);
@param int playerid The player id to update for him the cSelection Textdraws
@param int color The color of the team
@param string teamName[] The Team name
@param string cInfo[] The information about the class

Example :
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    cS_Update(playerid, 0x4682B4FF, "Los Santos National Guard", "~g~]~p~ can drive fighting vehicles such as seasparrow, hydra, hunter and rhino~s~~n~~g~]~p~ full armour on spawn~s~~n~~g~]~p~ sell weapons with /wsell");
    return 1;
}
Here is a good example Test GM :


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

main()
{
    print("test GM - iFarbod");
}

public OnGameModeInit()
{
    SetGameModeText("tEST Script By iFarbod");
    AddPlayerClass(287, 2775.2332, -2392.3889, 18.9217, 102.8251, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if(!gcSDisplayed[playerid])
    {
        cS_Show(playerid);
    }
    SetPlayerPos(playerid, 2775.2332, -2392.3889, 18.9217);
    SetPlayerFacingAngle(playerid, 102.8251);
    SetPlayerCameraPos(playerid, 2766.7046, -2392.4436, 22.5008);
    SetPlayerCameraLookAt(playerid, 2767.7019, -2392.4026, 22.0358);
    ApplyAnimation(playerid, "PED", "FUCKU", 4.0, 1, 0, 0, 0, 0);
    cS_Update(playerid, 0x4682B4FF, "Los Santos National Guard", "~g~]~p~ can drive fighting vehicles such as seasparrow, hydra, hunter and rhino~s~~n~~g~]~p~ full armour on spawn~s~~n~~g~]~p~ sell weapons with /wsell~s~~n~] needs 50000 score to join");
    return 1;
}
Reply
#2

Anyone?
Reply
#3

Really Nice ! One +REP For You
Reply
#4

pawn Код:
gcSClassInfo[playerid] = CreatePlayerTextDraw(playerid, 10.000000, 183.500000, "] has access to hq~n~] can plant bomb on grove~n~] can team up with rifa, russian mafia and vagos");
Why?

Also using the value defined with "INVALID_PLAYER_ID" for "playerid" will crash at your functions.
Reply
#5

Quote:
Originally Posted by BigETI
Посмотреть сообщение
pawn Код:
gcSClassInfo[playerid] = CreatePlayerTextDraw(playerid, 10.000000, 183.500000, "] has access to hq~n~] can plant bomb on grove~n~] can team up with rifa, russian mafia and vagos");
Why?

Also using the value defined with "INVALID_PLAYER_ID" for "playerid" will crash at your functions.
Are you used it?
OnPlayerConnect Hooked with ALS! Not any errors at compiling!
Reply
#6

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
Are you used it?
OnPlayerConnect Hooked with ALS! Not any errors at compiling!
Compiling code without any errors and warnings doesn't make it crash safe at runtime.
I was hinting to different issues within your include you should improve, so you can avoid future complaints.
Please read more carefully next time.

Also you can improve your hooks by using better methods, for example https://sampforum.blast.hk/showthread.php?tid=441293
Reply
#7

I dont like it, because i have seen this before....
Oooh yeah i see, i am using the same textdraw design for my GUI.
Nice Copy...
Reply
#8

Quote:
Originally Posted by BigETI
Посмотреть сообщение
Compiling code without any errors and warnings doesn't make it crash safe at runtime.
I was hinting to different issues within your include you should improve, so you can avoid future complaints.
Please read more carefully next time.

Also you can improve your hooks by using better methods, for example https://sampforum.blast.hk/showthread.php?tid=441293
Hasn't any crashes at runtime! I like this style for hooking! no one forces you to use this!

Quote:
Originally Posted by Admigo
Посмотреть сообщение
I dont like it, because i have seen this before....
Oooh yeah i see, i am using the same textdraw design for my GUI.
Nice Copy...
I don't see things like this! this is created from scratch! If you don't want to download it, don't talk bad about it!
Reply
#9

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
Hasn't any crashes at runtime! I like this style for hooking! no one forces you to use this!



I don't see things like this! this is created from scratch! If you don't want to download it, don't talk bad about it!
We all have our own opinion. Respect that.
Reply
#10

Good include, very simple system.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)