[HELP] materials
#1

hello guys im making a systeme of mateials when some one drop materials he can control on them i mean ex
/dropmats (ammount) so if he want drop only 1 materials he can drop only '1'

im made it but when i do ex : /dropmats '1' it droping all mats mats on ground .

check

:

Код:
if(strcmp(cmd, "/pmats", true) == 0|| strcmp(cmd, "/posermateriels", true) == 0) // By FreshKilla
    {
        if(IsPlayerConnected(playerid))
        {
                tmp = strtok(cmdtext, idx);
			    if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pmats [montant]");
					return 1;
			}
            new stash = PlayerInfo[playerid][pMats];

            if(stash != 0)
			{
		        new mammount;
				mammount = strval(tmp);
                if(mammount > PlayerInfo[playerid][pMats]) { SendClientMessage(playerid, COLOR_GREY, "   Vous n'avez pas suffisament de matйriaux."); return 1; }
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				PlayerInfo[playerid][pMats] -= mammount;
		    	PlayerInfo[giveplayerid][pMats] += mammount;
                ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
		        format(string, sizeof(string), "* %s laisse tomber ses Matos а terre.", sendername);
		        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				SendClientMessage(playerid, COLOR_GREY, " Vous avez laissй tomber vos matйriaux dans le sol.");
				GetPlayerName(playerid,tmp,MAX_PLAYER_NAME);
				for(new i = 0; i < sizeof(DropInfo); i++)
Reply
#2

Post the whole code, and I'll help you
Reply
#3

Код:
if(strcmp(cmd, "/pmats", true) == 0|| strcmp(cmd, "/posermateriels", true) == 0) // By FreshKilla
    {
        if(IsPlayerConnected(playerid))
        {
                tmp = strtok(cmdtext, idx);
			    if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pmats [montant]");
					return 1;
			}
			new stash = PlayerInfo[playerid][pMats];

            if(stash != 0)
			{
                PlayerInfo[playerid][pMats] = 0;
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new mammount;
				mammount = strval(tmp);
   	            if(mammount < PlayerInfo[playerid][pMats]) { SendClientMessage(playerid, COLOR_GREY, "   Vous n'avez pas suffisament de matйriaux."); return 1; }
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				PlayerInfo[playerid][pMats] -= mammount;
		    	PlayerInfo[giveplayerid][pMats] += mammount;
                ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
		        format(string, sizeof(string), "* %s laisse tomber ses Matos а terre.", sendername);
		        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				SendClientMessage(playerid, COLOR_GREY, " Vous avez laissй tomber vos matйriaux dans le sol.");
				GetPlayerName(playerid,tmp,MAX_PLAYER_NAME);
				for(new i = 0; i < sizeof(DropInfo); i++)
  	            {
  	                if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
  	                {
  	                    new Float:X,Float:Y,Float:Z;
		    	    	GetPlayerPos(playerid, X, Y, Z);
  	                    DropInfo[i][dType] = 3;
  	                    DropInfo[i][dAmount][0] = stash;
  	                    DropInfo[i][dx] = X;
  	                    DropInfo[i][dy] = Y;
  	                    DropInfo[i][dz] = Z;
  	                    DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
  	                    strcpy(DropInfo[i][dPlayerName],tmp,MAX_PLAYER_NAME);
  	                    DropObject[i] = CreateDynamicObject(2060, X, Y, Z-1, 0, 0, 0, GetPlayerVirtualWorld(playerid));
						return 1;
  	                }
				}
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "  Vous n'avez pas des matйriaux d'abandonner ! ");
                return 1;
            }
        }
        return 1;
    }
Reply
#4

pawn Код:
if(!strcmp(cmd, "/pmats", true) || !strcmp(cmd, "/posermateriels", true)) // By FreshKilla
{
    tmp = strtok(cmdtext, idx);

    if(!strlen(tmp))
    {
        return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pmats [montant]");
    }

    if(!PlayerInfo[playerid][pMats])
    {
        return SendClientMessage(playerid, COLOR_GREY, "  Vous n'avez pas des mate'riaux d'abandonner ! ");
    }

    if(strval(tmp) > PlayerInfo[playerid][pMats])
    {
        return SendClientMessage(playerid, COLOR_GREY, "   Vous n'avez pas suffisament de mate'riaux.");
    }
   
    GetPlayerName(playerid, sendername, sizeof(sendername));
    PlayerInfo[playerid][pMats] -= strval(tmp);
    ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
    format(string, sizeof(string), "* %s laisse tomber ses Matos a` terre.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

    return 1;
}
Reply
#5

but you forget the createobject :/

if(DropInfo[i][dx] == 0.0 && DropInfo[i][dy] == 0.0 && DropInfo[i][dz] == 0.0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
DropInfo[i][dType] = 3;
DropInfo[i][dAmount][0] = stash;
DropInfo[i][dx] = X;
DropInfo[i][dy] = Y;
DropInfo[i][dz] = Z;
DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
strcpy(DropInfo[i][dPlayerName],tmp,MAX_PLAYER_NAME);
DropObject[i] = CreateDynamicObject(2060, X, Y, Z-1, 0, 0, 0, GetPlayerVirtualWorld(playerid));
return 1;
}
}
return 1;
}
Could you fix them i cant see the object so i can get back the mats to me
Reply
#6

Before you add this, how does this work? what you did is, looping through all available DropInfo, and whatever were add no positions, you create an object. I think it does that a few times, ehm...
pawn Код:
if(!strcmp(cmd, "/pmats", true) || !strcmp(cmd, "/posermateriels", true)) // By FreshKilla
{
    tmp = strtok(cmdtext, idx);

    if(!strlen(tmp))
    {
        return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pmats [montant]");
    }

    if(!PlayerInfo[playerid][pMats])
    {
        return SendClientMessage(playerid, COLOR_GREY, "  Vous n'avez pas des mate'riaux d'abandonner ! ");
    }

    if(strval(tmp) > PlayerInfo[playerid][pMats])
    {
        return SendClientMessage(playerid, COLOR_GREY, "   Vous n'avez pas suffisament de mate'riaux.");
    }

    GetPlayerName(playerid, sendername, sizeof(sendername));
    PlayerInfo[playerid][pMats] -= strval(tmp);
    ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
    format(string, sizeof(string), "* %s laisse tomber ses Matos a` terre.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

    for(new i; i < sizeof(DropInfo); i++)
    {
        if(DropInfo[i][dx] != 0.0 && DropInfo[i][dy] != 0.0 && DropInfo[i][dz] != 0.0)
        {
            continue;
        }

        new
            Float:X,
            Float:Y,
            Float:Z
        ;

        GetPlayerPos(playerid, X, Y, Z);
        DropInfo[i][dType] = 3;
        DropInfo[i][dAmount][0] = stash;
        DropInfo[i][dx] = X;
        DropInfo[i][dy] = Y;
        DropInfo[i][dz] = Z;
        DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
        strcpy(DropInfo[i][dPlayerName],tmp,MAX_PLAYER_NAME);
        DropObject[i] = CreateDynamicObject(2060, X, Y, Z-1, 0, 0, 0, GetPlayerVirtualWorld(playerid));
        break;
    }
   
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)