Jump to content
  • 0

Problema compilare..


mihai1122

Question

Problema intalnita (descriere): Eroare la compilare.. Am incercat sa fac comanda /set si nu stiu ce nu e bine la linia 20753  (asta e linia  GetPlayerName(playerid, sendername, sizeof(sendername)); )
Ero(area / rile) / warning-(ul / urile): error 035: argument type mismatch (argument 2)
error 035: argument type mismatch (argument 2) (Sunt 2 la fel)
Liniile de cod / sursa / script-ul(obligatoriu):

CMD:set(playerid, params[]) {
    if(PlayerInfo[playerid][pAdmin] >= 6) {
        new
            item[32],
            userID,
            amount,
			sendername,
			string[556];

        if(sscanf(params, "us[32]d", userID, item, amount)) {
			SendClientMessage(playerid, COLOR_GREY, "/set [playerid] [item] [amount]");
			SendClientMessage(playerid, COLOR_GREY, "Items: Health, Job, Level, BankMoney, Money, Hours");
			SendClientMessage(playerid, COLOR_GREY, "Phone, Materials, Drugs, Group, GroupRank, Clan, ClanRank, RobPoints");
		}
        else if(IsPlayerConnected(playerid))//if(IsPlayerConnectedEx(userID))
		{
				//GetPlayerName(userID, sendername, MAX_PLAYER_NAME);
				GetPlayerName(playerid, sendername, sizeof(sendername));
				if(strcmp(item, "health", true) == 0) {
					//format(szMessage, sizeof(szMessage), "You have set %s (ID: %d)'s health to %d.", szPlayerName, userID, amount);
					format(string,sizeof(string), "You have set %s (ID: %d )'s health to %d", sendername, userID, amount);
					//SendClientMessage(playerid, COLOR_WHITE, szMessage);
					SendClientMessage(playerid, COLOR_WHITE, string);
					SetPlayerHealth(userID, amount);
				}
				else if(strcmp(item, "armour", true) == 0) {
					format(string,sizeof(string), "You have set %s (ID: %d)'s armour to %d.", sendername, userID, amount);
					SendClientMessage(playerid, COLOR_WHITE, string);
					SetPlayerArmour(userID, amount);
				}
				else if(strcmp(item, "job", true) == 0)
				{
					format(string,sizeof(string), "You have set %s (ID: %d)'s job to %d.", sendername, userID, amount);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerInfo[userID][pJob] = amount;
				}
				/*else if(strcmp(item, "bankmoney", true) == 0)
				{
					if(EsteManager(playerid))
					{
						format(string,sizeof(string), "You have set %s (ID: %d)'s bank balance to %d.", sendername, userID, amount);
						SendClientMessage(playerid, COLOR_WHITE, string);
						PlayerInfo[userID][pBankMoney] = amount;
					}
				}*/
				else if(strcmp(item, "money", true) == 0)
				{
					if(EsteManager(playerid))
					{
						format(string,sizeof(string), "You have set %s (ID: %d)'s money to %d.", sendername, userID, amount);
						SendClientMessage(playerid, COLOR_WHITE, string);
						PlayerInfo[userID][pCash] = amount;
					}
				}
				else if(strcmp(item, "materials", true) == 0) {
					format(string,sizeof(string), "You have set %s (ID: %d)'s materials to %d.", sendername, userID, amount);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerInfo[userID][pMats] = amount;
				}
				else if(strcmp(item, "drugs", true) == 0) {
					format(string,sizeof(string), "You have set %s (ID: %d)'s drugs to %d.", sendername, userID, amount);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerInfo[userID][pMats] = amount;
				}
				else if(strcmp(item, "group", true) == 0)
				{
					if(amount >= 0 && amount <= MAX_GROUPS)
					{
						format(string,sizeof(string), "You have set %s (ID: %d)'s group to %d.", sendername, userID, amount);
						SendClientMessage(playerid, COLOR_WHITE, string);

						PlayerInfo[userID][pMember] = amount;
					}
					else SendClientMessage(playerid, COLOR_GREY, "Invalid group specified.");
				}
				else if(strcmp(item, "clan", true) == 0) {
					if(amount >= 0 && amount <= MAX_GROUPS) {

						format(string,sizeof(string), "You have set %s (ID: %d)'s clan to %d.", sendername, userID, amount);
						SendClientMessage(playerid, COLOR_WHITE, string);


						PlayerInfo[userID][pClan] = amount;

					}
					else SendClientMessage(playerid, COLOR_GREY, "Invalid group specified.");
				}
				else if(strcmp(item, "grouprank", true) == 0) {
					if(amount >= 0 && amount <= 7) {
						format(string,sizeof(string), "You have set %s (ID: %d)'s group rank to %d.", sendername, userID, amount);
						SendClientMessage(playerid, COLOR_WHITE, string);
						PlayerInfo[userID][pRank] = amount;
					}
					else SendClientMessage(playerid, COLOR_GREY, "Invalid rank specified.");
				}
				/*else if(strcmp(item, "clanrank", true) == 0) {
					if(amount >= 0 && amount <= 7) {
						format(string,sizeof(string), "You have set %s (ID: %d)'s clan rank to %d.", sendername, userID, amount);
						SendClientMessage(playerid, COLOR_WHITE, string);
						PlayerInfo[userID][pClanRank] = amount;
					}
					else SendClientMessage(playerid, COLOR_GREY, "Invalid rank specified.");
				}*/
				else if(strcmp(item, "level", true) == 0)
				{
					format(string,sizeof(string), "You have set %s (ID: %d)'s level to %d.", sendername, userID, amount);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerInfo[userID][pLevel] = amount;
				}
				else if(strcmp(item, "hours", true) == 0)
				{
					format(string,sizeof(string), "You have set %s (ID: %d)'s hours to %d.", sendername, userID, amount);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerInfo[userID][pConnectTimex] = amount;
				}
				else if(strcmp(item, "robpoints", true) == 0)
				{
					format(string,sizeof(string), "You have set %s (ID: %d)'s rob points to %d.", sendername, userID, amount);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerInfo[userID][pRob] = amount;
				}
        }
		else SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated.");
    }
	else return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
	return 1;
}


Imagini / Video (optional):
Ati incercat sa rezolvati singur?:  Am incercat sa pun "GetPlayerName(userID, sendername, MAX_PLAYER_NAME);" insa tot imi da eroare.

<a href="http://www.game-state.eu/89.33.242.212:7777/"><img src="http://www.game-state.eu/89.33.242.212:7777/350x20_FFFFFF_FFFFFF_000000_000000.png" alt="www.Game-State.eu" style="border-style: none;" /></a>

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
new
            item[32],
            userID,
            amount,
			sendername[MAX_PLAYER_NAME],
			string[128];

N-am inteles niciodata de ce lumea face stringurile atat de mari, mai ales in situatia asta in care il formatezi si-l trimiti o singura data in functie de if statemant

Edit: Trebuie sa specifici marimea lui sendername , el fiind un string

Edited by Banditul
Link to comment
Share on other sites

  • 0
La 13.11.2016 la 22:55, Banditul a spus:

new
            item[32],
            userID,
            amount,
			sendername[MAX_PLAYER_NAME],
			string[128];

N-am inteles niciodata de ce lumea face stringurile atat de mari, mai ales in situatia asta in care il formatezi si-l trimiti o singura data in functie de if statemant

Edit: Trebuie sa specifici marimea lui sendername , el fiind un string

in cearca sa pui cum te-am zis eu ca e cel mai corect asa si ruleaza si bine + 1 daca te-am fost de ajutor, si pe data viitoare sa nu crezi ca 

sendername[MAX_PLAYER_NAME],

face mare lucru !

  • Upvote 1

FiveGame  Lands

Pawno Developer, Mapping , Scripter

Since 2016

Link to comment
Share on other sites

  • 0

Fiecare cum crede de cuviință ,  din cate ştiu ace MAX_PLAYER_NAME este definit ca [24] , dar un jucator nu poate intra cu numele peste 20 caractere [21](20 + \0 (terminatia unui string)) , dar in fine, nu vreau sa ma dau eu mare atot stiutor pentru ca anumite lucruri nu le stiu nici eu sa le fac mai ales inca incerc sa invat....In fine, la [numar] e vorba doar de numarul maxim de caractere si de bytes.....Si da, ai dreptate nu face mare lucru [24] fata de [30] doar 24 bytes diferenta (mare nu?:)) ), inchei aici, si ma intorc la invatat pawn si c++  in continuare......O zi bună, fiecare cu stilul lui:)

Link to comment
Share on other sites

  • 0
Acum 29 minute, Banditul a spus:

Fiecare cum crede de cuviință ,  din cate ştiu ace MAX_PLAYER_NAME este definit ca [24] , dar un jucator nu poate intra cu numele peste 20 caractere [21](20 + \0 (terminatia unui string)) , dar in fine, nu vreau sa ma dau eu mare atot stiutor pentru ca anumite lucruri nu le stiu nici eu sa le fac mai ales inca incerc sa invat....In fine, la [numar] e vorba doar de numarul maxim de caractere si de bytes.....Si da, ai dreptate nu face mare lucru [24] fata de [30] doar 24 bytes diferenta (mare nu?:)) ), inchei aici, si ma intorc la invatat pawn si c++  in continuare......O zi bună, fiecare cu stilul lui:)

Așa e, cel mai sigur cand vrei sa folosești un string pt nume folosești MAX PLAYER NAME.

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.