SA-MP Forums Archive
Problem - 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: Problem (/showthread.php?tid=300209)



Problem - Aira - 29.11.2011

Well, i'm using the OnPlayerPause Include..
Now this is the part of it

PHP код:
public OnPlayerPause(playerid)
{
    new 
name[MAX_PLAYER_NAME], string[44];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "%s has Paused",name);
    
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
    return 
0;
}
public 
OnPlayerUnPause(playerid)
{
    new 
name[MAX_PLAYER_NAME], string[44];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "%s has Returned",name);
    
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
    return 
0;

I want to add something like if he PAUSES, it will make a 3DText above his head, and it will disappear when he comes back. I made one, but it dosen't DELETE when the player comes back. Please help, thanks


Re: Problem - English-Conceptz - 29.11.2011

you made a new variable ontop of your other one "string" so i assume it will delete when you call the new one in onplayerunpause ?


Re: Problem - Aira - 29.11.2011

Quote:
Originally Posted by English-Conceptz
Посмотреть сообщение
you made a new variable ontop of your other one "string" so i assume it will delete when you call the new one in onplayerunpause ?
You mean the Message? Oh there's no problem in it. only in the 3DText


Re: Problem - English-Conceptz - 29.11.2011

no i meant :

new string[44];


Re: Problem - Thresholdold - 29.11.2011

Try this:
Код:
new Text3D:AFKLabel[MAX_PLAYERS] // Add this ABOVE OnFilterScriptInit() or OnGameModeInit()
public OnPlayerPause(playerid) 
{ 
    new name[MAX_PLAYER_NAME], string[44];
     
    GetPlayerName(playerid, name, sizeof(name)); 
    format(string, sizeof(string), "%s has Paused",name);
    AFKLabel[playerid] = Create3DTextLabel("Player is AFK",0xFFFF00AA,0,0,0,50,-1,1);
    Attach3DTextLabelToPlayer(AFKLabel[playerid], playerid, 0,0,0);    
    SendClientMessageToAll(COLOR_LIGHTBLUE, string); 
    return 0; 
} 

public OnPlayerUnPause(playerid) 
{ 
    new name[MAX_PLAYER_NAME], string[44]; 
    GetPlayerName(playerid, name, sizeof(name)); 
    format(string, sizeof(string), "%s has Returned",name);
    Delete3DTextLabel(AFKLabel[playerid]); 
    SendClientMessageToAll(COLOR_LIGHTBLUE, string); 
    return 0; 
}



Re: Problem - Aira - 29.11.2011

Thank you very much, +Rep from me
- Working now