Script Request Thread #4

Heh, it's so easy to say, "Create your own gamemod"
I do not know the true mode of 0
I do not know what we all need and how to go
Reply

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
There isn't one, as far as I know, plus there are far better gamemodes, Godfather is used way too much, make your own gamemode!
Next person to re-create GF should get banned from forums && Slapped with a trout D:
Reply

Can someone script this for me?

Like real time but

12 in real life hours = 1 in game day?

and that it doesn't jumps from 1 hour to another when 30 minutes goes away, i want it to jump from 6:59 to 7

in the server i script the time is ok but the hour jumps like 30 minutes passes away and the hour jumps from 6 to 7 instead 6:59 to 7

so i want it 12 irl hours = 1 IG day
Reply

I'm request Taxi job for my script
Reply

How much do you pay?
Reply

I need a script to make my RP server done.

/changename
or
/setname

Please help. I really need this script.

Many thanks! Miricx.
Reply

Dont doublepost..

SetPlayerName search on wiki.
Reply

Well i dont want to change name to /superman.

I want to have the script to change to anything.
Reply

Okay, so I have created an admin chat command (/admin), but I wanted to do something else...

I wanted to make it where I can press "F6" and it pops up the black box, then I can do "@[message]" and the script will send that "[message]" to all of the online admins. I do not want a "/" involved, just needing to do "@". I know it's possible with "public OnPlayerText", but I'm not sure how to do it. Any ideas?
Reply

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Check the first cell of the text[] param in OnPlayerText and see if it equals '@' then make the string after this send to admins with a loop and if statement.

hope that helps, if you want a code I'll write one :P
Sorry man, but I'm still learning these things. If you could write the code this time for me, I'd really appreciate it!
Reply

pawn Код:
if( text[0] == '@' )
{
    //if first character is '@', do stuff
}
Reply

Quote:
Originally Posted by LarzI
Посмотреть сообщение
pawn Код:
if( text[0] == '@' )
{
    //if first character is '@', do stuff
}
Thank you. This is what I get now.

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '@')
    {
        new Message[128];
        if(sscanf(params, "s[128]", Message))
        {
            if( PlayerStatistics[playerid][pAdminLevel] >= 1)
            {
                SendClientMessage( playerid, COLOR_WHITE, "SYNTAX: @ [message]" );
            }
        }
        else
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnectedEx(i))
                {
                    if(PlayerStatistics[i][pAdminLevel] >= 1)
                    {
                        new admtext[128], admin_string[128], name[MAX_PLAYER_NAME];
                        name = GetName(playerid);
                        if(PlayerStatistics[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 4) { admtext = "Server Developer"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 3) { admtext = "Lead Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 2) { admtext = "Game Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 1) { admtext = "Moderator"; }

                        format(admin_string, sizeof( admin_string ), "[%s] %s(%d): %s", admtext, name, playerid, Message );
                        SendAdminMessage(COLOR_LIGHTBLUE, admin_string, 1);
                        print(admin_string);
                    }
                }
            }
        }
    }
    else
    {
        return 1;
    }
    return 1;
}
I know it's because I do not have the 'params' in "OnPlayerText", but I don't know how to fix it.
Reply

I request cmd /refuel in this script just in place gas station
Quote:

#include <a_samp>
new Text:td_fuel[MAX_PLAYERS];
new Text:td_vhealth[MAX_PLAYERS];
new Text:td_vspeed[MAX_PLAYERS];
new Text:td_box[MAX_PLAYERS];

forward timer_update();
forward timer_refuel(playerid);
new isrefuelling[MAX_PLAYERS] = 0;
new fuel[MAX_VEHICLES];
new Float:max_vhealth[MAX_VEHICLES];

public OnFilterScriptInit()
{
for(new i=0;i<MAX_VEHICLES;i++) {
GetVehicleHealth(i,max_vhealth[i]); //getting max health
fuel[i] = 250 + random(150); //setting fuel for vehicles
}

for(new i=0;i<MAX_PLAYERS;i++) { //setting up all textdraws
td_fuel[i] = TextDrawCreate(476,355,"Fuel:");
td_vhealth[i] = TextDrawCreate(478,376,"Health:");
td_vspeed[i] = TextDrawCreate(478,397,"Speed:");
td_box[i] = TextDrawCreate(478.000000,328.000000,"Vehicle Stats: ~n~~n~~n~~n~");
TextDrawUseBox(td_box[i],1);
TextDrawBoxColor(td_box[i],0x00000066);
TextDrawTextSize(td_box[i],626.000000,21.000000);
TextDrawAlignment(td_fuel[i],0);
TextDrawAlignment(td_vhealth[i],0);
TextDrawAlignment(td_vspeed[i],0);
TextDrawAlignment(td_box[i],0);
TextDrawBackgroundColor(td_fuel[i],0x000000ff);
TextDrawBackgroundColor(td_vhealth[i],0x000000ff);
TextDrawBackgroundColor(td_vspeed[i],0x000000ff);
TextDrawBackgroundColor(td_box[i],0x000000cc);
TextDrawFont(td_fuel[i],1);
TextDrawLetterSize(td_fuel[i],0.699999,2.699999);
TextDrawFont(td_vhealth[i],1);
TextDrawLetterSize(td_vhealth[i],0.699999,2.699999);
TextDrawFont(td_vspeed[i],1);
TextDrawLetterSize(td_vspeed[i],0.699999,2.699999);
TextDrawFont(td_box[i],0);
TextDrawLetterSize(td_box[i],0.699999,2.899999);
TextDrawColor(td_fuel[i],0xffffffff);
TextDrawColor(td_vhealth[i],0xffffffff);
TextDrawColor(td_vspeed[i],0xffffffff);
TextDrawColor(td_box[i],0xffffffff);
TextDrawSetOutline(td_fuel[i],1);
TextDrawSetOutline(td_vhealth[i],1);
TextDrawSetOutline(td_vspeed[i],1);
TextDrawSetOutline(td_box[i],1);
TextDrawSetProportional(td_fuel[i],1);
TextDrawSetProportional(td_vhealth[i],1);
TextDrawSetProportional(td_vspeed[i],1);
TextDrawSetProportional(td_box[i],1);
TextDrawSetShadow(td_fuel[i],1);
TextDrawSetShadow(td_vhealth[i],1);
TextDrawSetShadow(td_vspeed[i],1);
TextDrawSetShadow(td_box[i],10);
}
SetTimer("timer_update",1000,true);
return 1;
}

public OnFilterScriptExit()
{
for(new i=0;i<MAX_PLAYERS;i++) {
TextDrawDestroy(td_fuel[i]);
TextDrawDestroy(td_vhealth[i]);
TextDrawDestroy(td_vspeed[i]);
TextDrawDestroy(td_box[i]);
}
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{

TextDrawSetString(td_fuel[playerid],"Fuel:");
TextDrawSetString(td_vhealth[playerid],"Health:");
TextDrawSetString(td_vspeed[playerid],"Speed:");

TextDrawShowForPlayer(playerid,td_fuel[playerid]);
TextDrawShowForPlayer(playerid,td_vspeed[playerid]);
TextDrawShowForPlayer(playerid,td_vhealth[playerid]);
TextDrawShowForPlayer(playerid,td_box[playerid]);
} else {
TextDrawHideForPlayer(playerid,td_fuel[playerid]);
TextDrawHideForPlayer(playerid,td_vspeed[playerid]);
TextDrawHideForPlayer(playerid,td_vhealth[playerid]);
TextDrawHideForPlayer(playerid,td_box[playerid]);
}
return 1;
}


public OnPlayerCommandText(playerid,cmdtext[]) {

if (!strcmp("/refuel",cmdtext,true,7)) {

if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!"); //if a player isnt in a vehicle, it stops here
if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"You are already refuelling!"); //if a player is already refuelling, it stops here
if (GetPlayerMoney(playerid) - 80 <0) return SendClientMessage(playerid,0xFFC800FF,"You dont have enough money!"); //if a player doesnt have $80 anymore, it stops here
GivePlayerMoney(playerid,-80); //Sets the player's cash -$80
SetCameraBehindPlayer(playerid); //Sets the camera behind the player (looks better because the player will be frozen for a few secs)
TogglePlayerControllable(playerid,0); //freezes the player so he cant drive and refuel at the same time
isrefuelling[playerid] = 1; //setting isrefuelling to 1 so the player cant spam /refuel
TextDrawSetString(td_fuel[playerid],"Refuelling..."); //changing textdraw to /refuel
SetTimerEx("timer_refuel",4500,false,"i",playerid) ; //setting refueltimer
return 1;
}

return 0;
}

public timer_update()
{
for(new i=0;i<MAX_PLAYERS;i++) {
if (isrefuelling[i]) return 0;
new vid = GetPlayerVehicleID(i);
if (GetPlayerVehicleSeat(i) == 0) {
fuel[vid] = fuel[vid] - 2;
if (fuel[vid]<1)
{
fuel[vid] = 0;
RemovePlayerFromVehicle(i);
GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4);
}
}
new string[128];format(string,sizeof string,"Fuel: %i",fuel[vid] /4);
TextDrawSetString(td_fuel[i],string);

new Floatpeed_x,Floatpeed_y,Floatpeed_z,Float:te mp_speed,final_speed,Float:health;

GetVehicleVelocity(vid,speed_x,speed_y,speed_z);
temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+ (speed_z*speed_z))*136.666667;
final_speed = floatround(temp_speed,floatround_round);
format(string,sizeof string,"Speed: %i",final_speed);
TextDrawSetString(td_vspeed[i],string);

GetVehicleHealth(vid,health);
if (max_vhealth[vid] == 0)//if its an random spawned vehicle
{
fuel[vid] = 400;
GetVehicleHealth(vid,max_vhealth[vid]);
}
health = (((health - max_vhealth[vid]) /max_vhealth[vid]) *100)+ 100;
format(string,sizeof string,"Health: %i",floatround(health,floatround_round));
TextDrawSetString(td_vhealth[i],string);
}
return 1;
}

public timer_refuel(playerid)
{
new vid = GetPlayerVehicleID(playerid);
fuel[vid] = fuel[vid] = 400;
isrefuelling[playerid] = 0;
TextDrawSetString(td_fuel[playerid],"Fuel:100");
TogglePlayerControllable(playerid,1);
}

Reply

Quote:

Next person to re-create GF should get banned from forums && Slapped with a trout D:

Why banned
Reply

Can someone script this for me?

Like real time but

12 in real life hours = 1 in game day?

and that it doesn't jumps from 1 hour to another when 30 minutes goes away, i want it to jump from 6:59 to 7

in the server i script the time is ok but the hour jumps like 30 minutes passes away and the hour jumps from 6 to 7 instead 6:59 to 7

so i want it 12 irl hours = 1 IG day
Reply

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
RealCop228/Nick, the params parameter in the sscanf is the string you are splitting for the variables, so in this case it would be 'text' which is the string that the player entered.
Thanks again, Southclaw. This is what I currently have.

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '@')
    {
        new Message[128];
        if(sscanf(text, "s[128]", Message))
        {
            if( PlayerStatistics[playerid][pAdminLevel] >= 1)
            {
                SendClientMessage( playerid, COLOR_WHITE, "SYNTAX: @ [message]" );
            }
        }
        else
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnectedEx(i))
                {
                    if(PlayerStatistics[i][pAdminLevel] >= 1)
                    {
                        new admtext[128], admin_string[128], name[MAX_PLAYER_NAME];
                        name = GetName(playerid);
                        if(PlayerStatistics[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 4) { admtext = "Server Developer"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 3) { admtext = "Lead Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 2) { admtext = "Game Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 1) { admtext = "Moderator"; }

                        format(admin_string, sizeof( admin_string ), "[%s] %s(%d): %s", admtext, name, playerid, Message );
                        SendAdminMessage(COLOR_LIGHTBLUE, admin_string, 1);
                        print(admin_string);
                    }
                }
            }
        }
    }
    else
    {
        return 1;
    }
    return 1;
}
However it will send a message via the normal chat, as well as the admin chat. How can I make it specific to admin chat?
Reply

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Thanks again, Southclaw. This is what I currently have.

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '@')
    {
        new Message[128];
        if(sscanf(text, "s[128]", Message))
        {
            if( PlayerStatistics[playerid][pAdminLevel] >= 1)
            {
                SendClientMessage( playerid, COLOR_WHITE, "SYNTAX: @ [message]" );
            }
        }
        else
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnectedEx(i))
                {
                    if(PlayerStatistics[i][pAdminLevel] >= 1)
                    {
                        new admtext[128], admin_string[128], name[MAX_PLAYER_NAME];
                        name = GetName(playerid);
                        if(PlayerStatistics[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 4) { admtext = "Server Developer"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 3) { admtext = "Lead Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 2) { admtext = "Game Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 1) { admtext = "Moderator"; }

                        format(admin_string, sizeof( admin_string ), "[%s] %s(%d): %s", admtext, name, playerid, Message );
                        SendAdminMessage(COLOR_LIGHTBLUE, admin_string, 1);
                        print(admin_string);
                    }
                }
            }
        }
    }
    else
    {
        return 1;
    }
    return 1;
}
However it will send a message via the normal chat, as well as the admin chat. How can I make it specific to admin chat?
You must return '0' in order for the text not to be send (Via standard build-in chat), so you'd be most likely want to do it just after "print(admin_string);"
Reply

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
You must return '0' in order for the text not to be send (Via standard build-in chat), so you'd be most likely want to do it just after "print(admin_string);"
Okay, so I changed it and it now works. The only other thing is it will leave the "@" in the message. My code...

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '@')
    {
        new Message[128];
        if(sscanf(text, "s[128]", Message))
        {
            if(PlayerStatistics[playerid][pAdminLevel] >= 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /(a)dmin [message]");
            }
        }
        else
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnectedEx(i))
                {
                    if(PlayerStatistics[i][pAdminLevel] >= 1)
                    {
                        new admtext[128], name[MAX_PLAYER_NAME], string[128];
                        name = GetName(playerid);
                        if(PlayerStatistics[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 4) { admtext = "Server Developer"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 3) { admtext = "Lead Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 2) { admtext = "Game Admin"; }
                        else if(PlayerStatistics[i][pAdminLevel] == 1) { admtext = "Moderator"; }
                        format(string, sizeof(string), "[%s] %s(%d): %s", admtext, name, playerid, Message );
                        SendAdminMessage(COLOR_LIGHTBLUE, string, 1);
                        print(string);
                        return 0;
                    }
                }
            }
        }
    }
    else
    {
        return 1;
    }
    return 1;
}
Reply

Can someone script this for me?

Like real time but

12 in real life hours = 1 in game day?

and that it doesn't jumps from 1 hour to another when 30 minutes goes away, i want it to jump from 6:59 to 7

in the server i script the time is ok but the hour jumps like 30 minutes passes away and the hour jumps from 6 to 7 instead 6:59 to 7

so i want it 12 irl hours = 1 IG day
Reply

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
@stix that already exists I believe, check the search look for 'Clock filterscript' or something similar

@Realcop erm I'm not sure about that, you might be able to remove that with strdel
I was thinking you can put in the format 'message[1]' but that will only insert the second character, not all the text from the second character, I think that anyway.

Try the strdel method anyway, will be message then start 0 end 1 I think :P
This is a lot of work to do one thing... Maybe I'll just stick with the old "/a" method!
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)