dcmd with parameter: /sell [playerid][item]
#1

Hi i will create a command with dcmd.
Please help, this command going not

Sorry for German.

Код:
dcmd_sell(playerid,params[])
{
	new ID,auswahl;
	if(sscanf(params, "udd",ID,auswahl))
	{
	return SendClientMessage(playerid,COLOR_GRAD2,"Nutze: /sell [spielerid][item]");
	}
	if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
	{
	  auswahl = strtok(auswahl, idx);
		if(!strlen(auswahl)) {
			SendClientMessage(playerid, COLOR_WHITE, "|__________________ Accept __________________|");
			SendClientMessage(playerid, COLOR_WHITE, "Nutze: /sell [spielerid][item]");
			SendClientMessage(playerid, COLOR_GREY, "Verfьgbare Waren: Pizza");
			SendClientMessage(playerid, COLOR_WHITE, "|____________________________________________|");
				return 1;
		}
	 	if(strcmp(auswahl,"pizza",true) == 0)
	 	{
	 	  new GSpieler[MAX_PLAYER_NAME],PSpieler[MAX_PLAYER_NAME],sstring[256],pstring[256];
	 	  GetPlayerName(ID,GSpieler,sizeof(GSpieler));
	 	  GetPlayerName(playerid,PSpieler,sizeof(PSpieler));
	 	  format(pstring,sizeof(pstring),"Nostra Dцner Mitarbeiter %s, hat dir eine Pizza ьberreicht.",PSpieler);
	 	  SendClientMessage(ID,COLOR_YELLOW,pstring);
	 	  format(sstring,sizeof(sstring),"Du hast dem Kunden %s eine Pizza ьberreicht.",GSpieler);
	 	  SendClientMessage(playerid, COLOR_WHITE,sstring);
		}
	}
	else
	{
	  SendClientMessage(playerid, COLOR_GRAD2,"Du bist kein Nostra Dцner Mittarbeiter");
	}
	return 1;
}
Reply
#2

There is a mistake in your sscanf format. and why using strtok then?
Reply
#3

You can fix this please?
Reply
#4

pawn Код:
dcmd_sell(playerid,params[])
{
    new ID;
    new auswahl[256];
    if(sscanf(params, "us", ID, auswahl))
    {
            SendClientMessage(playerid, COLOR_WHITE, "|__________________ Accept __________________|");
            SendClientMessage(playerid, COLOR_WHITE, "Nutze: /sell [spielerid][item]");
            SendClientMessage(playerid, COLOR_GREY, "Verfu"gbare Waren: Pizza");
            SendClientMessage(playerid, COLOR_WHITE, "
|____________________________________________|");
            return 1;
    }
    if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
    {
        if(!strcmp(auswahl,"
pizza",true))
        {
          new GSpieler[MAX_PLAYER_NAME],PSpieler[MAX_PLAYER_NAME],sstring[256],pstring[256];
          GetPlayerName(ID,GSpieler,sizeof(GSpieler));
          GetPlayerName(playerid,PSpieler,sizeof(PSpieler));
          format(pstring,sizeof(pstring),"
Nostra Do"ner Mitarbeiter %s, hat dir eine Pizza u"berreicht.",PSpieler);
          SendClientMessage(ID,COLOR_YELLOW,pstring);
          format(sstring,sizeof(sstring),"
Du hast dem Kunden %s eine Pizza u"berreicht.",GSpieler);
          SendClientMessage(playerid, COLOR_WHITE,sstring);
        }
        else
        {
        SendClientMessage(playerid, COLOR_GRAD2,"Wrong name of item.");
        }
    }
    else
    {
      SendClientMessage(playerid, COLOR_GRAD2,"Du bist kein Nostra Doner Mittarbeiter");
    }
    return 1;
}
Reply
#5

Thank you.

its going Wonderfull !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)