How change player infection from name to numbers
#1

Hi!
I need your help guys so i want remake this script
Код:
format(zmstring,sizeof(zmstring), ""chat""COL_PINK" %s has been infected by %s",PlayerName(victimid),PlayerName(playerid));
										SendClientMessageToAll(-1,zmstring);
To number like (Name_Name has been infected 3 players) so its should count somehow, how much i infect players with explosion. Full code

Код:
    if(PRESSED(KEY_WALK))
	{
	if(team[playerid] == TEAM_ZOMBIE)
    {
	if(pInfo[playerid][pZombieClass] == ADVANCEDBOOMER)
	{
    if(IsPlayerInRangeOfPoint(playerid,8.0,Map[ZombieSpawnX],Map[ZombieSpawnY],Map[ZombieSpawnZ]))
    {
    GameTextForPlayer(playerid,"~r~You cant explode yourself near zombie spawn!",4000,5);
	}
	else
	{
	new victimid = GetClosestPlayer(playerid);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,Float:x,Float:y,Float:z);
    SetPlayerHealth(playerid,0.0);
    CreateExplosion(Float:x,Float:y,Float:z,0,6.0);
    foreach(new i : Player)
	{
    GetClosestPlayer(i);
    if(IsPlayerConnected(i))
	{
   	switch(GetPlayerSkin(i))
    {
    case NON_IMMUNE:
	{
    if(IsPlayerInRangeOfPoint(i,7.0,Float:x,Float:y,Float:z))
	{
	if(pInfo[i][IsPlayerInfected] == 0)
	{
	new zmstring[256];
    InfectPlayerStandard(i);
    format(zmstring,sizeof(zmstring), ""chat""COL_PINK" %s has been infected by %s",PlayerName(victimid),PlayerName(playerid));
	SendClientMessageToAll(-1,zmstring);
	}
Reply
#2

Try this one, not tested.

Replace it instead of your current code.
Код:
if(PRESSED(KEY_WALK))
	{
	new infectedcount;
	if(team[playerid] == TEAM_ZOMBIE)
    {
	if(pInfo[playerid][pZombieClass] == ADVANCEDBOOMER)
	{
    if(IsPlayerInRangeOfPoint(playerid,8.0,Map[ZombieSpawnX],Map[ZombieSpawnY],Map[ZombieSpawnZ]))
    {
    GameTextForPlayer(playerid,"~r~You cant explode yourself near zombie spawn!",4000,5);
	}
	else
	{
	new victimid = GetClosestPlayer(playerid);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,Float:x,Float:y,Float:z);
    SetPlayerHealth(playerid,0.0);
    CreateExplosion(Float:x,Float:y,Float:z,0,6.0);
    for(new i=0; i<MAX_PLAYERS; i++)
	{
    if(IsPlayerInRangeOfPoint(i,7.0,Float:x,Float:y,Float:z))
	{
	if(pInfo[i][IsPlayerInfected] == 0)
	{
	new zmstring[256],zmstring2[256],pName[MAX_PLAYER_NAME];
	infectedcount++;
    InfectPlayerStandard(i);
    GetPlayerName(playerid,pName,sizeof(pName));
    format(zmstring,sizeof(zmstring), ""chat""COL_PINK" %s has been infected by %s",PlayerName(victimid),PlayerName(playerid));
    format(zmstring2,sizeof(zmstring2),"%s has infected %i players.",pName,infectedcount);
    SendClientMessageToAll(-1,zmstring);
	SendClientMessageToAll(-1,zmstring2);
	}
Reply
#3

Quote:
Originally Posted by Twistedz
Посмотреть сообщение
Try this one, not tested.

Replace it instead of your current code.
Код:
if(PRESSED(KEY_WALK))
	{
	new infectedcount;
	if(team[playerid] == TEAM_ZOMBIE)
    {
	if(pInfo[playerid][pZombieClass] == ADVANCEDBOOMER)
	{
    if(IsPlayerInRangeOfPoint(playerid,8.0,Map[ZombieSpawnX],Map[ZombieSpawnY],Map[ZombieSpawnZ]))
    {
    GameTextForPlayer(playerid,"~r~You cant explode yourself near zombie spawn!",4000,5);
	}
	else
	{
	new victimid = GetClosestPlayer(playerid);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,Float:x,Float:y,Float:z);
    SetPlayerHealth(playerid,0.0);
    CreateExplosion(Float:x,Float:y,Float:z,0,6.0);
    for(new i=0; i<MAX_PLAYERS; i++)
	{
    if(IsPlayerInRangeOfPoint(i,7.0,Float:x,Float:y,Float:z))
	{
	if(pInfo[i][IsPlayerInfected] == 0)
	{
	new zmstring[256],zmstring2[256],pName[MAX_PLAYER_NAME];
	infectedcount++;
    InfectPlayerStandard(i);
    GetPlayerName(playerid,pName,sizeof(pName));
    format(zmstring,sizeof(zmstring), ""chat""COL_PINK" %s has been infected by %s",PlayerName(victimid),PlayerName(playerid));
    format(zmstring2,sizeof(zmstring2),"%s has infected %i players.",pName,infectedcount);
    SendClientMessageToAll(-1,zmstring);
	SendClientMessageToAll(-1,zmstring2);
	}
Put the Sending part outside the loop
Reply
#4

Twist why you removed these lines?
Код:
 GetClosestPlayer(i);
    if(IsPlayerConnected(i))
	{
   	switch(GetPlayerSkin(i))
    {
    case NON_IMMUNE:
	{
Reply
#5

Quote:
Originally Posted by Twistedz
Посмотреть сообщение
Try this one, not tested.

Replace it instead of your current code.
Код:
if(PRESSED(KEY_WALK))
	{
	new infectedcount;
	if(team[playerid] == TEAM_ZOMBIE)
    {
	if(pInfo[playerid][pZombieClass] == ADVANCEDBOOMER)
	{
    if(IsPlayerInRangeOfPoint(playerid,8.0,Map[ZombieSpawnX],Map[ZombieSpawnY],Map[ZombieSpawnZ]))
    {
    GameTextForPlayer(playerid,"~r~You cant explode yourself near zombie spawn!",4000,5);
	}
	else
	{
	new victimid = GetClosestPlayer(playerid);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,Float:x,Float:y,Float:z);
    SetPlayerHealth(playerid,0.0);
    CreateExplosion(Float:x,Float:y,Float:z,0,6.0);
    for(new i=0; i<MAX_PLAYERS; i++)
	{
    if(IsPlayerInRangeOfPoint(i,7.0,Float:x,Float:y,Float:z))
	{
	if(pInfo[i][IsPlayerInfected] == 0)
	{
	new zmstring[256],zmstring2[256],pName[MAX_PLAYER_NAME];
	infectedcount++;
    InfectPlayerStandard(i);
    GetPlayerName(playerid,pName,sizeof(pName));
    format(zmstring,sizeof(zmstring), ""chat""COL_PINK" %s has been infected by %s",PlayerName(victimid),PlayerName(playerid));
    format(zmstring2,sizeof(zmstring2),"%s has infected %i players.",pName,infectedcount);
    SendClientMessageToAll(-1,zmstring);
	SendClientMessageToAll(-1,zmstring2);
	}
Anyway this code full of errors
Reply
#6

warning 219: local variable "pName" shadows a variable at a preceding level
warning 209: function "RL_OnPlayerKeyStateChange" should return a value
error 054: unmatched closing brace ("}")
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
error 010: invalid function or declaration
Reply
#7

Well i fixed these error and warnings it was to much } and changed pName to other name because i define that variable twice.

Bat i'm not sure its will work fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)