Script Request Thread #5

Quote:
Originally Posted by nor15
View Post
need an eject command eg: /eject [ID]
ZCMD:
pawn Code:
CMD:eject(playerid, params[])
{
    new uID;
    if(sscanf(params, "u", uID)) return  SendClientMessage(playerid, -1,"Usage: /eject [playerid]");
    if(!IsPlayerConnected(uID)) return SendClientMessage(playerid, -1, "ERROR: This player isn't connected");
    if(!IsPlayerInAnyVehicle(uID)) return SendClientMessage(playerid, -1, "ERROR: The player isn't in any vehicle");

    new Float:xposs, Float:y, Float:z;
    RemovePlayerFromVehicle(uID);
    GetPlayerPos(uID, xposs, y, z);
    SetPlayerPos(uID, xposs, y, z + 3);
    SendClientMessage(uID, -1, "You have been ejected from the vehcile");
    SendClientMessage(playerid, -1, "Player ejected");
    return 1;
}
STRCMP:
pawn Code:
if(!strcmp(cmdtext, "/eject", true))
{
    new tmp[128], uID;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return  SendClientMessage(playerid, -1,"Usage: /eject [playerid]");
    uID = strval(tmp);
   
    if(!IsPlayerConnected(uID)) return SendClientMessage(playerid, -1, "ERROR: This player isn't connected");
    if(!IsPlayerInAnyVehicle(uID)) return SendClientMessage(playerid, -1, "ERROR: The player isn't in any vehicle");

    new Float:xposs, Float:y, Float:z;
    RemovePlayerFromVehicle(uID);
    GetPlayerPos(uID, xposs, y, z);
    SetPlayerPos(uID, xposs, y, z + 3);
    SendClientMessage(uID, -1, "You have been ejected from the vehcile");
    SendClientMessage(playerid, -1, "Player ejected");
    return 1;
}
PS: For strcmp you need:

This function:
pawn Code:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
To add this to the OnPlayerCommandText callback(at the beginning of the callback):
pawn Code:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
Quote:
Originally Posted by James Coral
View Post
i need save and load cash code
Depends on what Save System are you using..
Reply

Quote:
Originally Posted by Roach_
View Post
ZCMD:
pawn Code:
CMD:eject(playerid, params[])
{
    new uID;
    if(sscanf(params, "u", uID)) return  SendClientMessage(playerid, -1,"Usage: /eject [playerid]");
    if(!IsPlayerConnected(uID)) return SendClientMessage(playerid, -1, "ERROR: This player isn't connected");
    if(!IsPlayerInAnyVehicle(ID)) return SendClientMessage(playerid, -1, "ERROR: The player isn't in any vehicle");

    new Float:xposs, Float:y, Float:z;
    RemovePlayerFromVehicle(uID);
    GetPlayerPos(ID, xposs, y, z);
    SetPlayerPos(ID, xposs, y, z + 3);
    SendClientMessage(uID, -1, "You have been ejected from the vehcile");
    SendClientMessage(playerid, -1, "Player ejected");
    return 1;
}
STRCMP:
pawn Code:
if(!strcmp(cmdtext, "/eject", true))
{
    new tmp[128], uID;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return  SendClientMessage(playerid, -1,"Usage: /eject [playerid]");
    uID = strval(tmp);
   
    if(!IsPlayerConnected(uID)) return SendClientMessage(playerid, -1, "ERROR: This player isn't connected");
    if(!IsPlayerInAnyVehicle(ID)) return SendClientMessage(playerid, -1, "ERROR: The player isn't in any vehicle");

    new Float:xposs, Float:y, Float:z;
    RemovePlayerFromVehicle(uID);
    GetPlayerPos(ID, xposs, y, z);
    SetPlayerPos(ID, xposs, y, z + 3);
    SendClientMessage(uID, -1, "You have been ejected from the vehcile");
    SendClientMessage(playerid, -1, "Player ejected");
    return 1;
}
PS: For strcmp you need:

This function:
pawn Code:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
To add this to the OnPlayerCommandText callback(at the beginning of the callback):
pawn Code:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);


Depends on what Save System are you using..
it get errors , can you make it as a filterscript ?!
Reply

Give me the errors.. PM..
Reply

Some Can make me a Helper saveing?
like if you close your sever the Helper stat cant not be save.
Reply

I need a ZCMD jail and unjail command with timer.
Reply

If anyone can create a command for me to hide/show http://i50.tinypic.com/28akifl.png these commands when some player write something it shows on admins chat, so it makes big spam for admins.

pls i need fest help
Reply

Quote:
Originally Posted by S4ba
View Post
If anyone can create a command for me to hide/show http://i50.tinypic.com/28akifl.png these commands when some player write something it shows on admins chat, so it makes big spam for admins.

pls i need fest help
Go to your PPC_PlayerCommands.inc

if you don't wanna the Admin Can see Command a player who type a command


Code:
	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/bank", params);
Reply

Quote:
Originally Posted by DerickClark
View Post
Go to your PPC_PlayerCommands.inc

if you don't wanna the Admin Can see Command a player who type a command


Code:
	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/bank", params);
but i want to create a command to hide and show them everytime when i want ;I

thx anyway
Reply

looking for a countdown filterscript. that starts when gamemode starts

i dont want to do /count cmd

it just automaticly starts counting down from 5 min to 0


with a textdraw showing countdown to all players

i will pay... or you can be a admin on my server


add andrewgrob2012 .. on skype or just visit my server below
Reply

Quote:
Originally Posted by andrewgrob
Посмотреть сообщение
looking for a countdown filterscript. that starts when gamemode starts

i dont want to do /count cmd

it just automaticly starts counting down from 5 min to 0


with a textdraw showing countdown to all players

i will pay... or you can be a admin on my server


add andrewgrob2012 .. on skype or just visit my server below

Well, I can show you a pretty simple example, you can modify it as you please to fit your server and your requirements.

pawn Код:
new CountMinutes = 4;
new CountSeconds = 60;
new CountTimer;

OnGameModeInit()
{
    CountTimer = SetTimer("CountDown", 1000, true);
    return 1;
}

forward CountDown();
public CountDown()
{
     new str[50];
     CountSeconds --;
     if(Seconds < 1 && CountMinutes > 0)
     {
         CountSeconds = 60;
         CountMinutes --;
         format(str, sizeof str, "Time left: %d:%d", CountMinutes, CountSeconds);
         GameTextForAll(str, 1000, 1);
     }
     else if(CountSeconds < 1 && CountMinutes == 0)
     {
            KillTimer(CountTimer);
            CountMinutes = 4;
            CountSeconds = 59;
            SendClientMessageToAll(-1, "Countdown finished.");
     }
     return 1;
}
This example's with GameText... You can modify it, to make it use TextDraws, but that's up to you.
Reply

Hello
i need a savestats cmd for luxadmin
see this :
Код:
dcmd_resetstats(playerid,params[])
{
    #pragma unused params
	if(AccInfo[playerid][LoggedIn] == 1)
	{
	   	dUserSetINT(PlayerName2(playerid)).("oldkills",AccInfo[playerid][Kills]);
	   	dUserSetINT(PlayerName2(playerid)).("olddeaths",AccInfo[playerid][Deaths]);
		AccInfo[playerid][Kills] = 0;
		AccInfo[playerid][Deaths] = 0;
		dUserSetINT(PlayerName2(playerid)).("Kills",AccInfo[playerid][Kills]);
	   	dUserSetINT(PlayerName2(playerid)).("Deaths",AccInfo[playerid][Deaths]);
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		return SendClientMessage(playerid,yellow,"|- You have Successfully reset your Stats! -|");
	}
	else return SendClientMessage(playerid,red, "ERROR: You must have an account to use this command");
}

dcmd_stats(playerid,params[])
{
	new string[128];
	new pDeaths;
	new player1, h, m, s;

	if(!strlen(params)) player1 = playerid;
	else player1 = strval(params);

	if(IsPlayerConnected(player1))
	{
    TotalGameTime(player1, h, m, s);
	if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
	else pDeaths = AccInfo[player1][Deaths];
	format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
	SendClientMessage(playerid, green, string);
	format(string, sizeof(string), "Kills: [%d] | Deaths: [%d] | Ratio: [%0.2f] | Money: [$%d] | Time: [%d] hrs [%d] mins [%d] secs |", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1), h, m, s);
	return SendClientMessage(playerid, green, string);
	} else
	return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}
these are resetstats and stats but i need savestats
tnx
gift : 2 rep
Reply

Quote:
Originally Posted by antonio112
Посмотреть сообщение
Well, I can show you a pretty simple example, you can modify it as you please to fit your server and your requirements.

pawn Код:
new CountMinutes = 4;
new CountSeconds = 60;
new CountTimer;

OnGameModeInit()
{
    CountTimer = SetTimer("CountDown", 1000, true);
    return 1;
}

forward CountDown();
public CountDown()
{
     new str[50];
     CountSeconds --;
     if(Seconds < 1 && CountMinutes > 0)
     {
         CountSeconds = 60;
         CountMinutes --;
         format(str, sizeof str, "Time left: %d:%d", CountMinutes, CountSeconds);
         GameTextForAll(str, 1000, 1);
     }
     else if(CountSeconds < 1 && CountMinutes == 0)
     {
            KillTimer(CountTimer);
            CountMinutes = 4;
            CountSeconds = 59;
            SendClientMessageToAll(-1, "Countdown finished.");
     }
     return 1;
}
This example's with GameText... You can modify it, to make it use TextDraws, but that's up to you.
thank you i will try this
Reply

Need suspect command in zcmd
Reply

I need a derby system, heres my command below. I need that the limit is 4 people, i have 4 cars. And the last one in the derby, who has smashed all cars gets 10'000$, really need it.


Код:
CMD:derby(playerid, params[])
{
    new str7[128], player8[MAX_PLAYER_NAME];
    GetPlayerName(playerid, player8, sizeof(player8));
    format(str7,sizeof(str7),"%s teleportis end derbysse [/derby]",player8);
    SendClientMessageToAll(COLOR_GREEN,str7);
    new rand = random(sizeof(D1Rand));
    SetPlayerPos(playerid, D1Rand[rand][0], D1Rand[rand][1], D1Rand[rand][2]);
    SendClientMessage(playerid, COLOR_NGREEN,"Teleportisid end derbysse!");
    ResetPlayerWeapons(playerid);
    nocmd[playerid] = 1;
    return 1;
}
Reply

Quote:
Originally Posted by MehranGta
Посмотреть сообщение
Hello
i need a savestats cmd for luxadmin
see this :
Код:
dcmd_resetstats(playerid,params[])
{
    #pragma unused params
	if(AccInfo[playerid][LoggedIn] == 1)
	{
	   	dUserSetINT(PlayerName2(playerid)).("oldkills",AccInfo[playerid][Kills]);
	   	dUserSetINT(PlayerName2(playerid)).("olddeaths",AccInfo[playerid][Deaths]);
		AccInfo[playerid][Kills] = 0;
		AccInfo[playerid][Deaths] = 0;
		dUserSetINT(PlayerName2(playerid)).("Kills",AccInfo[playerid][Kills]);
	   	dUserSetINT(PlayerName2(playerid)).("Deaths",AccInfo[playerid][Deaths]);
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		return SendClientMessage(playerid,yellow,"|- You have Successfully reset your Stats! -|");
	}
	else return SendClientMessage(playerid,red, "ERROR: You must have an account to use this command");
}

dcmd_stats(playerid,params[])
{
	new string[128];
	new pDeaths;
	new player1, h, m, s;

	if(!strlen(params)) player1 = playerid;
	else player1 = strval(params);

	if(IsPlayerConnected(player1))
	{
    TotalGameTime(player1, h, m, s);
	if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
	else pDeaths = AccInfo[player1][Deaths];
	format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
	SendClientMessage(playerid, green, string);
	format(string, sizeof(string), "Kills: [%d] | Deaths: [%d] | Ratio: [%0.2f] | Money: [$%d] | Time: [%d] hrs [%d] mins [%d] secs |", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1), h, m, s);
	return SendClientMessage(playerid, green, string);
	} else
	return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}
these are resetstats and stats but i need savestats
tnx
gift : 2 rep
no one?
Reply

Quote:
Originally Posted by MehranGta
Посмотреть сообщение
no one?
This admin filterscript has a SavePlayerStats function implemented:
pawn Код:
SavePlayerStats(playerid)
{
    dUserSetINT(PlayerName2(playerid)).("Money",GetPlayerMoney(playerid));
    dUserSetINT(PlayerName2(playerid)).("Kills",AccInfo[playerid][Kills]);
    dUserSetINT(PlayerName2(playerid)).("Deaths",AccInfo[playerid][Deaths]);
    dUserSetINT(PlayerName2(playerid)).("WantedLevel",GetPlayerWantedLevel(playerid));
    #if SaveScore == true
    dUserSetINT(PlayerName2(playerid)).("Score",GetPlayerScore(playerid));
    #endif

    new h, m, s;
    TotalGameTime(playerid, h, m, s);

    dUserSetINT(PlayerName2(playerid)).("Hours", h);
    dUserSetINT(PlayerName2(playerid)).("Minutes", m);
    dUserSetINT(PlayerName2(playerid)).("Seconds", s);

    new Float:x,Float:y,Float:z, interior;
    GetPlayerPos(playerid,x,y,z);
    interior = GetPlayerInterior(playerid);
   
    dUserSetINT(PlayerName2(playerid)).("x1",floatround(x));
    dUserSetINT(PlayerName2(playerid)).("y1",floatround(y));
    dUserSetINT(PlayerName2(playerid)).("z1",floatround(z));
    dUserSetINT(PlayerName2(playerid)).("interior1",interior);

    new weap1, ammo1, weap2, ammo2, weap3, ammo3, weap4, ammo4, weap5, ammo5, weap6, ammo6;
   
    GetPlayerWeaponData(playerid,2,weap1,ammo1);
    GetPlayerWeaponData(playerid,3,weap2,ammo2);
    GetPlayerWeaponData(playerid,4,weap3,ammo3);
    GetPlayerWeaponData(playerid,5,weap4,ammo4);
    GetPlayerWeaponData(playerid,6,weap5,ammo5);
    GetPlayerWeaponData(playerid,7,weap6,ammo6);
   
    dUserSetINT(PlayerName2(playerid)).("Weapon1",weap1);
    dUserSetINT(PlayerName2(playerid)).("Weapon1Ammo",ammo1);
    dUserSetINT(PlayerName2(playerid)).("Weapon2",weap2);
    dUserSetINT(PlayerName2(playerid)).("Weapon2Ammo",ammo2);
    dUserSetINT(PlayerName2(playerid)).("Weapon3",weap3);
    dUserSetINT(PlayerName2(playerid)).("Weapon3Ammo",ammo3);
    dUserSetINT(PlayerName2(playerid)).("Weapon4",weap4);
    dUserSetINT(PlayerName2(playerid)).("Weapon4Ammo",ammo4);
    dUserSetINT(PlayerName2(playerid)).("Weapon5",weap5);
    dUserSetINT(PlayerName2(playerid)).("Weapon5Ammo",ammo5);
    dUserSetINT(PlayerName2(playerid)).("Weapon6",weap6);
    dUserSetINT(PlayerName2(playerid)).("Weapon6Ammo",ammo6);

    new Float:health;
    GetPlayerHealth(playerid, Float:health);
    new Float:armour;
    GetPlayerArmour(playerid, Float:armour);
    new year,month,day;
    getdate(year, month, day);
    new strdate[20];
    format(strdate, sizeof(strdate), "%d.%d.%d",day,month,year);
    new file[256];
    format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid)) );

    dUserSetINT(PlayerName2(playerid)).("Health",floatround(health));
    dUserSetINT(PlayerName2(playerid)).("Armour",floatround(armour));
    dini_Set(file,"LastOn",strdate);
    dUserSetINT(PlayerName2(playerid)).("Loggedin",0);
    dUserSetINT(PlayerName2(playerid)).("TimesOnServer",(dUserINT(PlayerName2(playerid)).("TimesOnServer"))+1);
}
The command should be:
pawn Код:
dcmd_savestats(playerid, params[])
{
    #pragma unused params
    SavePlayerStats(playerid);
    SendClientMessage(playerid, -1, "Your statistics have been saved!");
    return 1;
}
Reply

Quote:
Originally Posted by Hade.
Посмотреть сообщение
I need a derby system, heres my command below. I need that the limit is 4 people, i have 4 cars. And the last one in the derby, who has smashed all cars gets 10'000$, really need it.


Код:
CMD:derby(playerid, params[])
{
    new str7[128], player8[MAX_PLAYER_NAME];
    GetPlayerName(playerid, player8, sizeof(player8));
    format(str7,sizeof(str7),"%s teleportis end derbysse [/derby]",player8);
    SendClientMessageToAll(COLOR_GREEN,str7);
    new rand = random(sizeof(D1Rand));
    SetPlayerPos(playerid, D1Rand[rand][0], D1Rand[rand][1], D1Rand[rand][2]);
    SendClientMessage(playerid, COLOR_NGREEN,"Teleportisid end derbysse!");
    ResetPlayerWeapons(playerid);
    nocmd[playerid] = 1;
    return 1;
}
Someone help me with this?
Reply

Quote:
Originally Posted by Hade.
Посмотреть сообщение
Someone help me with this?
I still dont understand ? I need the whole things done that i mentioned before...
Reply

Well that encode and decode thing
ex When player joins it sets his name in the file as Madafaka_00Pro or sometimes Madafaka_14Pro ...
Reply

Quote:
Originally Posted by MadafakaPro
Посмотреть сообщение
Well that encode and decode thing
ex When player joins it sets his name in the file as Madafaka_00Pro or sometimes Madafaka_14Pro ...
You want to be simple ?
Reply


Forum Jump:


Users browsing this thread: 27 Guest(s)