SA-MP Forums Archive
Little problem again - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little problem again (/showthread.php?tid=568084)



Little problem again - Mya - 19.03.2015

Hi,

this is my problem, if someone kill me, im automaticly teleported to FARM
how to fix that?

thanks and sorry for my bad english


Re: [HELP]Little problem again :D - CalvinC - 19.03.2015

Do you set the players position in OnPlayerSpawn, if so, show it.


Re: [HELP]Little problem again :D - Mya - 19.03.2015

This is my OnPlayerSpawn Codes :

PHP код:
public OnPlayerSpawn(playerid)
{
    
SetPlayerSkin(playeridPlayerInfo[playerid][Skin]);
    
StopAudioStreamForPlayer(playerid);
    
PlayerPlaySound(playerid11860.00.00.0); // (blank sound) to shut the music up
    
PlayerTextDrawDestroy(playeridTextdraw0[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw1[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw2[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw3[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw4[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw5[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw6[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw7[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw8[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw9[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw10[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw11[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw12[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw13[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw14[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw15[playerid]);
    
PlayerTextDrawDestroy(playeridTextdraw16[playerid]);
    
TextDrawShowForPlayer(playeridu);
    
TextDrawShowForPlayer(playeridsf);
    for(new 
0sizeof(gTextDraw); ++) TextDrawShowForPlayer(playeridgTextDraw[i]);
    for(new 
0sizeof(TPInfo); ++) TextDrawShowForPlayer(playeridTPInfo[i]);
    if (
PlayerInfo[playerid][inDM] == && PlayerInfo[playerid][InParkour] == && PlayerInfo[playerid][GodEnabled] == 0)
    {
        
SpawnProtection(playerid);
    }
    
//-----------------
    // 3D Text Labels
    //-----------------
    
if(PlayerInfo[playerid][VIP] >= 1)
    {
         
VIPLabel[playerid] = Create3DTextLabel("DONATOR"0xFC3A69AA30.040.050.040.00);
         
Attach3DTextLabelToPlayer(VIPLabel[playerid], playerid000.3);
     }
    
//--------------------
    
if (PlayerInfo[playerid][Helmet] == 1)
    {
        
SetPlayerAttachedObject(playerid3RandomHelmet[random(sizeof(RandomHelmet))], 20.101, -0.00.05.5084.6083.7111);
    }
     if(
IsSpecing[playerid] == 1)
    {
        
SetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
        
SetPlayerInterior(playerid,Inter[playerid]);
        
SetPlayerVirtualWorld(playerid,vWorld[playerid]);
        
IsSpecing[playerid] = 0;
        
IsBeingSpeced[spectatorid[playerid]] = 0;
    }
    if(
PlayerInfo[playerid][inDM] > 0) return RespawninDM(playerid);
    if(
PlayerInfo[playerid][inCnr] > 0)
    {
        if(
PlayerInfo[playerid][inCnr] == 1PrepareAsCop(playerid);
        else if(
PlayerInfo[playerid][inCnr] == 2PrepareAsRobber(playerid);
        return 
1;
    }
    
SetPlayerInterior(playerid0), SetPlayerPos(playeridPlayerInfo[playerid][POS_X], PlayerInfo[playerid][POS_Y], PlayerInfo[playerid][POS_Z]);
    
SetCameraBehindPlayer(playerid);
    
SetPlayerVirtualWorld(playerid0);
    return 
1;




Re: [HELP]Little problem again :D - lwilson - 19.03.2015

Do you have OnPlayerDeath code? If so, post it please.


Re: [HELP]Little problem again :D - Mya - 19.03.2015

This Is My OnPlayerDeath Codes :
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
SendDeathMessage(killeridplayeridreason);
    if(
PlayerInfo[playerid][InParkour] > 0)
    {
        
SendClientMessage(playerid, -1""RED"[Parkour]: "GREY"You have died while in parkour! Parkour event has been cancelled..");
        
PlayerInfo[playerid][InParkour] = 0;
    }
    if(
IsBeingSpeced[playerid] == 1)
    {
        for (new 
0MAX_PLAYERSi++)
        {
            if(
spectatorid[i] == playerid)
            {
                
format(strgsizeof(strg), ""STEELBLUE"- AS - {%06x}%s(%d) "STEELBLUE"died while you were spectating, you may resume spectating by using /spec again.", (GetPlayerColor(playerid) >>> 8), GetName(playerid), playerid);
                
SendClientMessage(i, -1strg);
                
TogglePlayerSpectating(i,false);
            }
        }
    }
    
GameTextForPlayer(playerid"~r~DEAD!"30003);
    
PlayerInfo[playerid][Deaths]++;
    if(
killerid != INVALID_PLAYER_ID)
    {
        if(
PlayerInfo[killerid][ClanID] != 0)
        {
            new 
query[128];
            
mysql_format(MySQLquery128"SELECT `cScore` FROM `"Clans_Table"` WHERE cID = '%i' LIMIT 1"PlayerInfo[killerid][ClanID]);
            
mysql_tquery(MySQLquery"IncreaseClanScore""ii"PlayerInfo[killerid][ClanID], 1);
            
//IncreaseClanScore(PlayerInfo[killerid][ClanID]);
        
}
        if(
PlayerInfo[playerid][Robbing] == 1)
        {
            if(
IsPlayerInRobberyCP(playerid))
            {
                
GameTextForPlayer(playerid,"~r~Robbery failed! ~n~~b~You left the checkpoint!",3000,5);
                
PlayerInfo[playerid][Robbing] = 0;
                
RobberyTimer[playerid] = 0;
            }
        }
        
gTotalKills++;
        switch (
gTotalKills)
        {
            case 
50SendClientMessageToAll(-1"{FFD700}[USF] {008FFB}50{2BD9F8} players have been killed since the server launch!");
            case 
100SendClientMessageToAll(-1"{FFD700}[USF] {008FFB}100{2BD9F8} players have been killed since the server launch!");
            case 
250SendClientMessageToAll(-1"{FFD700}[USF] {008FFB}100{2BD9F8} players have been killed since the server launch!");
            case 
500SendClientMessageToAll(-1"{FFD700}[USF] {008FFB}500{2BD9F8} players have been killed since the server launch!");
            case 
1000SendClientMessageToAll(-1"{FFD700}[USF] {008FFB}1000{2BD9F8} players have been killed since the server launch!");
        }
        
SaveServerInfo();

        new 
str[128];
         
//DM
        
EXPforDM[killerid] = CreatePlayerTextDraw(killerid2.500000175.466751"+1 Score");
          
PlayerTextDrawLetterSize(killeridEXPforDM[killerid], 0.4499991.600000);
          
PlayerTextDrawAlignment(killeridEXPforDM[killerid], 1);
          
PlayerTextDrawColor(killeridEXPforDM[killerid], -5963521);
          
PlayerTextDrawSetShadow(killeridEXPforDM[killerid], 0);
          
PlayerTextDrawSetOutline(killeridEXPforDM[killerid], -256);
          
PlayerTextDrawBackgroundColor(killeridEXPforDM[killerid], 51);
          
PlayerTextDrawFont(killeridEXPforDM[killerid], 2);
        
PlayerTextDrawSetProportional(killeridEXPforDM[killerid], 1);

          
CashforDM[killerid] = CreatePlayerTextDraw(killerid2.500000191.644439"+3000$");
          
PlayerTextDrawLetterSize(killeridCashforDM[killerid], 0.4499991.600000);
          
PlayerTextDrawAlignment(killeridCashforDM[killerid], 1);
          
PlayerTextDrawColor(killeridCashforDM[killerid], 16711935);
          
PlayerTextDrawSetShadow(killeridCashforDM[killerid], 0);
          
PlayerTextDrawSetOutline(killeridCashforDM[killerid], 0);
        
PlayerTextDrawBackgroundColor(killeridCashforDM[killerid], 51);
          
PlayerTextDrawFont(killeridCashforDM[killerid], 2);
          
PlayerTextDrawSetProportional(killeridCashforDM[killerid], 1);
          
PlayerTextDrawShow(killeridEXPforDM[killerid]);
        
PlayerTextDrawShow(killeridCashforDM[killerid]);

        
PlayerTextDrawShow(killeridEXPforDM[killerid]);

          
PlayerTextDrawShow(killeridCashforDM[killerid]);

         
PlayerInfo[killerid][Kills]++;
        
SetPlayerScore(killeridGetPlayerScore(killerid) + 1);
        
GivePlayerMoney(killerid3000);

        for (new 
0MAX_PLAYERSi++)
        {
            if (
IsPlayerConnected(i))
            {
                if (
PlayerInfo[i][inDM] == 1)
                {
                    
format(strsizeof(str), "%s(%d) killed %s(%d) (%s)"GetName(killerid), killeridGetName(playerid), playeridWeaponNames[reason]);
                    
SendClientMessage(iCOLOR_VIOLETstr);
                }
               }
          }
          
//SendClientMessageToAll(COLOR_VIOLET, str);
        
gDMTD SetTimerEx("HideDMTextDraw"2000false"i"killerid);
     }
     return 
1;




AW: [HELP]Little problem again :D - Kaliber - 19.03.2015

Run the crashdetect Plugin and test your Code again...and look in the log if you get ported to the farm


Re: AW: [HELP]Little problem again :D - Mya - 19.03.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Run the crashdetect Plugin and test your Code again...and look in the log if you get ported to the farm
is not working, please help me


AW: Re: AW: [HELP]Little problem again :D - Kaliber - 19.03.2015

Quote:
Originally Posted by Mya
Посмотреть сообщение
is not working, please help me
Dude, you should read my text.

Is there something in the server_log?


Re: AW: Re: AW: [HELP]Little problem again :D - Mya - 19.03.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Dude, you should read my text.

Is there something in the server_log?
no, nothing error with crashdetect plugins, its sucsess, but im still In Farm While DEAD


AW: [HELP]Little problem again :D - Kaliber - 19.03.2015

Well, i guess you made an thinking mistake, look:

Код:
PlayerInfo[playerid][POS_X],PlayerInfo[playerid][POS_Y],PlayerInfo[playerid][POS_Z]
To this coords the player gets ported when he spawns, but these coords are 0.0

So the player spawns at the farm (this coords are 0,0,0)

Actually you could do sth like:

Код:
if(PlayerInfo[playerid][POS_X] == 0.0)
{
    SetPlayerPos(playerid,1529.6,-1691.2,13.3); //Now he would be at the LSPD, instead of the farm
    SetPlayerInterior(playerid, 0);
}
else
{
    SetPlayerPos(playerid, PlayerInfo[playerid][POS_X], PlayerInfo[playerid][POS_Y], PlayerInfo[playerid][POS_Z]);
}
Greekz