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



Questions - Cowboy - 01.09.2011

Hello.

1) How would I be able to cancel a player's attack? By that I mean, right before a player tries to hit another player, his hit will be cancel. I saw this on a server.

2) If I create my own GMX command, do I have to make a timer on like 5 seconds the cmd got executed? I'd rather not want to use a timer, so my question is, if all my data can be saved before SendRconCommand?

3) If the server crashes, will OnPlayerDisconnect be called?

Thanks,

Cowboy


Re : Questions - Naruto_Emilio - 01.09.2011

Quote:
Originally Posted by Cowboy
Посмотреть сообщение
Hello.

1) How would I be able to cancel a player's attack? By that I mean, right before a player tries to hit another player, his hit will be cancel. I saw this on a server.

2) If I create my own GMX command, do I have to make a timer on like 5 seconds the cmd got executed? I'd rather not want to use a timer, so my question is, if all my data can be saved before SendRconCommand?

3) If the server crashes, will OnPlayerDisconnect be called?

Thanks,

Cowboy
1) Maybe, it think you will use OPSP include.
2) Yes you can create your own GMX with timer, You have to create a save data system.
3) Dunno :P


Re: Questions - Improvement™ - 01.09.2011

Quote:
Originally Posted by Cowboy
Посмотреть сообщение
3) If the server crashes, will OnPlayerDisconnect be called?
I am not sure either, but what you could do is creating a print function and find a way to crash your server.
And you could search if the print function has been printed on your server_log.log.

Here are 2 examples:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   printf("The OnPlayerDisconnect Callback has been called!")
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   new PlayerName[MAX_PLAYER_NAME];
   GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
   printf("The OnPlayerDisconnect Callback has been called for %s.", PlayerName)
}



Re: Questions - [MWR]Blood - 01.09.2011

Quote:
Originally Posted by Improvement™
Посмотреть сообщение
I am not sure either, but what you could do is creating a print function and find a way to crash your server.
And you could search if the print function has been printed on your server_log.log.

Here are 2 examples:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   printf("The OnPlayerDisconnect Callback has been called!")
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   new PlayerName;
   GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
   printf("The OnPlayerDisconnect Callback has been called for %s.", PlayerName)
}
I am going to try this myself, sounds pretty interesting.


Re: Questions - Improvement™ - 01.09.2011

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
I am going to try this myself, sounds pretty interesting.
Just incase you didn't noticed, I just changed the codes because of a mistake.
Already editted this in the first reply.


Re: Questions - [MWR]Blood - 01.09.2011

Well, seems like it doesn't get called.
The code I used:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    print("OnPlayerDisconnect was called!");
    return 1;
}
And the command to crash the server:
pawn Код:
CMD:testcrash(playerid,params[])
{
    randomtext = TextDrawCreate(11.000000, 94.000000, "");
    TextDrawBackgroundColor(randomtext, 255);
    TextDrawFont(randomtext, 1);
    TextDrawLetterSize(randomtext, 0.280000, 1.000000);
    TextDrawColor(randomtext, 2122972159);
    TextDrawSetOutline(randomtext, 0);
    TextDrawSetProportional(randomtext, 1);
    TextDrawSetShadow(randomtext, 1);
    return 1;
}
That's everything that got outputted:
Код:
[20:57:51] Incoming connection: xx.xx.xx.xx:xx
[20:57:51] [join] [NSX]Blood has joined the server (0:xx.xx.xx.xx)



Re: Questions - Cowboy - 01.09.2011

About 2nd I meant,

would all the data save before SendRconCommand("gmx"); got executed?

Or would I need to use a timer after 10 seconds of execution of the cmd?

3rd)

So how can I fix this?

using ******' gmxfix include?


Re: Questions - Improvement™ - 01.09.2011

About your Second Question.
I am using DINI and it does save once Rcon GMX has been executed.
But I suggest you to do experiments and try to figure it all out by yourself, since this is faster than waiting for someone to reply.

But yes, the OnPlayerDisconnect will be called once Rcon GMX has been executed.

Quote:
Originally Posted by Improvement™
Посмотреть сообщение
But what you could do is creating a print function and find a way to crash your server.
And you could search if the print function has been printed on your server_log.log.

Here are 2 examples:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   printf("The OnPlayerDisconnect Callback has been called!")
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   new PlayerName[MAX_PLAYER_NAME];
   GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
   printf("The OnPlayerDisconnect Callback has been called for %s.", PlayerName)
}



Re: Questions - Cowboy - 03.09.2011

Does anyone have the answer for question 1?

Also another question. How can I make if one variable is set to 1, then the other variable will stop the count.

Example. Kills won't count when a player is in some place.


Re: Questions - Improvement™ - 03.09.2011

Quote:
Originally Posted by Cowboy
Посмотреть сообщение
1) How would I be able to cancel a player's attack? By that I mean, right before a player tries to hit another player, his hit will be cancel. I saw this on a server.
Oh wait, are you talking about "godmode"?

If so then:
pawn Код:
SetPlayerHealth(playerid, 99999999);


FIRST EDIT:
Quote:
Originally Posted by Cowboy
Посмотреть сообщение
Also another question. How can I make if one variable is set to 1, then the other variable will stop the count.

Example. Kills won't count when a player is in some place.
pawn Код:
new Variable[MAX_PLAYERS] = 1; //Somewhere on top of your script

if(Variable == 1) //check if one variable is set to 1
{
    VariableCounter[playerid] = false; //then other variable will stop the count?
}