Script help.
#1

Can someone give me a script ?

Create a script whereby it does the following:.
1. Create a MYSQL connection
2. If tables / rows doesn't exist there should be a query in the script to
create them.
3. Load vehicles from the database
4. A user stat base which logges the user's name , score , IP , passsword (
should be encrypted) & userID ( auto increment ).
5. A ban database

Using zcmd (the include ) create the following stuff
/setscore [id] command
/ giveallscore cmd
/kick [id]
/ban [id]

A command which opens up a dialog and does the following:
A dialog which allows the user to be teleported somewhere
A dialog which gives health + armour to the player
A dialog which gives the player weapons

There should not be any mysql connections
functions within functions within functions
keep it as simple as possible
Reply
#2

How do you save player team to playerid?
Reply
#3

Quote:
Originally Posted by Glenn332
Посмотреть сообщение
How do you save player team to playerid?
What do you mean ?
Reply
#4

When a player get 10 kills to get a minigun ? Or all players that have the class to get minigun ? What Class Points mean ?
Reply
#5

All the team players get points.
Class point means scores given to the player from 1 kill ofthe opponent.
Reply
#6

This is not a script request board. Use the proper topic for that.
Reply
#7

Where is the topic ?
Reply
#8

Код:
#define FILTERSCRIPT

#include <a_samp>
#include <ZCMD>

#define AMMO        100

enum eTeam
{
	pTeam,
}

new cInfo[MAX_PLAYERS][eTeam];

new tRedScore; // Sniper Score
new tBlueScore; // Soldier Score

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" [LOADING...] Sniper Class - Loaded !");
	print(" [LOADING...] Soldier Class - Loaded !");
	print("--------------------------------------\n");

	return 1;
}

public OnFilterScriptExit()
{
	print("\n--------------------------------------");
	print(" [LOADING...] Sniper Class - Failed !");
	print(" [LOADING...] Soldier Class - Failed !");
	print("--------------------------------------\n");

	return 1;
}
public OnPlayerConnect(playerid)
{
	ShowPlayerDialog(playerid, 112, DIALOG_STYLE_MSGBOX, "Class Selection", "What class you wanna be ?", "Sniper", "Soldier");
	
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(cInfo[killerid][pTeam] == 2)
	    tBlueScore ++;
	    
	else if(cInfo[killerid][pTeam] == 1)
	    tRedScore ++;

	if(tBlueScore == 10)
	{
		for(new i=0; i<MAX_PLAYERS; i++)
		{
		    if(cInfo[i][pTeam] != 1)
		        return 1;

			GivePlayerWeapon(i, WEAPON_MINIGUN, AMMO);
				
			tBlueScore = 0;
		}
	}
	else if(tRedScore == 10)
	{
	    for(new i=0; i<MAX_PLAYERS; i++)
		{
		    if(cInfo[i][pTeam] != 2)
		        return 1;

			GivePlayerWeapon(i, WEAPON_MINIGUN, AMMO);

			tRedScore = 0;
		}
	}
	
	SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
	
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 112)
	{
		if(response) cInfo[playerid][pTeam] = 1;
  		else cInfo[playerid][pTeam] = 2;
  		
  		new s[128];
  		format(s,sizeof(s), "You are a %s now ! Enjoy ..", (cInfo[playerid][pTeam] == 1) ? ("Red") : ("Blue"));
  		SendClientMessage(playerid, 0xFF3567FF, s);
	}
	
	return 1;
}
CMD:score(playerid, params[])
{
	new s[128], s2[128], s3[128];

	format(s, sizeof(s), "Red Team Score: %i points", tRedScore);
	format(s2, sizeof(s2), "Blue Team Score: %i points", tBlueScore);
	format(s3, sizeof(s3), "Your class points: %i", GetPlayerScore(playerid));
	
	SendClientMessage(playerid, 0xFF0000FF, s);
	SendClientMessage(playerid, 0x0000FFFF, s2);
	SendClientMessage(playerid, 0xFFFF00FF, s3);
	
	return 1;
}
P.S: Don't save stats before player exit .. if you want that i will make it .

(/score command show teams score)
(#define AMMO will set the ammo of minigun - you can edit it)
Reply
#9

Uhm..can you add something more ? I have to test the script with you gave only...so can you write a script then only ?
Also, can you do like when we select soldier we get M4 when sniper sniper rifle.
And the thing is that when Sniper kills Soldier or Soldier kills Sniper, he gets 1 score,.and if any sniper kills soldier 10 times or a soldier kills sniper 10 times, get a minigun.
Thanks.
Reply
#10

Код:
#define FILTERSCRIPT

#include <a_samp>
#include <ZCMD>
#include <YSI\y_ini>

#pragma tabsize 0

#define AMMO	100
#define PATH	"/Class/%s.ini"

#define SKIN1   165 // Sniper Skin
#define SKIN2	287 // Soldier Skin

enum eTeam
{
	pTeam,
	pScore
};

new cInfo[MAX_PLAYERS][eTeam];

new tRedScore; // Sniper Score
new tBlueScore; // Soldier Score

forward LoadUser_data(playerid,name[],value[]);

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" [LOADING...] Sniper Class - Loaded !");
	print(" [LOADING...] Soldier Class - Loaded !");
	print("--------------------------------------\n");

	return 1;
}

public OnFilterScriptExit()
{
	print("\n--------------------------------------");
	print(" [LOADING...] Sniper Class - Failed !");
	print(" [LOADING...] Soldier Class - Failed !");
	print("--------------------------------------\n");

	return 1;
}
public OnPlayerSpawn(playerid)
{
	if(cInfo[playerid][pTeam] == 1)
	    GivePlayerWeapon(playerid, 31, 9999);
	    
	else if(cInfo[playerid][pTeam] == 2)
	    GivePlayerWeapon(playerid, 34, 9999);
	    
	SetPlayerScore(playerid, cInfo[playerid][pScore]);

	if(cInfo[playerid][pTeam] == 1)
		SetPlayerSkin(playerid, SKIN1);
		
	else if(cInfo[playerid][pTeam] == 2)
	    SetPlayerSkin(playerid, SKIN2);

	return 1;
}
public OnPlayerConnect(playerid)
{
	if(!fexist(UserPath(playerid)))
		ShowPlayerDialog(playerid, 112, DIALOG_STYLE_MSGBOX, "Class Selection", "What class you wanna be ?", "Sniper", "Soldier");

	else if(fexist(UserPath(playerid)))
	    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

	return 1;
}
public OnPlayerDisconnect(playerid)
{
    INI_WriteInt(INI_Open(UserPath(playerid)), "Team", cInfo[playerid][pTeam]);
	INI_WriteInt(INI_Open(UserPath(playerid)), "Score", cInfo[playerid][pScore]);
	
	INI_Close(INI_Open(UserPath(playerid)));
	
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(cInfo[killerid][pTeam] == 2)
	    tBlueScore ++;

	else if(cInfo[killerid][pTeam] == 1)
	    tRedScore ++;

	if(tBlueScore == 10)
	{
		for(new i=0; i<MAX_PLAYERS; i++)
		{
		    if(cInfo[i][pTeam] != 1)
		        return 1;

			GivePlayerWeapon(i, 38, AMMO);

			tBlueScore = 0;
                        tRedScore = 0;
		}
	}
	else if(tRedScore == 10)
	{
	    for(new i=0; i<MAX_PLAYERS; i++)
		{
		    if(cInfo[i][pTeam] != 2)
		        return 1;

			GivePlayerWeapon(i, 38, AMMO);

			tRedScore = 0;
                        tBlueScore = 0;
		}
	}

	SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
	cInfo[killerid][pScore] ++;

	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 112)
	{
		if(response) cInfo[playerid][pTeam] = 1;
  		else cInfo[playerid][pTeam] = 2;

  		new s[128];
  		format(s,sizeof(s), "You are a %s now ! Enjoy ..", (cInfo[playerid][pTeam] == 1) ? ("Red") : ("Blue"));
  		SendClientMessage(playerid, 0xFF3567FF, s);
  		
		SpawnPlayer(playerid);
	}

	return 1;
}

public LoadUser_data(playerid,name[],value[])
{
	INI_Int("Team", cInfo[playerid][pTeam]);
	INI_Int("Score", cInfo[playerid][pScore]);
	
	return 1;
}

CMD:score(playerid, params[])
{
	new s[128], s2[128], s3[128];

	format(s, sizeof(s), "Red Team Score: %i points", tRedScore);
	format(s2, sizeof(s2), "Blue Team Score: %i points", tBlueScore);
	format(s3, sizeof(s3), "Your class points: %i", GetPlayerScore(playerid));

	SendClientMessage(playerid, 0xFF0000FF, s);
	SendClientMessage(playerid, 0x0000FFFF, s2);
	SendClientMessage(playerid, 0xFFFF00FF, s3);

	return 1;
}

CMD:Class(playerid, params[])
    return ShowPlayerDialog(playerid, 112, DIALOG_STYLE_MSGBOX, "Class Selection", "What class you wanna be ?", "Sniper", "Soldier");
    
stock UserPath(playerid)
{
	new String[128],
		pName[MAX_PLAYER_NAME];

	GetPlayerName(playerid, pName,sizeof(pName));
    format(String, sizeof(String), PATH, pName);

	return String;
}
INFO

- Saving Score & Class [Player]
- Loading Score & Class [Player]
- Command /class to change your class
- Command /score to see team & your score
- Giving M4 / Sniper at spawn , depending by class
- A skin for each class
- A message when a team have 10 points
- Give a minigun at the all team when team score it's 10
- When a team score it's 10 the other team will get 0 points .

- You need to create folder Class in scriptfiles (/scriptfiles/Class/) = There will save Score and class of the player
- I hope you enjoy it and don't forget to click +REP button
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)