GetPlayerWeaponData help.
#1

Hello i want to make a killstreak system and i want make if the player use the killstreak he will get reset weapons and only get the killstreak gun, after 1 minute exemple, he get reseted weapons back again and get back him his guns..
Код:
CMD:bazooka(playerid, params[])
{
    if (Bazooka[playerid] == 1)
    {
       GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~r~ ЎBAZOOKA EN USO!",10000,3);
       new weapons[13][2];
       for (new i = 0; i <= 12; i++)
       {
           GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
       }
       ResetPlayerWeapons(playerid);
       GivePlayerWeapon(playerid,35,5);
       SetTimerEx("TiempoBazooka", 20000, false, "i", playerid);
       for(new i = 0; i < MAX_PLAYERS; i++)
       PlayerPlaySound(i, 6400, 0.0, 0.0, 0.0);
    }
    else
   {
       PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
      SendClientMessage(playerid, Rojo, "[ERROR]{FFFFFF} No tienes ninguna minigun para usar.");
   }
   return 1;
}
forward TiempoBazooka(playerid);
public TiempoBazooka(playerid)
{
    ResetPlayerWeapons(playerid);
    GivePlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    Bazooka[playerid] = 0;
}
Reply
#2

Try
Код:
new Bazooka[MAX_PLAYERS]; // global
new weapons[MAX_PLAYERS][13][2]; // global

CMD:bazooka(playerid, params[])
{
    if (Bazooka[playerid] == 1)
    {
       GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~r~ ЎBAZOOKA EN USO!",10000,3);
       for (new i = 0; i <= 12; i++)
       {
           GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
       }
       ResetPlayerWeapons(playerid);
       GivePlayerWeapon(playerid,35,5);
       SetTimerEx("TiempoBazooka", 20000, false, "i", playerid);
       for(new i = 0; i < MAX_PLAYERS; i++)
       PlayerPlaySound(i, 6400, 0.0, 0.0, 0.0);
    }
    else
   {
		PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
		SendClientMessage(playerid, rojo, "[ERROR]{FFFFFF} No tienes ninguna minigun para usar.");
   }
   return 1;
}

forward TiempoBazooka(playerid);
public TiempoBazooka(playerid)
{
    ResetPlayerWeapons(playerid);
	
	for(new i = 0; i < sizeof weapons; i ++)
		GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
	
    Bazooka[playerid] = 0;
}
Reply
#3

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Try
Код:
new Bazooka[MAX_PLAYERS]; // global
new weapons[MAX_PLAYERS][13][2]; // global

CMD:bazooka(playerid, params[])
{
    if (Bazooka[playerid] == 1)
    {
       GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~r~ ЎBAZOOKA EN USO!",10000,3);
       for (new i = 0; i <= 12; i++)
       {
           GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
       }
       ResetPlayerWeapons(playerid);
       GivePlayerWeapon(playerid,35,5);
       SetTimerEx("TiempoBazooka", 20000, false, "i", playerid);
       for(new i = 0; i < MAX_PLAYERS; i++)
       PlayerPlaySound(i, 6400, 0.0, 0.0, 0.0);
    }
    else
   {
		PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
		SendClientMessage(playerid, rojo, "[ERROR]{FFFFFF} No tienes ninguna minigun para usar.");
   }
   return 1;
}

forward TiempoBazooka(playerid);
public TiempoBazooka(playerid)
{
    ResetPlayerWeapons(playerid);
	
	for(new i = 0; i < sizeof weapons; i ++)
		GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
	
    Bazooka[playerid] = 0;
}
Код:
C:\Users\Usuario\Desktop\Batalla de Contrabando\gamemodes\CounterStrike.pwn(2790) : error 017: undefined symbol "weapons"
C:\Users\Usuario\Desktop\Batalla de Contrabando\gamemodes\CounterStrike.pwn(2791) : error 017: undefined symbol "weapons"
C:\Users\Usuario\Desktop\Batalla de Contrabando\gamemodes\CounterStrike.pwn(2791) : warning 215: expression has no effect
C:\Users\Usuario\Desktop\Batalla de Contrabando\gamemodes\CounterStrike.pwn(2791) : error 001: expected token: ";", but found "]"
C:\Users\Usuario\Desktop\Batalla de Contrabando\gamemodes\CounterStrike.pwn(2791) : error 029: invalid expression, assumed zero
C:\Users\Usuario\Desktop\Batalla de Contrabando\gamemodes\CounterStrike.pwn(2791) : fatal error 107: too many error messages on one line
Код:
forward TiempoBazooka(playerid);
public TiempoBazooka(playerid)
{
    ResetPlayerWeapons(playerid);

	for(new i = 0; i < sizeof weapons; i ++) //line 2790
    	GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]); //2791

    Bazooka[playerid] = 0;
}
Reply
#4

Variable weapons[MAX_PLAYERS][13][2] is global? Are in top?
Reply
#5

Yes thanks, works correctly, but it will work with other killstreaks like minigun? donґt need to make new variable?
Can you help me how to give back the player weapons if the killstreak ammo get over?
Reply
#6

Quote:
Originally Posted by karoliko
Посмотреть сообщение
Yes thanks, works correctly, but it will work with other killstreaks like minigun? donґt need to make new variable?
Can you help me how to give back the player weapons if the killstreak ammo get over?
The variable weapons will store ALL weapons the player.
My English is very bad, I do not understand what you say with "killstreaks ".

Create a base of the code you want, I'll go guiding you.
Reply
#7

їEspaсol?
Look when player use cmd:bazooka, he get bazooka with 5 ammo, and if he shot all missiles and weapon ammo is 0, kill timer and give player data weapons.
Reply
#8

Espaсol and better! haha
I am Brazilian and I can understand better.
Reply
#9

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Try
Код:
new Bazooka[MAX_PLAYERS]; // global
new weapons[MAX_PLAYERS][13][2]; // global

CMD:bazooka(playerid, params[])
{
    if (Bazooka[playerid] == 1)
    {
       GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~r~ ЎBAZOOKA EN USO!",10000,3);
       for (new i = 0; i <= 12; i++)
       {
           GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
       }
       ResetPlayerWeapons(playerid);
       GivePlayerWeapon(playerid,35,5);
       SetTimerEx("TiempoBazooka", 20000, false, "i", playerid);
       for(new i = 0; i < MAX_PLAYERS; i++)
       PlayerPlaySound(i, 6400, 0.0, 0.0, 0.0);
    }
    else
   {
		PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
		SendClientMessage(playerid, rojo, "[ERROR]{FFFFFF} No tienes ninguna minigun para usar.");
   }
   return 1;
}

forward TiempoBazooka(playerid);
public TiempoBazooka(playerid)
{
    ResetPlayerWeapons(playerid);
	
	for(new i = 0; i < sizeof weapons; i ++)
		GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
	
    Bazooka[playerid] = 0;
}
Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Espaсol and better! haha
I am Brazilian and I can understand better.
Mira cuando el jugador ejecuta el comando /bazooka obtiene el bazooka con 5 misiles, pero cuando dispare todos los misiles antes de terminar el timer TiempoBazooka que le den las armas que tenнa antes.
BAZOOKA AMMO == 0 GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
Reply
#10

Try
Код:
new Bazooka[MAX_PLAYERS]; // global
new weapons[MAX_PLAYERS][13][2]; // global
new TimerBz[MAX_PLAYERS];

CMD:bazooka(playerid, params[])
{
    if(Bazooka[playerid] == 1)
    {
       GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~r~ ЎBAZOOKA EN USO!",10000,3);
       for (new i = 0; i <= 12; i++)
       {
           GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
       }
       ResetPlayerWeapons(playerid);
       GivePlayerWeapon(playerid,35,5);
       TimerBz[playerid] = SetTimerEx("TiempoBazooka", 20000, false, "i", playerid);
       for(new i = 0; i < MAX_PLAYERS; i++)
       PlayerPlaySound(i, 6400, 0.0, 0.0, 0.0);
    }
    else
   {
		PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
		SendClientMessage(playerid, rojo, "[ERROR]{FFFFFF} No tienes ninguna minigun para usar.");
   }
   return 1;
}

public OnPlayerUpdate(playerid)
{
	if(Bazooka[playerid] == 1)
    {
		new GetAmmo, GetWeapon;
		
		GetPlayerWeaponData(playerid, 7, GetWeapon, GetAmmo);
		
		if(GetAmmo < 1) 
			return KillTimer(TimerBz[playerid]),
			TiempoBazooka(playerid);
	}
	return 1;
}

forward TiempoBazooka(playerid);
public TiempoBazooka(playerid)
{
    ResetPlayerWeapons(playerid);
	
	for(new i = 0; i < sizeof weapons; i ++)
		GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
	
    Bazooka[playerid] = 0;
	
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)