Raised This Month: $32 Target: $400
 8% 

[CS:GO] For loop declaration is invalid :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kazafka
Junior Member
Join Date: Dec 2020
Old 12-20-2020 , 12:34   [CS:GO] For loop declaration is invalid :)
Reply With Quote #1

I'm struggling with this bullshit about 30m. Can somebody help me please?

Error: error 010: invalid function or declaration

Code:
#include <sourcemod>
#include <geoip>
#include <sdktools>
#include <sdktools_functions>
#include <adt_array>

/*
Info o pluginie
*/
public Plugin:myinfo = 
{
	name = "CSMaxShot Core",
	author = "Kazafka/Kafajku/kzfka",
	version = "0.0.5"
}

/*
Array z nazwami graczy, którym dodano już tag
*/
char n_ames[99][99]

for(new i = 0; i < sizeof(n_ames); i++) { // Error
	char multi[99]
	n_ames[i] = multi
}

/*
Kiedy plugin się włączy...
*/
public OnPluginStart() {
	HookEvent("player_spawn", __OnPlayerSpawn)
}

/*
Funkcja zmieniająca tag gracza, kiedy ten się zrespi
*/
public Action:__OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) {
	new clientId = GetEventInt(event, "userid")
	new client = GetClientOfUserId(clientId)
	
	CreateTimer(0.1, ___ChangePlayerTag, client, TIMER_FLAG_NO_MAPCHANGE)
}

/*
Wrapper-funkcja dla "__OnPlayerSpawn"
*/
public Action:___ChangePlayerTag(Handle:timer, any:client) {
	char group[99]
	
	AdminId aid = GetUserAdmin(client)
	GroupId gid = GetAdminGroup(aid, 0, group, sizeof(group))
	
	char tag[99] = "\x01["
	StrCat(tag, sizeof(tag), "\x0B")
	StrCat(tag, sizeof(tag), group)
	StrCat(tag, sizeof(tag), "\x01] ")
	
	char name[99]
	GetClientName(client, name, sizeof(name))
	
	if(aid != INVALID_ADMIN_ID) {
		bool isNicknameInArray = false
		
		for(new i = 0; i < sizeof(n_ames); i++) {
			if(StrEqual(n_ames[i], name)) {
				isNicknameInArray = true
				
				break
			}
		}
		
		if(!isNicknameInArray) {
			StrCat(tag, sizeof(tag), name)
				
			SetClientName(client, tag)
			
			n_ames[sizeof(n_ames)] = name
		}
	}
}

/*
Funkcja powitalna
*/
public OnClientPutInServer(client)
{
	char name[99], IP[99], country[99], group[99];
	
	GetClientName(client, name, sizeof(name));
	GetClientIP(client, IP, sizeof(IP), true);
	
	PrintToChatAll("\x03%s wbił na serwer z \x04[%s]", name, country);
}
Kazafka is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 12-20-2020 , 13:00   Re: [CS:GO] For loop declaration is invalid :)
Reply With Quote #2

You can't put logic in the global scope. You need to put it inside a function, like OnPluginStart.

https://wiki.alliedmods.net/Introduc...ng_code_to_run
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 12-20-2020 at 13:07.
DJ Tsunami is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode