20.10.2015, 15:46
Olб galera, Estou com Problemas para arrumar esse AC, "i" = "Playerid". Ele da debug do Player exato.. que esta com a arma, antes de dar kick, acho que estou setando as variaveis do modo certo..
PHP код:
new ArmaProibida[9][MAX_PLAYERS];
public OnGameModeInit() {
SetTimer("OnSecondTimer",1000,true);
}
PHP код:
public OnPlayerConnect(playerid) {
ArmaProibida[0][playerid] = 0;
ArmaProibida[1][playerid] = 0;
ArmaProibida[2][playerid] = 0;
ArmaProibida[3][playerid] = 0;
ArmaProibida[4][playerid] = 0;
ArmaProibida[5][playerid] = 0;
ArmaProibida[6][playerid] = 0;
ArmaProibida[7][playerid] = 0;
ArmaProibida[8][playerid] = 0;
}
PHP код:
forward OnSecondTimer();
public OnSecondTimer() {
static tmp[5];
if((tmp[0] = GetPlayerWeapon(i)) != 0) {
tmp[0]= GetWeaponSlot(tmp[0]);
GetWeaponData(i,tmp[0],tmp[1],tmp[2]);
GetPlayerWeaponData(i,tmp[0],tmp[3],tmp[4]);
// Debug ant cheat de armas..
printf("SLOT:%i WeapData:%i pWeapData:%i WeapAData:%i pWeapAData:%i",tmp[0],tmp[1],tmp[3],tmp[2],tmp[4]);
if(tmp[1] != tmp[3]) {
if(tmp[1] == 10) {
if(ArmaProibida[0][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 11) {
if(ArmaProibida[1][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 12) {
if(ArmaProibida[2][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 13) {
if(ArmaProibida[3][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 14) {
if(ArmaProibida[4][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 15) {
if(ArmaProibida[5][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 44) {
if(ArmaProibida[6][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 45) {
if(ArmaProibida[7][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 46) {
if(ArmaProibida[8][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
}
if(tmp[2] < tmp[4]) {
if(tmp[1] == 10) {
if(ArmaProibida[0][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 11) {
if(ArmaProibida[1][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 12) {
if(ArmaProibida[2][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 13) {
if(ArmaProibida[3][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 14) {
if(ArmaProibida[4][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 15) {
if(ArmaProibida[5][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 44) {
if(ArmaProibida[6][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 45) {
if(ArmaProibida[7][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
if(tmp[1] == 46) {
if(ArmaProibida[8][i] == 1)
{
return 1;
}
else {
RemoveWeapon(i, tmp[3]); ACKick(i,"Hack Armas");
}
}
}
}
}
return 1;
}
PHP код:
stock givePlayerWeapon(playerid,weaponid,ammo) {
if(weaponid == 10) {
ArmaProibida[0][playerid] = 1;
}
if(weaponid == 11) {
ArmaProibida[1][playerid] = 1;
}
if(weaponid == 12) {
ArmaProibida[2][playerid] = 1;
}
if(weaponid == 13) {
ArmaProibida[3][playerid] = 1;
}
if(weaponid == 14) {
ArmaProibida[4][playerid] = 1;
}
if(weaponid == 15) {
ArmaProibida[5][playerid] = 1;
}
if(weaponid == 44) {
ArmaProibida[6][playerid] = 1;
}
if(weaponid == 45) {
ArmaProibida[7][playerid] = 1;
}
if(weaponid == 46) {
ArmaProibida[8][playerid] = 1;
}
static tmp;
static str[20];
tmp = GetWeaponSlot(weaponid);
format(str,sizeof(str),"weaponslot_%d",tmp);
SetPVarInt(playerid,str,weaponid);
format(str,sizeof(str),"slotammo_%d",tmp);
SetPVarInt(playerid,str,GetPVarInt(playerid,str) + ammo);
GivePlayerWeapon(playerid,weaponid,ammo);
}