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



3 Questions.. - vassilis - 08.11.2011

Hey all i wander how i can make this things :PP
firstly how i will be able to make something like strings on dialogs..
example
Goto [Enabled] if player enabled it or disabled it...how i can make it or something like that
2nd question
how i will be able to make a simple pingkick system and the 3rd question is
how i can hide the clock for the server or make my own textdraw time


Re: 3 Questions.. - FarSe. - 08.11.2011

1.
pawn Код:
new String[500];
format(String,500,"Goto:%s\nGodmode:%s\nVehicleModel:%d",
(PlayerInfo[playerid][Goto]==1)?("{00FF00}Enable"):("{FF0000}Disable"),
(PlayerInfo[playerid][Godmode]==1)?("{00FF00}Enable"):("{FF0000}Disable"),
GetVehicleModel( GetPlayerVehicleID(playerid) ) );
ShowPlayerDialog(playerid,DIALOG_ID,2,"Stats",String,"change","Close");
2.
pawn Код:
SetTimer("CheckPing",8000,1);//8 seconds
forward CheckPing();
public CheckPing()
{
for(new i = 0 ; i < MAX_PLAYERS ; i++)
{
if(IsPlayerConnected(i)&&GetPlayerPing(i)>400)Kick(i);
}
}
3. For Hide use this: https://sampwiki.blast.hk/wiki/TogglePlayerClock
To create a Clock TD,you need 3 global variables: new Hour,Minute,Second, and a timer, SetTimer("Clock",1000,1); and this:
pawn Код:
forward Clock();
public Clock()
{
Second ++;
if(Second > 60) {
Second = 0; Minute += 1;
if(Minute > 60)
{
Hour += 1;
if(Hour > 24)
{
Hour = 1;
}
}
}
new string[50];
format(string,50,"%.02d:%.02d:%.02d",Hour,Minute,Second);
TextDrawSetString( TD, string);
}