SA-MP Forums Archive
Need help in a command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help in a command (/showthread.php?tid=352291)



Need help in a command - RyanPetersons - 19.06.2012

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


Re: Need help in a command - Stefand - 19.06.2012

Hangon will make one.


Re: Need help in a command - RyanPetersons - 19.06.2012

Can you make it fast? and post it here fastly?


Re: Need help in a command - Stefand - 19.06.2012

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?


Re: Need help in a command - RyanPetersons - 19.06.2012

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


Re: Need help in a command - [MM]RoXoR[FS] - 19.06.2012

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;
}



Re: Need help in a command - FUNExtreme - 19.06.2012

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


Re: Need help in a command - RyanPetersons - 19.06.2012

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


Re: Need help in a command - FUNExtreme - 19.06.2012

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.


Re: Need help in a command - RyanPetersons - 19.06.2012

No there is no command saved as rpname