SA-MP Forums Archive
Little coding questions - For general minor queries 5 - 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 coding questions - For general minor queries 5 (/showthread.php?tid=30938)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46


Re: Little coding questions - For general minor queries 5 - oMa37 - 31.08.2016

Quote:
Originally Posted by IstuntmanI
View Post
Code:
UPDATE `Table` SET `Column` = `Column` - 3 WHERE `Player` = %d
Thanks.


Re: Little coding questions - For general minor queries 5 - Amads - 06.09.2016

Does 'GetPlayerTargetPlayer' work with fists when you press right mouse button and a triangle appears over the other player's head?


Re: Little coding questions - For general minor queries 5 - SickAttack - 06.09.2016

Quote:
Originally Posted by Amads
View Post
Does 'GetPlayerTargetPlayer' work with fists when you press right mouse button and a triangle appears over the other player's head?
Yes.


Re: Little coding questions - For general minor queries 5 - Dignity - 06.09.2016

Why doesn't easybmp.dll work for me? I have the latest .NET frameworks, updated permissions and run the file as an admin.

Got it from here: https://github.com/grasmanek94/SA-MP.../master/server

pawn Code:
plugins streamer mapandreas eb
pawn Code:
[00:06:18]
[00:06:18] Server Plugins
[00:06:18] --------------
[00:06:18]  Loading plugin: streamer
[00:06:18]

*** Streamer Plugin v2.7.8 by Incognito loaded ***

[00:06:18]   Loaded.
[00:06:18]  Loading plugin: mapandreas
[00:06:18]   Loaded.
[00:06:18]  Loading plugin: eb
[00:06:18]   Failed.
[00:06:18]  Loaded 2 plugins.



Re: Little coding questions - For general minor queries 5 - Konstantinos - 07.09.2016

For some reason he compiled it with the debug version and requires both msvcp100d.dll and msvcr100d.dll

Pottus/Crayder have these two files for Texture Studio:
https://github.com/Pottus/Texture-St...d.dll?raw=true
https://github.com/Pottus/Texture-St...d.dll?raw=true


Re: Little coding questions - For general minor queries 5 - Dignity - 07.09.2016

Quote:
Originally Posted by Konstantinos
View Post
For some reason he compiled it with the debug version and requires both msvcp100d.dll and msvcr100d.dll

Pottus/Crayder have these two files for Texture Studio:
https://github.com/Pottus/Texture-St...d.dll?raw=true
https://github.com/Pottus/Texture-St...d.dll?raw=true
Hey, thanks man. I ******d for hours on the end but couldn't find anything. Saved me some trouble.


Re: Little coding questions - For general minor queries 5 - Counterafk - 07.09.2016

Fixed!


Re: Little coding questions - For general minor queries 5 - Dayrion - 08.09.2016

How can I put default values with sscanf ? Like if the player isn't using a variable, so the variable take the default value like a function.


Re: Little coding questions - For general minor queries 5 - Spmn - 08.09.2016

Code:
sscanf(string, "d(123)f(3.14)", intvar, floatvar);
Put the default value right after specifier, enclosed by parantheses

// Oh, sorry! Long time, no s...scanf


Re: Little coding questions - For general minor queries 5 - Kaliber - 22.09.2016

Quote:
Originally Posted by AMouldyLemon
Посмотреть сообщение
I need the sizeof "Element" at a specific index such as 5..
This is impossible...cause think about a Variable get stored...

You have to use a define for this


Re: Little coding questions - For general minor queries 5 - Dayrion - 22.09.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Debug it to see what value the variable holds and what gettime returns. If the values are pretty much close, you will most likely need to check ErrorMsg for any mistake that messes the arguments. If not, just make sure TPS_PM is really 30 because I can't think of any other reason.
I made some test, result the same thing.

PHP код:
    new temp PmTime[playerid] - gettime();
    
SCMF(playerid, -1"temp = %i"temp);
    if(
PmTime[playerid] && PmTime[playerid] > gettime())
        
ErrorMsg(playerid"Vous devez attendre encore %i sec avant d'envoyer un PM."_temp);
        
ErrorMsg(playerid"Vous devez attendre encore %i sec avant d'envoyer un PM."temp); // also i tried this one, same thing 
    
new str[120];
    
format(strsizeof(str), "- Vous devez attendre encore %i sec avant d'envoyer un PM."temp);
    
SendClientMessageToAll(-1str); 
Код:
[18:58:12] temp = -1474563492 // this is ok
[18:58:12] - Vous devez attendre encore -1474563492 sec avant d'envoyer un PM. // same thing, it's k

[18:58:12] temp = 30 // alright, we have the right value
[18:58:12] [Erreur] Vous devez attendre encore 1920091483 sec avant d'envoyer un PM. // wtf?
[18:58:12] - Vous devez attendre encore 30 sec avant d'envoyer un PM.' // the right value there
So I modified the ErrorMsg
PHP код:
ErrorMsg(playerid, const msg[] = EOSallowed trueva_args<>)
{
    new 
message[190];
    
va_format(messagesizeof(message), msgva_start<3>);
    if(!
allowed)
        return 
SCMF(playeridREDF"[Erreur] Vous n'кtes pas autorisй а utiliser cette commande.");
    return 
SCMF(playeridREDF"[Erreur] %s"msg);

EDIIIT:
Solved; As you Konst' said the problem came from my function. '-'
PHP код:
stock ErrorMsg(playeridallowed true, const msg[] = EOSva_args<>)
{
    new 
message[190];
    static const 
premsg[] = "[Erreur] %s";
    if(!
allowed)
        return 
SCMF(playeridREDF"[Erreur] Vous n'кtes pas autorisй а utiliser cette commande.");
    if(
numargs() == 2)
        return 
SCMF(playeridREDFpremsgmsg);
    
va_format(messagesizeof(message), msgva_start<3>);
    return 
SCMF(playeridREDF"[Erreur] %s"message);




Re: Little coding questions - For general minor queries 5 - AMouldyLemon - 24.09.2016

PHP код:
new bool:male false;
new 
gender[11];
gender = (male ? ("Male") : ("Female"));
printf("%s\n"gender);
result"Femal" (NOT a typo
I've tried with multiple characters after "Femal", still prints "Femal". I've tried making "gender" larger, still the same problem.


Re: Little coding questions - For general minor queries 5 - Konstantinos - 24.09.2016

I don't know why this happens but swapping them fixes the issue:
pawn Код:
gender = !male ? ("Female") : ("Male");



Re: Little coding questions - For general minor queries 5 - Nero_3D - 24.09.2016

The problem is the "movs" instruction because the number of bytes need to be known beforehand, it takes it from the first argument


Re: Little coding questions - For general minor queries 5 - Alpha000 - 27.09.2016

I need a command that will fine (take some money) players who are offline at that moment....i have command for online but not for online...e.g like \offlinefine [playername(it should check if player exists or not)[amount][reason]

Im using Zcmd and y_ini


Re: Little coding questions - For general minor queries 5 - Logic_ - 27.09.2016

^^ above post (3385)

PHP код:
// indent the code yourself - just an example.
new targetname[24], fineefilestring[79];
if(
sscanf(params"s[24]d"targetnamefinee)) return SendClientMessage(playerid, -1"{C0C0C0}USAGE: /offlinefine [Player Name] [fine]");
format(filestringsizeof(filestring), "location/%s.ini"targetname);
if(!
fexist(filestring)) return SendClientMessage(playerid, -1"The player name you have chosen was not found in our system.");
new 
INI:File INI_Open(filestring);
// set player tag
// take fine and put the fine value 
INI_Close(File);
// done! 
You can also save the offline fine string and let the player know when they connect.


Re: Little coding questions - For general minor queries 5 - Alpha000 - 27.09.2016

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
^^ above post (3385)

PHP код:
// indent the code yourself - just an example.
new targetname[24], fineefilestring[79];
if(
sscanf(params"s[24]d"targetnamefinee)) return SendClientMessage(playerid, -1"{C0C0C0}USAGE: /offlinefine [Player Name] [fine]");
format(filestringsizeof(filestring), "location/%s.ini"targetname);
if(!
fexist(filestring)) return SendClientMessage(playerid, -1"The player name you have chosen was not found in our system.");
new 
INI:File INI_Open(filestring);
// set player tag
// take fine and put the fine value 
INI_Close(File);
// done! 
You can also save the offline fine string and let the player know when they connect.
how to set tag mate? i really have no idea about it...


Re: Little coding questions - For general minor queries 5 - Logic_ - 27.09.2016

^^ In your script you must be using tags for the saving files. I would recommend you to move towards MySQL, download MySQL r40 and use the example script for learning purpose, upgrade to MySQL r41 and use the example script for a base of MySQL. If your OS doesn't supports r40+ use r39-6, as I am using it too. MySQL is relatively easier and better.


Re: Little coding questions - For general minor queries 5 - Alpha000 - 27.09.2016

Ohhh sure if i upgrade to mysql..i will have to rewrite my script or something?


Re: Little coding questions - For general minor queries 5 - Garwan50 - 26.11.2016

hey,

in the beginning of my filterscript i load all animations, just to be sure that they will be played without having to type the command twice.
However it crashed the player, is there a safer way to do it ? Or is it just impossible to load every libraries at the same time?

thanks!