Jump to content
View in the app

A better way to browse. Learn more.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problematique

Hoi,

Ik ben een anti-afk script aan het maken, ben nu al 3 uur bezig om een paar errors weg te halen. Hier mijn script:

/*
################################################################################
############                                                      ##############
############  This is a filterscript against being afk for hours  ##############
############   If a player is afk for 1 hour he will get kicked   ##############
############                  Scripted by: Clank                  ##############
############   Please report bugs at me in the sa-mp.com forum    ##############
############                  (Nickname: Clank)                   ##############
############                                                      ##############
################################################################################
*/

#include <a_samp>
#include <a_players>

#define FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA // Yellow

/*
################################################################################
############         All the defines & includes we need           ##############
################################################################################
*/

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Anti-AFK by Clank");
print("--------------------------------------\n");
return 1;
}

forward IsPlayerAfk (playerid);

//---------------The forward is above and the funtion beneath-------------------

if (IsPlayerAfk (playerid) == 1) //i think here is the problem 
{
Kick(playerid);
SendClientMessageToAll(COLOR_YELLOW, NEVER be too long afk);
}



public OnFilterScriptExit()
{
return 1;
}

//------------------The new function is beneath this line-----------------------

IsPlayerAfk (playerid)
{
new
GetPlayerPos(playerid, &pos1x, &pos1y, &pos1z);
SetTimer(time afk, 3600000, true);
GetPlayerPos(playerid, &pos2x, &pos2y, &pos2z);
if (&pos1x = &pos2x, &pos1y = &pos2y, &pos1z = &pos2z);
KillTimer(time afk);
}
#endif

errors:

D:\Cas\GTASA\samp\filterscripts\Anti AFK.pwn(39) : error 010: invalid function or declaration
D:\Cas\GTASA\samp\filterscripts\Anti AFK.pwn(57) : warning 203: symbol is never used: "IsPlayerAfk"
Pawn compiler 3.2.3664           Copyright © 1997-2006, ITB CompuPhase


1 Error.

Featured Replies

De functie 'IsPlayerAfk' is niet gedefinieerd in je script, zodat hij niet werkt. Plaats ergens bovenaan je script, maar wel onder de includes, dit stukje:

new IsPlayerAfk;

Ik heb overigens nog een foutje gevonden in de teksten, en wel deze..

SendClientMessageToAll(COLOR_YELLOW, NEVER be too long afk);

De tekst moet tussen aanhalingstekens ("), anders zal hij niet worden herkend. ;)

Overigens denk ik niet dat je script zal werken, je moet volgens mij een stuk uitgebreider maken, maar hoe dat allemaal in elkaar steekt weet ik zo net nog niet.. Kijk in ieder geval nog maar eventjes. ;)

Succes. :)

Ik had je op het sa:mp forum ook al verteld dat je niet zomaar een if(blablabla) zomaar buiten een callback kan zetten.

Ik heb het over deze code:

if (IsPlayerAfk (playerid) == 1) //i think here is the problem
{
Kick(playerid);
SendClientMessageToAll(COLOR_YELLOW, NEVER be too long afk);
}

Edit: En als ik zo door dat script heen kijk, dan klopt er echt helemaal niks van.

Het zal sowieso niet werken :{

Edited by =>Sandra<=

  • Author
Ik had je op het sa:mp forum ook al verteld dat je niet zomaar een if(blablabla) zomaar buiten een callback kan zetten.

Ik snap niet wat je nou precies bedoelt:S

Je zet een 'if'-structuur buiten twee callbacks in, op deze manier zal je spel crashen. Zet hem bínnen een callback (tussen de 'public [Callback]' en 'return 1/0;') en dat probleem zal dan opgelost zijn. Dan moet je je script alleen nog werkende krijgen, want dit werkt ook niet. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.