SSCANF mystake?
#1

Direct to problem:
Код:
if(sscanf(params, "us", id, reason)) return SCM(playerid, WHITE, "Scrie: /Explode [Nume/ID] [Motiv].");
Translate:
Scrie: /Explode [Nume/ID] [Motiv] = Type: /Explode [Name/ID] [Reason]
I'm give this errors:
Код:
C:\Program Files\eXtreme Stunt World (1)\XSW V1\gamemodes\XSW_Full.pwn(10127) : error 035: argument type mismatch (argument 1)
C:\Program Files\eXtreme Stunt World (1)\XSW V1\gamemodes\XSW_Full.pwn(10136) : warning 213: tag mismatch
C:\Program Files\eXtreme Stunt World (1)\XSW V1\gamemodes\XSW_Full.pwn(10136) : warning 213: tag mismatch
C:\Program Files\eXtreme Stunt World (1)\XSW V1\gamemodes\XSW_Full.pwn(10136) : warning 213: tag mismatch
C:\Program Files\eXtreme Stunt World (1)\XSW V1\gamemodes\XSW_Full.pwn(10149) : warning 202: number of arguments does not match definition
C:\Program Files\eXtreme Stunt World (1)\XSW V1\gamemodes\XSW_Full.pwn(11891) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Full cmd:
Код:
CMD:explode(playerid, params)
{
	new id, reason[128], px, pz, py, nameadmin[24], nameexplode[24], string[246], Float:health1, Float:ar1, Float:health2, Float:ar2;
	if(Player[playerid][Level] <= 1) return SendSplitMessage(playerid, RED, "Nivelul tau de admin nu este destul de mare pentru a folosii acesta comanda!");
	if(sscanf(params, "us", id, reason)) return SCM(playerid, WHITE, "Scrie: /Explode [Nume/ID] [Motiv].");
	if(!IsPlayerConnected(id)) return SCM(playerid, RED, "Acest player nu este conectat!");
	if(Player[playerid][Level] <= Player[id][Level]) return SendSplitMessage(playerid, RED, "Nu ai voie sa-i dai explode unui admin de nivel mai mare sau egal cu tine!");
	else if(id == playerid) return SCM(playerid, RED, "Nu ai voie sa-ti dai explode singur!");
	{
	    GetPlayerHealth(id, health1);
	    GetPlayerArmour(id, ar1);
	    GetPlayerName(id, nameexplode, sizeof(nameexplode));
	    GetPlayerName(playerid, nameadmin, sizeof(nameadmin));
	    GetPlayerPos(id, px, py, pz);
	    CreateExplosionForPlayer(id, px, pz, py, 1, 3);
	    format(string, sizeof(string), "I-ai dat explode lui %s, [Motiv: %s]!", nameexplode, reason);
	    SCM(playerid, YELLOW, string);
	    GetPlayerHealth(id, health2);
	    GetPlayerArmour(id, ar2);
		format(string, sizeof(string), "%s - %1.f HP inainte | %1.f Armura inainte.", nameexplode, health1, ar1);
		SCM(playerid, YELLOW, string);
		format(string, sizeof(string), "%s - %1.f HP Acum | %1.f Acum.", nameexplode, health2, ar2);
		SCM(playerid, YELLOW, string);
	    format(string, sizeof(string), "Admin %s ti-a dat explode, [Motiv: %s]!", nameadmin, reason);
	    SCM(id, YELLOW, string);
	    format(string, sizeof(string), "Admin %s i-a dat explode lui %s, [Motiv: %s]!",nameadmin , nameexplode, reason);
	    SendMessageToAdmins(YELLOW, string,1);
	}
	return 1;
}
Sorry for my bad english!
THANKS
Reply
#2

pawn Код:
if(sscanf(params, "us[126]", id, reason)) return SCM(playerid, WHITE, "Scrie: /Explode [Nume/ID] [Motiv].");
Reply
#3

Код:
CMD:explode(playerid, params)
{
	new id, reason[128], Float:px, Float:pz, Float:py, nameadmin[24], nameexplode[24], string[246], Float:health1, Float:ar1, Float:health2, Float:ar2;
	if(Player[playerid][Level] <= 1) return SendSplitMessage(playerid, RED, "Nivelul tau de admin nu este destul de mare pentru a folosii acesta comanda!");
	if(sscanf(params, "us[128]", id, reason)) return SCM(playerid, WHITE, "Scrie: /Explode [Nume/ID] [Motiv].");
	if(!IsPlayerConnected(id)) return SCM(playerid, RED, "Acest player nu este conectat!");
	if(Player[playerid][Level] <= Player[id][Level]) return SendSplitMessage(playerid, RED, "Nu ai voie sa-i dai explode unui admin de nivel mai mare sau egal cu tine!");
	else if(id == playerid) return SCM(playerid, RED, "Nu ai voie sa-ti dai explode singur!");
	{
	    GetPlayerHealth(id, health1);
	    GetPlayerArmour(id, ar1);
	    GetPlayerName(id, nameexplode, sizeof(nameexplode));
	    GetPlayerName(playerid, nameadmin, sizeof(nameadmin));
	    GetPlayerPos(id, px, py, pz);
	    CreateExplosionForPlayer(id, px, pz, py, 1, 3);
	    format(string, sizeof(string), "I-ai dat explode lui %s, [Motiv: %s]!", nameexplode, reason);
	    SCM(playerid, YELLOW, string);
	    GetPlayerHealth(id, health2);
	    GetPlayerArmour(id, ar2);
		format(string, sizeof(string), "%s - %1.f HP inainte | %1.f Armura inainte.", nameexplode, health1, ar1);
		SCM(playerid, YELLOW, string);
		format(string, sizeof(string), "%s - %1.f HP Acum | %1.f Acum.", nameexplode, health2, ar2);
		SCM(playerid, YELLOW, string);
	    format(string, sizeof(string), "Admin %s ti-a dat explode, [Motiv: %s]!", nameadmin, reason);
	    SCM(id, YELLOW, string);
	    format(string, sizeof(string), "Admin %s i-a dat explode lui %s, [Motiv: %s]!",nameadmin , nameexplode, reason);
	    SendMessageToAdmins(YELLOW, string,1);
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)