dimanche 30 août 2015

Windows Server 2012 Portfowarding

Hello, i just portfoward my server from Windows Server 2012 . i open samp-server.exe but my server are not hosted at internet. other player can't join it.


Code:

TCP: 7777
UDP: 7777

Code:

echo Executing Server Config...
lanmode 0
rcon_password mypass
maxplayers 50
port 7777
hostname My Samp Server
gamemode0 grandlarc 1
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_elevator attachments skinchanger vspawner ls_mall ls_beachside
announce 0
chatlogging 0
weburl [url]http://ift.tt/1Q1jBbL;
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]
language English


Code:

i also already change the gamemode name to grandlarc,  lanmode from 0 to 1 , annouce 0 to 1 .
its dosen't work too.



Crashing problem

Well, i have big problem with server crashing, i mean, testing server, not hosted one... The problem is with every single command ... When i type command and press enter server just crash ... And it's not just 1 command, its every cmd in gamemode ... There is no warnings or errors in it , so i dont know what should i fix ... Help :P


OBJECT + + + REP !!!!!!!!!!!!!!

When you get to the object shows, disappears !
HELP , BAD ENGLISH , + + + REP !!!


unconscious system

im using this unconscious system.
Code:

///////////////////////
////////SWEMike////////
///////made this///////
////////script/////////
////////himself////////
///////////////////////

#include <a_samp>
#include "../include/gl_common.inc"

//--Settings--
#define DIZZ_WAIT        5 //Seconds to wait until player gets dizzy.
#define FULL_WAIT  40 //Seconds after becoming dizzy to wait until the player regains full control.
//------------

#define COLOR_NOTICE 0xFF7F00FF

forward RegainCons1(playerid);
forward RegainCons2(playerid);
forward DeathRC(playerid);
forward SimpleDrunk(playerid);

enum pInfo
{
        pKO,
        pDrunk,
};

new PlayerInfo[MAX_PLAYERS][pInfo];

new Keys,up,down;
new Float:PlayerHP;
new RC1tim;
new RC2tim;
new WaitSeconds = DIZZ_WAIT * 1000;
new RCWaitSeconds = FULL_WAIT * 1000;
               
public OnFilterScriptInit()
{
        print("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
        print("|        SWEMike's Knockout        |");
        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        new cmd[256];
        new idx;
        cmd = strtok(cmdtext, idx);
        //--TEST--
        if(IsPlayerAdmin(playerid))
        {
                if(strcmp(cmd, "/knockout", true) == 0)
                {
                        SetPlayerHealth(playerid, 20);
                        return 1;
                }
        }
        return 0;
}

public OnPlayerDeath(playerid, killerid, reason)
{
        DeathRC(playerid);
        return 1;
}

public OnPlayerUpdate(playerid)
{
        GetPlayerKeys(playerid,Keys,up,down);
        if(!IsPlayerInAnyVehicle(playerid))
        {
            if(PlayerInfo[playerid][pDrunk] == 1)
            {
                        if(Keys == KEY_JUMP || Keys == KEY_SECONDARY_ATTACK || Keys == KEY_FIRE || Keys == KEY_ACTION || Keys == KEY_WALK)
                        {
                            SimpleDrunk(playerid);
                        }
                }
        }
    new string[256];
    GetPlayerHealth(playerid, PlayerHP);
        if(PlayerHP <= 20 && PlayerInfo[playerid][pKO] == 0)
        {
                format(string, sizeof(string), "You have been knocked out, please wait %d seconds to regain your consciousness.", DIZZ_WAIT);
                SendClientMessage(playerid, COLOR_NOTICE, string);
                TogglePlayerControllable(playerid, true);
                if(!IsPlayerInAnyVehicle(playerid))
                {
                        ClearAnimations(playerid);
                        ApplyAnimation(playerid, "BEACH", "CRCKIDLE1", 4.1, 1, 1, 1, 1, 1);
                }
                RC1tim = SetTimerEx("RegainCons1", WaitSeconds, false, "i", playerid);
                PlayerInfo[playerid][pKO] = 1;
        }
        else if(PlayerHP > 20 && PlayerInfo[playerid][pKO] == 1)
        {
        PlayerInfo[playerid][pKO] = 0;
        SetPlayerDrunkLevel(playerid, 0);
        ClearAnimations(playerid);
        }
        return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
        return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
        return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
        return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
        return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
        return 1;
}

public RegainCons1(playerid)
{
        SendClientMessage(playerid, COLOR_NOTICE, "You have regained your consciousness but you are very dizzy.");
        TogglePlayerControllable(playerid, true);
        SetPlayerDrunkLevel(playerid, 20000);
        if(!IsPlayerInAnyVehicle(playerid))
        {
                ClearAnimations(playerid);
            ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
                PlayerInfo[playerid][pDrunk] = 1;
        }
        RC2tim = SetTimerEx("RegainCons2", RCWaitSeconds, false, "i", playerid);
        return 1;
}

public RegainCons2(playerid)
{
        SendClientMessage(playerid, COLOR_NOTICE, "You have fully regained control over your body and can continue normally.");
        SetPlayerDrunkLevel(playerid, 0);
        PlayerInfo[playerid][pDrunk] = 0;
        ClearAnimations(playerid);
        return 1;
}

public DeathRC(playerid)
{
        KillTimer(RC1tim);
        KillTimer(RC2tim);
        PlayerInfo[playerid][pKO] = 0;
        SetPlayerDrunkLevel(playerid, 0);
        PlayerInfo[playerid][pDrunk] = 0;
        ClearAnimations(playerid);
        return 1;
}

public SimpleDrunk(playerid)
{
    ClearAnimations(playerid);
    ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
}

How do i change the animation when i get hurt and delete the freeze?


ID Problem.

I have a problem with the ID safes!
HTML Code:

CMD:debug(playerid, params [])
{
    printf("Drugs: %d", Safes[1][Drugs]); // [1] = Safe ID from Database MYSQL.
    return 1;
}

.log:
HTML Code:

Drugs: 96
It would need to show "Drugs 450", but I look for id 2 of the database.



samedi 29 août 2015

How to make spawn places in different cities

I want that if a player logins he may be asked to spawn at either,
Los Santos
Las ventures
San fierro

How can I do this


help unknown server +1 rep for help-me

anyone who can help me +1 rep
help me please guys
error:



my folder plugins



my server.cfg
PHP Code:

echo Executing Server Config... 
lanmode 0 
rcon_password minhapikasv 
maxplayers 5 
port 7777 
hostname 
[ProjectZ] Testing script 
gamemode0 projectz 
filterscripts  
plugins sscanf
.dll streamer.dll 
announce 1 
query 1 
weburl www
.meusite.com 
onfoot_rate 40 
incar_rate 40 
weapon_rate 40 
stream_distance 300.0 
stream_rate 1000 
maxnpc 100 
logtimeformat 
[%H:%M:%S] 

my gamemode
PHP Code:

//================================================================== 
#include <a_samp> 
#include <ZCMD> 
#include <sscanf> 
#include <DOF2> 

//====================DEFINES======================================= 
#define D_Registrar     100 
#define D_Logar         101 
#define D_Sexo          102 
#pragma tabsize 0 
//================================================================== 

#pragma unused ret_memcpy 
//Cores 
#define COLOR_LBLUE    0x1E90FFFF 
#define    COLOR_ERROR    0xFF0000FF 
#define ID 1 

//Kick & ban 
#define KickP(%0)    SetTimerEx("KickPlayer", 500, false, "i", %0) 

//Player configs 
#define    CONTASS    "Contas/%s.ini" 
//================================================================== 
new Float:coordSpawn[3]; 
new 
morreu[MAX_PLAYERS]; 

enum PlayerInfo 
{ 
    
Skin, 
    
Spawn, 
    
Errosenha, 
    
StatsSpawn, 
}; 
new 
pInfo[MAX_PLAYERS][PlayerInfo]; 

//==================Spawns variados================ 
new Float:Spawnrandonplayers[11][3] = { 
    {
690.2013,-467.9773,16.5363}, 
    {-
1546.1204,-2731.1055,48.5391}, 
    {-
1271.9763,2712.9788,50.2663}, 
    {
1354.9606,475.5364,20.1606}, 
    {-
41.8467,1179.1769,19.3797}, 
    {-
227.3263,985.0326,19.5998}, 
    {
1580.0342,-1635.5411,13.5604}, 
    {
1608.0400,-1670.4852,6.2188}, 
    {-
1617.0948,685.4459,7.1875}, 
    {-
1598.6437,734.0104,-4.9063}, 
    {
2264.9048,2445.0249,10.8203} 
}; 
//==================Spawns variados================ 
//================================================================== 

main() 
{ 
} 


public 
OnGameModeInit() 
{ 
    
SetTimer("hoursplaying", 30*60*1000, true); 

    return 
1; 
} 

public 
OnGameModeExit() 
{ 
    
DOF2_Exit(); 
    return 
1; 
} 


public 
OnPlayerConnect(playerid) 
{ 
    
pInfo[playerid][Errosenha] = 0; 
    
SetPlayerColor(playerid, 0xFFFFFFFF); 
    
//======================================== 
     
    
return 1; 
} 

public 
OnPlayerDisconnect(playerid, reason) 
{ 
    
SalvarPlayer(playerid); 
    
pInfo[playerid][Spawn] = 0; 
    
pInfo[playerid][StatsSpawn] = 0; 
    
pInfo[playerid][Errosenha] = 0; 
    
//======================================== 
         
    
return 1; 
} 

public 
OnPlayerRequestClass(playerid, classid) 
{ 
    
//Login e registro 
    
new pArquivos[50], String[256]; 
    
format(pArquivos, sizeof(pArquivos), CONTASS, PegarNome(playerid)); 
    if(!
DOF2_FileExists(pArquivos)) 
    { 
        
format(String, sizeof(String), "{FFFFFF}Bem vindo ao Essence DayZ \n\n{FFFFFF}Nome:  {FF0000}%s \n\n{FFFFFF}Status:  {FF0000}Registrado(a)", PegarNome(playerid)); 
        
ShowPlayerDialog(playerid, D_Registrar, DIALOG_STYLE_INPUT, "Registro (x)", String, "Registrar", ""); 
    } 
    else 
    { 
        
format(String, sizeof(String), "{FFFFFF}Bem vindo ao Essence DayZ \n\n{FFFFFF}Nome:  {00FF04}%s \n\n{FFFFFF}Status:  {00FF04}Registrado(a)", PegarNome(playerid)); 
        
ShowPlayerDialog(playerid, D_Logar, DIALOG_STYLE_PASSWORD, "Logando (x)", String, "Entrar", "Sair"); 
        
pInfo[playerid][Spawn] = 0; 
    } 
    return 
1; 
} 


public 
OnPlayerRequestSpawn(playerid) 
{ 
    if(
pInfo[playerid][StatsSpawn] == 0) 
    { 
        
SendClientMessage(playerid, COLOR_ERROR, "Spere carregar ai Viado!"); 
        return 
0; 
    } 
    else 
    { 
        
SpawnPlayer(playerid); 
    } 
    return 
1; 
} 

public 
OnPlayerSpawn(playerid) 
{ 
        
SetPlayerSkin(playerid, pInfo[playerid][Skin]); 
         
        if(
morreu[playerid]) { 
        new 
rand = random(sizeof(Spawnrandonplayers)); 
        
SetPlayerPos(playerid, Spawnrandonplayers[rand][0], Spawnrandonplayers[rand][1], Spawnrandonplayers[rand][2]); 
        
SetPlayerVirtualWorld(playerid, 0); 
        
SetCameraBehindPlayer(playerid); 
        
morreu[playerid] = false; 
        } 
        
//======================================== 

    
return 1; 
} 

public 
OnPlayerDeath(playerid, killerid, reason) 
{ 
    
//pInfo[playerid][Spawn] = 1; 
    
morreu[playerid] = true; 

    
SetTimerEx("Dialog_Sexo", 7000, 0, "i", playerid); // Cria um timer de 4 segundos sem repetiçao 

    //======================================== 
     
    
return 1; 
} 

public 
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{ 
    
//Registro 
    
new    pArquivos[50]; 
    
format(pArquivos, sizeof(pArquivos), CONTASS, PegarNome(playerid)); 

    if(
dialogid ==  D_Registrar) 
    { 
        if(
response) 
        { 
            if(!
strlen(inputtext)) return ShowPlayerDialog(playerid, D_Registrar, DIALOG_STYLE_PASSWORD, "{FFFFFF}Bem vindo ao Essence DayZ \n\n{FFFFFF}Nome:  {FF0000}%s \n\n{FFFFFF}Status:  {FF0000}Nao Registrado(a)", "Registro", "", PegarNome(playerid)); 
            
DOF2_CreateFile(pArquivos); 
            
DOF2_SetString(pArquivos, "Senha", inputtext); 
            
DOF2_SaveFile(); 
            
SalvarPlayer(playerid); 
            
SpawnPlayer(playerid); 
            
pInfo[playerid][Spawn] = 1; 
            
ShowPlayerDialog(playerid, D_Sexo, DIALOG_STYLE_MSGBOX,"> Escolha seu Sexo <","Escolha seu Sexo:","Masculino","Feminino"); 
            return 
1; 
        } 
        
SendClientMessage(playerid, COLOR_ERROR, "Voce foi kickado por nao se registrar!"); 
        
KickP(playerid); 
    } 
    
//Login 
    
if(dialogid == D_Logar) 
    { 
        if(
response) 
        { 
            if(!
strlen(inputtext))return ShowPlayerDialog(playerid,D_Logar,DIALOG_STYLE_PASSWORD, "{FFFFFF}Bem vindo ao Essence DayZ \n\n{FFFFFF}Nome:  {00FF04}%s \n\n{FFFFFF}Status:  {00FF04}Registrado(a)", "Entrar", "Sair", PegarNome(playerid)); 
            if(!
strcmp(DOF2_GetString(pArquivos, "Senha"), inputtext)) 
            { 
                
SendClientMessage(playerid, 0x00FF00FF, "Logado com susesso!"); 
                
CarregarPlayer(playerid); 
                
SpawnPlayer(playerid); 
                
pInfo[playerid][Spawn] = 0; 
                
SetPlayerPos(playerid, coordSpawn[0], coordSpawn[1], coordSpawn[2]); 
                return 
1; 
            } 
            if(
pInfo[playerid][Errosenha] == 2) 
            { 
                
SendClientMessage(playerid, COLOR_ERROR, "Voce sera kickado apos errar 3 vezes!"); 
                
KickP(playerid); 
                return 
1; 
            } 
            
pInfo[playerid][Errosenha]++; 
            
ShowPlayerDialog(playerid, D_Logar, DIALOG_STYLE_PASSWORD, "Logando (x)", "{FFFFFF}A senha esta errada.\nPor Favor tente novamente!", "Entrar", "Sair"); 
            return 
1; 
        } 
        
KickP(playerid); 
    } 
    if(
dialogid == D_Sexo) 
    { 
        if(
response) 
        { 
            
SendClientMessage(playerid,-1,"{261BF7}Voce escolheu o Sexo Masculino."); 
            
SetPlayerSkin(playerid, 144); 
        } 
        else 
        { 
            
SendClientMessage(playerid,-1,"{F71BDE}Voce escolheu o Sexo Feminino."); 
            
SetPlayerSkin(playerid, 56); 
        } 
    } 
    return 
1; 
} 



//======================================CMDS====================================================== 
CMD:sexo(playerid, params[]) 
{ 
    
ShowPlayerDialog(playerid, D_Sexo, DIALOG_STYLE_MSGBOX,"> Escolha seu Sexo <","Escolha seu Sexo:","Masculino","Feminino"); 
    return 
1; 
} 


CMD:wearsurvival(playerid, params[]) 
{ 

    
SetPlayerAttachedObject(playerid,ID , 19904, 1, 0.099999, 0.056999, -0.009999, 2.999997, 88.000030, -177.800109, 1.381999, 1.000000, 1.364999, 0, 0); 
    
SetPlayerHealth(playerid,300); 
    
SendClientMessage(playerid,-1 , "suit active" ) ; 
    return 
1; 
} 

CMD:survivaloff(playerid, params[]) 
{ 
    for(new 
i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++) 
     { 
      if(
IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i); 
    
SetPlayerHealth(playerid,100); 
     } 
    return 
1; 
} 

// para testes 
CMD:ls(playerid, params[]) 
{ 
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1, "minha pika disgraça"); 
    
SetPlayerPos(playerid, 358.8322,-2072.4692,10.6953); 
    
SendClientMessage(playerid, -1, " voce foi teleportado para ls "); 
    return 
1; 
} 

CMD:nrg(playerid, params[]) 
{ 
    new 
NRG[MAX_PLAYERS]; 
    if(
NRG[playerid] != 0) DestroyVehicle(NRG[playerid]); 
    new 
Float:x, Float:y, Float:z; GetPlayerPos(playerid, x,y,z); 
    
NRG[playerid] = CreateVehicle(560, x,y,z, 1.0, -1,-1, 99); 
    
PutPlayerInVehicle(playerid, NRG[playerid], 0); 
    return 
1; 
} 

CMD:morrer(playerid, params[]) 
{ 
    
SetPlayerHealth(playerid, 0); 
    return 
1; 
} 

CMD:surv(playerid, params[]) 
{ 
    
EditAttachedObject(playerid, 19904); 
    
SetPlayerAttachedObject(playerid, 0, 19904, 2); 
    return 
1; 
} 

 
// para testes 
//=======================================CMDS===================================================== 


//=================[STOCKS DO SERVIDOR]================ 
stock PegarNome(playerid) 
{ 
    new 
Name[MAX_PLAYER_NAME]; 
    
GetPlayerName(playerid, Name, MAX_PLAYER_NAME); 
    return 
Name; 
} 

stock SalvarPlayer(playerid) 
{ 
    new 
pArquivos[50]; 
    
format(pArquivos, sizeof(pArquivos), CONTASS, PegarNome(playerid)); 
    if(
DOF2_FileExists(pArquivos)) 
    { 
        
DOF2_SetInt(pArquivos, "Level", GetPlayerScore(playerid)); 
        
DOF2_SetInt(pArquivos, "Skin", GetPlayerSkin(playerid)); 
        
DOF2_SetInt(pArquivos, "Spawn", pInfo[playerid][Spawn]); 

        
GetPlayerPos(playerid, coordSpawn[0], coordSpawn[1], coordSpawn[2]); 
        
DOF2_SetFloat(pArquivos, "PozicaoX", coordSpawn[0]); 
        
DOF2_SetFloat(pArquivos, "PozicaoY", coordSpawn[1]); 
        
DOF2_SetFloat(pArquivos, "PozicaoZ", coordSpawn[2]); 
        
DOF2_SaveFile(); 
    } 
    return 
1; 
} 

stock CarregarPlayer(playerid) 
{ 
    new 
pArquivos[50]; 
    
format(pArquivos, sizeof(pArquivos), CONTASS, PegarNome(playerid)); 
    if(
DOF2_FileExists(pArquivos)) 
    { 
        
SetPlayerScore(playerid, DOF2_GetInt(pArquivos, "Level")); 
        
SetPlayerSkin(playerid, DOF2_GetInt(pArquivos, "Skin")); 
        
pInfo[playerid][Spawn] = DOF2_GetInt(pArquivos, "Spawn"); 

        
coordSpawn[0] = DOF2_GetFloat(pArquivos, "PozicaoX"); 
        
coordSpawn[1] = DOF2_GetFloat(pArquivos, "PozicaoY"); 
        
coordSpawn[2] = DOF2_GetFloat(pArquivos, "PozicaoZ"); 
    } 
    return 
1; 
} 

forward KickPlayer(playerid); 
public 
KickPlayer(playerid) 
{ 
    
Kick(playerid); 
    return 
1; 
} 

forward HorasJogadas(playerid); 
public 
HorasJogadas(playerid) 
{ 
    
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1); 
    
SendClientMessage(playerid, -1, "Voce Acaba De Ganhar 1 De Score Por Estar Jogando A 5 Horas."); 
    return 
true; 
} 

forward Dialog_Sexo(playerid); 
public 
Dialog_Sexo(playerid) // Chama o Timer e activa-o 
{ 
    
ShowPlayerDialog(playerid, D_Sexo, DIALOG_STYLE_MSGBOX,"> Escolha seu Sexo <","Escolha seu Sexo:","Masculino","Feminino"); 
    
// Mostra o Dialog depois de 4 segundos 
}