SA-MP Forums Archive
fly mod - satdm - 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: fly mod - satdm (/showthread.php?tid=397506)



fly mod - satdm - Frede - 05.12.2012

Hi, i have a little problem.
I have started my own server and downloaded some fs. Everything was working especially the fs "fly" as i downloaded. I made some changes in it and now i cant compile. What is the problem and can i change it so i get it to vip lvl 3 only. the compile msg is: ...\fly.pwn(5 : warning 203: symbol is never used: "strtok"

the code in the script is:
Quote:

#define FILTERSCRIPT
#include <a_samp>
#include <fly>
#include <ladmin>

public OnFilterScriptInit()
{
print("=========================================\n ");
print("Fly include demo FS by Norck");
print(" ");
print("=========================================\n ");
return 1;
}

public OnPlayerConnect(playerid)
{
InitFly(playerid);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/fly",true))
{
if(IsPlayerVipType(playerid,3))
{
StartFly(playerid);
return 1;
}
else
SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: You are not a premium Member!");
return 1;
}
if(!strcmp(cmdtext,"/stopfly",true))
{
StopFly(playerid);
return 1;
}
return 0;
}

Please help me.


Re: fly mod - satdm - LarzI - 05.12.2012

You simply don't use the strtok function (String Token) - which is commonly used to read params in commands.

I believe this function is included in either the fly.inc or ladmin.inc, and to hide the warning you can simply put this on top underneath your includes:
pawn Код:
#pragma unused strtok



Re: fly mod - satdm - Konstantinos - 05.12.2012

It's a warning, not an error. It just says that this symbol "strtok" is never used.
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
So, you don't need this.


Re: fly mod - satdm - Frede - 05.12.2012

thank you very mutch


Re: fly mod - satdm - Frede - 05.12.2012

i got a new problem where scould i place dwanes stuff ? it just say: symbol already defined: "strtok"


Re: fly mod - satdm - Frede - 05.12.2012

I can compile, but when i am loggin in as lvl 3 vip and use the cmd it just say you are not a premium member


Re: fly mod - satdm - Konstantinos - 05.12.2012

You defined it and it says that "strtok" is never used. If you read better my post, you'll see that I said
Quote:
Originally Posted by Dwane
Посмотреть сообщение
It's a warning, not an error. It just says that this symbol "strtok" is never used.
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
So, you don't need this.
Don't add it to your script as you already have it!

You can edit your post, you don't need to double post and are you sure the variable is assigned to 3?


Re: fly mod - satdm - Frede - 05.12.2012

Ok, but when i goto my game as vip lvl 3 it just say "ERROR: You are not a premium Member!


Re: fly mod - satdm - LarzI - 05.12.2012

Check your scriptfiles folder - there should be a user file named after you there (probably) where you can edit your member status.


Re: fly mod - satdm - Frede - 05.12.2012

i did and i am vip lvl 3 but ty for your help