Need help in a command
#1

Do you know how to make a /rpname [Firstname_Lastname] command

I mean if we do /rpname Ryan_Petersons then it Attachesa3DTextLabelToPlayer of "Ryan_Petersons", till he gets offline? If you guys know that how to make this command then make me it, i hope it would take 1 min or 2 mins
Reply
#2

Hangon will make one.
Reply
#3

Can you make it fast? and post it here fastly?
Reply
#4

pawn Код:
command(rpname, playerid, params[])
{
    new id, NewName[MAX_PLAYER_NAME];
    if(sscanf(params, "uz", id, NewName))
    {
        SetPlayerName(id, NewName);
    }
    return 1;
}
this is what you mean?
Reply
#5

LOL Not this, I mean if we do /rpname Ryan_Petersons then it Attachesa3DTextLabelToPlayer of "Ryan_Petersons", till he gets offline?
Reply
#6

UNTESTED
At the top add
pawn Код:
//------------------DCMD---------------------
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

new Text3D:rpnametext[MAX_PLAYERS];
Now under OnPlayerCommandText(playerid, cmdtext[])

pawn Код:
dcmd(rpname,6,cmdtext);
Then anywhere add
pawn Код:
dcmd_rpname(playerid,params[])
{
    new text[50];
    if (sscanf(params,"s[50]",text))return SendClientMessage(playerid, -1, "USAGE : /rpname [Firstname_Lastname]]");
    else if(strfind(text,"_",true)== -1) return SendClientMessage(playerid, -1, "USAGE : /rpname [Firstname_Lastname]]");
    else
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        rpnametext[playerid] = Create3DTextLabel(text,-1,x,y,z,10,GetPlayerVirtualWorld(playerid),0);
        Attach3DTextLabelToPlayer(rpnametext[playerid],playerid,0,0,0);
    }
    return 1;

}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    Delete3DTextLabel(rpnametext[playerid]);
    return 1;
}
Reply
#7

Create a variable for a text label, like: new Text3D:Label[MAX_PLAYERS];

Then when he connects you create a label, with some random text at location 0.0, 0.0, 0.0
Like: Label[playerid] = Create3DTextLabel(...);

When the players uses the command you update the text to the one that was in the command and attach it to the player.
Attach3DTextLabelToPlayer and Update3DTextLabelText

When the player disconnects you just Delete3DTextLabel(Label[playerid]);


EDIT: What the guy above me said
Reply
#8

RoXor, when i go ingame and i type rpname it says "You have resigned the job".
Reply
#9

Short answer, that means you have another command called rpname or something.. Otherwise your comment makes no sense at all, but if you actually TRIED solving it yourself. You would search your script for that message and see WHY it comes up.
Reply
#10

No there is no command saved as rpname
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)