Team Points Count
#1

Hey everyone,
I created this script to count the kills of each team putting SwatScore[MAX_PLAYERS] and NarcoScore[MAX_PLAYERS], but it hasn't worked out everytime one person kills it only shows to him how many he killed no for the whole team, so i took the [MAX_PLAYERS] away from new SwatScore; and new NarcoScore; and now nothing happens.
I based myself on an example that I found on the forum, there is a treat out there but like I mentioned before it didn't work.

//===============================TDM================ ============================
Код:
new SwatScore;
new NarcoScore;

new tmpstr[50]; // temporal
new spuntos, npuntos;
public OnPlayerDeath(playerid, killerid, reason)
{
	if(GetPlayerTeam(killerid) == 1)
	{
		spuntos = SwatScore++;
		format(tmpstr,sizeof(tmpstr),"SWAT: %d  NARCOS: %d",spuntos,npuntos);
		GameTextForPlayer(killerid, tmpstr, 3000, 4);
		GameTextForPlayer(playerid, tmpstr, 3000, 4);
	}
	if(GetPlayerTeam(killerid) == 2)
	{
		npuntos = NarcoScore++;
		format(tmpstr,sizeof(tmpstr),"SWAT: %d  NARCOS: %d",spuntos,npuntos);
		GameTextForPlayer(killerid, tmpstr, 3000, 4);
		GameTextForPlayer(playerid, tmpstr, 3000, 4);
	}
       return 1;
}
This is the command part
Код:
CMD: puntostdm(playerid,params[])
	{
	if(swatdm[playerid] == 1 || narcosdm[playerid] == 1)
	{
		format(tmpstr,sizeof(tmpstr),"SWAT: %d \nNARCOS: %d",spuntos,npuntos);
	    ShowPlayerDialog(playerid,PTDM,DIALOG_STYLE_MSGBOX,"{A2A393}Swat VS Narcos 2012", tmpstr,"Aceptar","");

	}
	else
	{
	SendClientMessage(playerid, COLOR_RED, "Solo puedes usar este comando en un TDM");
	}
		return 1;
}

CMD: resetpuntos(playerid,params[])
	{
	if(IsPlayerAdmin(playerid))
	{
		NarcoScore = 0;
		SwatScore = 0;
		SendClientMessage(playerid, COLOR_RED, "Puntos del Tdm fueron reseteados");

	}
	else
	{
	SendClientMessage(playerid, COLOR_RED, "Comando usable solo por admins");
	}
		return 1;
}

//=====================================SwatvsNarcos=============================
CMD: swatdm(playerid, params[])
{
	if(BlockCMD[playerid] == 1)return SendClientMessage(playerid, COLOR_RED, "Primero Sale del Evento con /Salir");
	new string[128];
	gswatdm(playerid);
	SaveWeapons(playerid);
	format(string,sizeof(string),"* %s [%d] entro al equipo tdm {FF0000}/swatdm",Nickname[playerid],playerid);
	SendClientMessageToAll(COLOR_AMARILLO,string);
	return 1;
}

new Float:swatspawns[4][3] = {
{2543.7456,-1320.6592,1031.4219},
{2538.0869,-1317.2026,1031.4219},
{2530.8181,-1319.9738,1031.4219},
{2526.3179,-1316.7911,1031.4219}
};

forward gswatdm(playerid);
public gswatdm(playerid)
{
	new rand = random(sizeof(swatspawns));
	SetPlayerPos(playerid, swatspawns[rand][0], swatspawns[rand][1], swatspawns[rand][2]); // Warp the player
//=======================================
	SetPlayerVirtualWorld(playerid, 13);
	SetPlayerInterior(playerid, 2);
	ResetPlayerWeapons(playerid);
	SetPlayerSkin(playerid, 285);
 	SetPlayerTeam(playerid, 1); //SwatTeam
	SetPlayerColor(playerid, 0xABCDEF01);//color neutralblue
	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 100);
	GivePlayerWeapon(playerid,3,1);//nikestrike
	GivePlayerWeapon(playerid,17,1000);//teargas
	GivePlayerWeapon(playerid,24,1000);//deagle
	GivePlayerWeapon(playerid,29,1000);//mp5
	swatdm[playerid] = 1;
	dys[playerid]=1;
	BlockCMD[playerid] = 1;
	Blocksalir[playerid] = 0;

	SendClientMessage(playerid, COLOR_GREEN, "Escribe /Salir para salir del dm");
	return 1;
}


CMD: narcosdm(playerid, params[])
{
	if(BlockCMD[playerid] == 1)return SendClientMessage(playerid, COLOR_RED, "Primero Sale del Evento con /Salir");
	new string[128];
	gnarcosdm(playerid);
	SaveWeapons(playerid);
	format(string,sizeof(string),"* %s [%d] entro al equipo tdm {FF0000}/narcosdm",Nickname[playerid],playerid);
	SendClientMessageToAll(COLOR_AMARILLO,string);
	return 1;
}

new Float:narcosspawns[7][3] = {
{2540.5554,-1296.0521,1031.4219},
{2554.4407,-1296.9950,1031.4219},
{2569.1575,-1298.1891,1037.7805},
{2539.9639,-1294.7924,1044.1250},
{2550.1294,-1283.4413,1044.1250},
{2528.7805,-1285.7336,1054.6406},
{2537.9895,-1300.9147,1054.6406}
};

new narcoskins[7][1] = {
{124},
{272},
{113},
{124},
{111},
{122},
{249}
};

forward gnarcosdm(playerid);
public gnarcosdm(playerid)
{
	new rand = random(sizeof(narcosspawns));
	SetPlayerPos(playerid, narcosspawns[rand][0], narcosspawns[rand][1], narcosspawns[rand][2]); // Warp the player
	new srandom = random(sizeof(narcoskins));
	SetPlayerSkin(playerid,narcoskins[srandom][0]);
//=======================================
	SetPlayerVirtualWorld(playerid, 13);
	SetPlayerInterior(playerid, 2);
	ResetPlayerWeapons(playerid);
 	SetPlayerTeam(playerid, 2); //NarcosTeam
	SetPlayerColor(playerid, 0x46BBAA00);//bluegreen
	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 100);
	GivePlayerWeapon(playerid,4,1);//knife
	GivePlayerWeapon(playerid,23,1000);//silenced
	GivePlayerWeapon(playerid,30,1000);//ak47
	narcosdm[playerid] = 1;
	dys[playerid]=1;
	BlockCMD[playerid] = 1;
	Blocksalir[playerid] = 0;
	SendClientMessage(playerid, COLOR_GREEN, "Escribe /Salir para salir del dm");
	return 1;
}
As shown in the top i put the player into a team with SetPlayerTeam but everytime in the team 1 kills someone nothing happens and the same with the team 2 he kills a swat nothing happens what could be going on?
Reply
#2

pawn Код:
new
    SwatScore = 0,
    NarcoScore = 0
;

new tmpstr[50];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPlayerTeam(killerid) == 1)
    {
        SwatScore++;
        format(tmpstr,sizeof(tmpstr),"SWAT: %d  NARCOS: %d",SwatScore,NarcoScore);
        GameTextForPlayer(killerid, tmpstr, 3000, 4);
        GameTextForPlayer(playerid, tmpstr, 3000, 4);
    }
    if(GetPlayerTeam(killerid) == 2)
    {
        NarcoScore++;
        format(tmpstr,sizeof(tmpstr),"SWAT: %d  NARCOS: %d",SwatScore,NarcoScore);
        GameTextForPlayer(killerid, tmpstr, 3000, 4);
        GameTextForPlayer(playerid, tmpstr, 3000, 4);
    }
    return 1;
}
Now every time you want to check the score(for example in a string in a command) you can use SwatScore and NarcoScore, simple as that.
Reply
#3

Ok thanks I will try that lets see what happens
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)