Floating Text/Road Sign
#1

Hi All,

I am very new to this, but really want to learn how to script basic things.

To start off, I'd like to script something like this:

On an RP server, to give the the police the ability to place signs such as 'SLOW, POLICE INCIDENT' or 'SPEED ENFORCEMENT OFFICER AHEAD'. The sign may not be a physical sign, however a floating white text (the same look of text as usernamename text) that would be positioned above a road cone. (object 1237)

The sign/cone would be deployed with /sign (and removed with /rsign) then a dialogue box would appear in the centre of the screen. You can then type your message here, such as 'DIVERSION, TURN RIGHT' or 'ALL TRAFFIC SLOW'

Additional features would be changing text colour with [r] to turn the text red, to turn the text blue. Perhaps # for a new line.

Possibly set an automatic sign de-spawn of 25 minutes if the officer does not /rsign, if this is not too confusing for a beginner.

Looks something like this perhaps?


A step by step guide would be really useful.

Sorry if this is in the wrong section.

I can imagine it would be something along the lines of ifplayertypes "/sign" then createobject 1237 etc etc.. but don't know how to deal with dialogue boxes, or the floating text?


Much appreciated!
Reply
#2

For example just like this:

PHP код:
//@top of the script:
enum e_VALUES {
    
sign,
    
Text3D:s_ID
};
new 
sings[MAX_PLAYERS][e_VALUES];
//OnPlayerDisconnect:
if(sings[playerid][sign] != 0)
{
    
DestroyObject(signs[playerid][sign]);
    
Delete3DTextLabel(signs[playerid][s_ID]);
    
signs[playerid][sign] = 0;
}
CMD:sign(playerid)
{
    if(
sings[playerid][sign] != 0) return SendClientMessage(playerid,-1,"Please first destroy your sign /rsign");
    return 
ShowPlayerDialog(playerid,500,DIALOG_STYLE_INPUT,"{FF0000}Road Sign","{FFFFFF}Please enter the text for your road sign:","confirm","abort");
}
//Then in OnPlayerDialogResponse
if(dialogid == 500)
{
    if(!
response) return 1//here he pressed abort
    
if(!inputtext[0]) return 1//here the text he entered was empty
    
new Float:x,Float:y,Float:z,Float:a;
    
GetPlayerPos(playerid,x,y,z),GetPlayerFacingAngle(playerid,a);
    const 
Float:distance 2.0;
    
+= distance floatsin(-a,degrees), y+=distance floatcos(-adegrees); //So that the sign is created in the front
    
sings[playerid][sign] = CreateObject(1237,x,y,z,0,0,a);
    
sings[playerid][s_ID] = Create3DTextLabel(inputtext,-1,x,y,z+0.75,40.000);
}
//And if you wanna delete it
CMD:rsign(playerid)
{
    if(!
sings[playerid][sign]) return SendClientMessage(playerid,-1,"You didn't created a sign!");
    
DestroyObject(signs[playerid][sign]);
    
Delete3DTextLabel(signs[playerid][s_ID]);
    
signs[playerid][sign] = 0;
    return 
1;

Reply
#3

Thanks for the reply.

However I am a noob, so don't 100% follow this.
Reply
#4

error sings, sign help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)