PDA

View Full Version : [AJUDA]ResetPlayerWeapons


RedBulL_x
08/12/2011, 08:43 PM
Estava tentando criar uma Favela e quando entrasse na GangZone da Favela ganhasse o kit de armas e quando sair retirasse essas armas. Mas não esta dando muito certo quando eu entro na favela fico ganhando e resetando as armas. Segue o CODE se alguém poder me ajudar eu agradeço, REPUT!


public locais(playerid)
for (new i=0;i<MAX_PLAYERS;i++){
if(IsPlayerConnected(i)){
//======================= Favela ==========================
if(IsPlayerInPlace(i,2016.010986, -1161.922363, 2324.010986, -923.518310)){
DMLiberado2[i] = 1;
GangZoneFlashForAll(favela,0xFFFFFFAA);
GameTextForPlayer(i,"DM Liberado",1000,1);
GivePlayerWeapon(i, 24, 999);
GivePlayerWeapon(i, 9, 1);
GivePlayerWeapon(i, 25, 999);
GivePlayerWeapon(i, 26, 999);
GivePlayerWeapon(i, 30, 999);
GivePlayerWeapon(i, 32, 999);

} else {
if(DMLiberado2[i] == 1){
DMLiberado2[i] = 0;
GangZoneStopFlashForAll(favela);
ResetPlayerWeapons(playerid);
}
}

Bruno[]Lima
08/12/2011, 09:40 PM
Arrumei o código e identei. Tente agora, lembrando que não testei, mas acho que irá funcionar!

// ~~> Topo:

new EntrouFavela[MAX_PLAYERS], SaiuFavela[MAX_PLAYERS];

public locais(playerid)
{
for (new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
//======================= Favela ==========================
if(IsPlayerInPlace(i,2016.010986, -1161.922363, 2324.010986, -923.518310))
{
EntrouFavela[i] = 1;
if(EntrouFavela[1] == 1)
{
DMLiberado2[i] = 1;
GangZoneFlashForAll(favela,0xFFFFFFAA);
GameTextForPlayer(i,"DM Liberado",1000,1);
GivePlayerWeapon(i, 24, 999);
GivePlayerWeapon(i, 9, 1);
GivePlayerWeapon(i, 25, 999);
GivePlayerWeapon(i, 26, 999);
GivePlayerWeapon(i, 30, 999);
GivePlayerWeapon(i, 32, 999);
EntrouFavela[i] = 0;
}
else
{
if(DMLiberado2[i] == 1)
{
if(SaiuFavela[i] == 1)
{
DMLiberado2[i] = 0;
GangZoneStopFlashForAll(favela);
ResetPlayerWeapons(i);
SaiuFavela[i] = 0;
}
}

RedBulL_x
08/12/2011, 11:08 PM
Man não deu certo, apareceu os seguintes erros.


C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(1246) : error 004: function "CarregCar" is not implemented
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2184) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2185) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2186) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2187) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2188) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2189) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2190) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2200) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2201) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2202) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2199) : warning 204: symbol is assigned a value that is never used: "index"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2682) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2682) : error 033: array must be indexed (variable "cmd")
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2977) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2977) : error 033: array must be indexed (variable "tmp")
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2983) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(2983) : error 033: array must be indexed (variable "tmp")
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3020) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3020) : error 033: array must be indexed (variable "tmp")
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3041) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3041) : error 033: array must be indexed (variable "tmp")
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3110) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3110) : error 033: array must be indexed (variable "tmp")
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3141) : error 017: undefined symbol "strtok"
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3141) : error 033: array must be indexed (variable "tmp")
C:\Users\micro\Desktop\SAMP\Brasil CityGames RPG [GM]\gamemodes\RPG.pwn(3170) : error 017: undefined symbol "strtok"

lucas_mdr1235
08/12/2011, 11:49 PM
apaga o seu e coloca esse aki

public locais(playerid)
{
if(IsPlayerConnected(playerid))
{
//======================= Favela ==========================
if(IsPlayerInPlace(playerid,2016.010986, -1161.922363, 2324.010986, -923.518310))
{
DMLiberado2[playerid] = 1;
GangZoneFlashForAll(favela,0xFFFFFFAA);
GameTextForPlayer(playerid,"DM Liberado",1000,1);
GivePlayerWeapon(playerid, 24, 999);
GivePlayerWeapon(playerid, 9, 1);
GivePlayerWeapon(playerid, 25, 999);
GivePlayerWeapon(playerid, 26, 999);
GivePlayerWeapon(playerid, 30, 999);
GivePlayerWeapon(playerid, 32, 999);

}
else
{
DMLiberado2[playerid] = 0;
GangZoneStopFlashForAll(favela);
ResetPlayerWeapons(playerid);
}
}
return 1;
}

RedBulL_x
09/12/2011, 12:02 AM
Não ta dando certo, fica dando e tirando as armas.

lucas_mdr1235
09/12/2011, 12:07 AM
fail editei meu post esclui o seu e copia de novo

caso o problema persistir e pq vc nao pego as cordenadas certo ai e so vc seguir o tutorial a seguir de como pegar as cordenadas

http://forum.sa-mp.com/showthread.php?t=164588

RedBulL_x
09/12/2011, 12:13 AM
Mano as cordenada tá certa, vou postar a public inteira.

public locais(playerid)
for (new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(playerid))
{
//======================= Favela ==========================
if(IsPlayerInPlace(playerid,2016.010986, -1161.922363, 2324.010986, -923.518310))
{
DMLiberado2[playerid] = 1;
GangZoneFlashForAll(favela,0xFFFFFFAA);
GameTextForPlayer(playerid,"DM Liberado",1000,1);
GivePlayerWeapon(playerid, 24, 999);
GivePlayerWeapon(playerid, 9, 1);
GivePlayerWeapon(playerid, 25, 999);
GivePlayerWeapon(playerid, 26, 999);
GivePlayerWeapon(playerid, 30, 999);
GivePlayerWeapon(playerid, 32, 999);

}
else
{
if(DMLiberado2[playerid] == 1)
{
DMLiberado2[playerid] = 0;
GangZoneStopFlashForAll(favela);
ResetPlayerWeapons(playerid);
}
}
}
//======================= Area DM LV ==========================
if(IsPlayerInPlace(i,1267.535, 2084.409, 1408.109, 2235.263)){
DMLiberado2[i] = 1;
GangZoneFlashForAll(areadmlv,0xFFFFFFAA);
} else {
if(DMLiberado2[i] == 1){
DMLiberado2[playerid] = 0;
GangZoneStopFlashForAll(areadmlv);
}
}
//
if(PlayerToPoint(7.0, i, 70.4532,1219.1954,18.8117) || PlayerToPoint(7.0, i, -90.2719,-1169.9579,2.3964) || PlayerToPoint(7.0, i, -2411.5728,976.1896,45.4609) || PlayerToPoint(7.0, i, 2114.8413,919.9194,10.8203)){//Fort Carson
GameTextForPlayer(i,"~h~~w~Posto ~y~Petobras ~n~ Digite~r~/~r~abastecer",3000,4);
AreaPosto[i] = 1;
} else {
if(AreaPosto[i] == 1){
AreaPosto[i] = 0;
}
if (PlayerToPoint(7.0, i, 2638.9553,1107.1788,10.8203) || PlayerToPoint(7.0, i, 1595.6233,2199.6162,10.8203) || PlayerToPoint(7.0, i, 1940.8671,-1773.2283,13.3906) || PlayerToPoint(5.0, i, -2243.8435,-2560.5598,31.9219)){//Posto LV
GameTextForPlayer(i,"~h~~w~Posto ~y~Shell ~n~Digite~r~/abastecer",3000,4);
AreaPosto[i] = 1;
} else {
if(AreaPosto[i] == 1){
AreaPosto[i] = 0;
}
if (PlayerToPoint(7.0, i, 1382.3647,459.0785,20.3452) || PlayerToPoint(8.0, i, -1675.4781,413.1594,7.1797) || PlayerToPoint(7.0, i, 655.5922,-565.3943,16.3359) || PlayerToPoint(7.0, i, -1606.3616,-2713.5872,48.5335)){//Posto LS/SF
GameTextForPlayer(i,"~h~~w~Posto ~y~Ipiranga ~n~Digite~r~/abastecer",3000,4);
AreaPosto[i] = 1;
} else {
if(AreaPosto[i] == 1){
AreaPosto[i] = 0;
}
if(IsPlayerInPlace(i,576.3771, 1662.789, 619.3304, 1709.206) || PlayerToPoint(7.0, i, 1004.1403,-937.8801,42.1797) || PlayerToPoint(7.0, i, 2202.1230,2476.8582,10.8203) || PlayerToPoint(6.0, i, 417.2369,-1912.7708,1.5641)){//Posto acima FC
GameTextForPlayer(i,"~w~Posto ~y~Texaco ~n~Digite~r~/abastecer",3000,4);
AreaPosto[i] = 1;
} else {
if(AreaPosto[i] == 1){
AreaPosto[i] = 0;
}
}
}
}
}
}


Não é identado porque é GM MUCA.

lucas_mdr1235
09/12/2011, 12:23 AM
tenta

public locais(playerid)
{
if(IsPlayerConnected(playerid))
{
//======================= Favela ==========================
if(IsPlayerInPlace(playerid,2016.010986, -1161.922363, 2324.010986, -923.518310))
{
DMLiberado2[playerid] = 1;
GangZoneFlashForAll(favela,0xFFFFFFAA);
GameTextForPlayer(playerid,"DM Liberado",1000,1);
GivePlayerWeapon(playerid, 24, 999);
GivePlayerWeapon(playerid, 9, 1);
GivePlayerWeapon(playerid, 25, 999);
GivePlayerWeapon(playerid, 26, 999);
GivePlayerWeapon(playerid, 30, 999);
GivePlayerWeapon(playerid, 32, 999);

}
else
{
if(DMLiberado2[playerid] == 1)
{
DMLiberado2[playerid] = 0;
GangZoneStopFlashForAll(favela);
ResetPlayerWeapons(playerid);
}
}
//======================= Area DM LV ==========================
if(IsPlayerInPlace(playerid,1267.535, 2084.409, 1408.109, 2235.263))
{
DMLiberado2[playerid] = 1;
GangZoneFlashForAll(areadmlv,0xFFFFFFAA);
}
else
{
if(DMLiberado2[playerid] == 1)
{
DMLiberado2[playerid] = 0;
GangZoneStopFlashForAll(areadmlv);
}
}
if(PlayerToPoint(7.0, playerid, 70.4532,1219.1954,18.8117) || PlayerToPoint(7.0, playerid, -90.2719,-1169.9579,2.3964) || PlayerToPoint(7.0, playerid, -2411.5728,976.1896,45.4609) || PlayerToPoint(7.0, playerid, 2114.8413,919.9194,10.8203))
{
GameTextForPlayer(playerid,"~h~~w~Posto ~y~Petobras ~n~ Digite~r~/~r~abastecer",3000,4);
AreaPosto[playerid] = 1;
}
else
{
if(AreaPosto[playerid] == 1)
{
AreaPosto[playerid] = 0;
}
}
if (PlayerToPoint(7.0, playerid, 2638.9553,1107.1788,10.8203) || PlayerToPoint(7.0, playerid, 1595.6233,2199.6162,10.8203) || PlayerToPoint(7.0, playerid, 1940.8671,-1773.2283,13.3906) || PlayerToPoint(5.0, playerid, -2243.8435,-2560.5598,31.9219))
{
GameTextForPlayer(playerid,"~h~~w~Posto ~y~Shell ~n~Digite~r~/abastecer",3000,4);
AreaPosto[playerid] = 1;
}
else
{
if(AreaPosto[playerid] == 1)
{
AreaPosto[playerid] = 0;
}
}
if (PlayerToPoint(7.0, playerid, 1382.3647,459.0785,20.3452) || PlayerToPoint(8.0, playerid, -1675.4781,413.1594,7.1797) || PlayerToPoint(7.0, playerid, 655.5922,-565.3943,16.3359) || PlayerToPoint(7.0, playerid, -1606.3616,-2713.5872,48.5335))
{
GameTextForPlayer(playerid,"~h~~w~Posto ~y~Ipiranga ~n~Digite~r~/abastecer",3000,4);
AreaPosto[playerid] = 1;
}
else
{
if(AreaPosto[playerid] == 1)
{
AreaPosto[playerid] = 0;
}
}
if(IsPlayerInPlace(playerid,576.3771, 1662.789, 619.3304, 1709.206) || PlayerToPoint(7.0, playerid, 1004.1403,-937.8801,42.1797) || PlayerToPoint(7.0, playerid, 2202.1230,2476.8582,10.8203) || PlayerToPoint(6.0, playerid, 417.2369,-1912.7708,1.5641))
{
GameTextForPlayer(playerid,"~w~Posto ~y~Texaco ~n~Digite~r~/abastecer",3000,4);
AreaPosto[playerid] = 1;
}
else
{
if(AreaPosto[playerid] == 1)
{
AreaPosto[playerid] = 0;
}
}
}
return 1;
}

ai se nao der e suas cordenadas mesmo ai vc segue o tutorial
http://forum.sa-mp.com/showthread.php?t=164588

ajudei ??? +rep :)

RedBulL_x
09/12/2011, 12:24 AM
Mano até as armas que compro na Amuu Nation são resetadas, o que deve ser ?

lucas_mdr1235
09/12/2011, 12:26 AM
e caraiu se tinha q ter falado antes TROLL poste sua public OnPlayerUpdate

RedBulL_x
09/12/2011, 12:30 AM
Descubri agora mano, tençu -,-'

http://pastebin.com/nExRW1zC - OnPlayerUpdate

lucas_mdr1235
09/12/2011, 12:33 AM
atualizo a public ? atualiza la

RedBulL_x
09/12/2011, 12:36 AM
Mano agora não são resetadas mais, Mais fica dando as armas sem parar não tem como dar uma vez só ? e quando eu saio da favela as armas não são resetadas, lol

Bruno[]Lima
09/12/2011, 12:59 AM
Desculpe, eu esqueci de fechar uma chave, e também tinha um erro, tente agora:
public locais(playerid)
for (new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(playerid))
{
//======================= Favela ==========================
if(IsPlayerInPlace(playerid,2016.010986, -1161.922363, 2324.010986, -923.518310))
{
if(EntrouFavela[i] == 1)
{
DMLiberado2[playerid] = 1;
GangZoneFlashForAll(favela,0xFFFFFFAA);
GameTextForPlayer(playerid,"DM Liberado",1000,1);
GivePlayerWeapon(playerid, 24, 999);
GivePlayerWeapon(playerid, 9, 1);
GivePlayerWeapon(playerid, 25, 999);
GivePlayerWeapon(playerid, 26, 999);
GivePlayerWeapon(playerid, 30, 999);
GivePlayerWeapon(playerid, 32, 999);
EntrouFavela[i] = 0;
}

}
else
{
if(DMLiberado2[playerid] == 1)
{
if(EntrouFavela[i] == 0)
{
DMLiberado2[playerid] = 0;
GangZoneStopFlashForAll(favela);
ResetPlayerWeapons(playerid);
EntrouFavela = 1;
}
}
}
}

RedBulL_x
09/12/2011, 01:35 AM
Bruno seu CODE nem deu certo, eu não recebo as armas nem o GameText da certo, Lucas seu code as armas quando sai da favela não sçao resetadas :S

RedBulL_x
09/12/2011, 05:00 PM
Alguém me ajuda oõ/

ViniBorn
09/12/2011, 06:01 PM
Tenta aí


public CheckFavela()
{
for(new i,j = GetMaxPlayers(); i!=j; i++)
{
if(IsPlayerConnected(i))
{
//======================= Favela ==========================
if(IsPlayerInPlace(i,2016.010986, -1161.922363, 2324.010986, -923.518310))
{
if(DMLiberado2[i] == 0)
{
DMLiberado2[i] = 1;
GangZoneFlashForAll(favela,0xFFFFFFAA);
GameTextForPlayer(i,"DM Liberado",1000,1);
GivePlayerWeapon(i, 24, 999);
GivePlayerWeapon(i, 9, 1);
GivePlayerWeapon(i, 25, 999);
GivePlayerWeapon(i, 26, 999);
GivePlayerWeapon(i, 30, 999);
GivePlayerWeapon(i, 32, 999);
}
}
else
{
if(DMLiberado2[i] == 1)
{
DMLiberado2[i] = 0;
GangZoneStopFlashForAll(favela);
ResetPlayerWeapons(playerid);
}
}
}
}
return 1;
}