SA-MP Forums Archive
dcmd with parameter: /sell [playerid][item] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dcmd with parameter: /sell [playerid][item] (/showthread.php?tid=113495)



dcmd with parameter: /sell [playerid][item] - lolmaster - 14.12.2009

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;
}



Re: dcmd with parameter: /sell [playerid][item] - yom - 14.12.2009

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


Re: dcmd with parameter: /sell [playerid][item] - lolmaster - 14.12.2009

You can fix this please?



Re: dcmd with parameter: /sell [playerid][item] - Toney - 14.12.2009

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;
}



Re: dcmd with parameter: /sell [playerid][item] - lolmaster - 14.12.2009

Thank you.

its going Wonderfull !