Can anyone help me
#1

Well still i got problems with /sellgun let me explain i wan't to add a gun over there sniper, its easy to add but i wan't to make it with restrictions like:i got nyo script and i wan't to make that gundealer would be able to sell a sniper only to a T1, or T0, and not others, so not everybody will have a sniper
CODES:
Код:
}
COMMAND:gundealer(playerid, params[])
{
	if(IsPlayerFED(playerid))
		return SendClientError(playerid, CANT_USE_CMD);
    if(!IsPlayerInSphere(playerid,2201.1729,-1970.2307,13.7841,5))
		return SendClientError(playerid, "You are not at the right location!");
    if(strcmp(PlayerInfo[playerid][job],"None",true))
        return SendClientMessage(playerid,COLOR_RED,"[JOB] You already have a job - Use \"/quitjob\" to leave your current one!");

	myStrcpy(PlayerInfo[playerid][job],"GunDealer");
	ShowInfoBox(playerid, "GunDealer", "congratulations, you are now a ~r~gundealer~w~! Use /jobhelp to see your new commands. Check your radar for the place to buy guns!");
	SetPlayerCheckpoint(playerid, -33.6417,-1122.1495,1.0970, 3.0);
	format(iStr, sizeof(iStr), "6[JOB] %s is now a GunDealer!", PlayerName(playerid));
	return 1;
}
enum _wdata
{
	wname[ 12 ],
	wID,
	wAmmo,
	wSellables,
}
new weapon_arr[][_wdata] = {
	// Weapon ,  ID, Ammo, Materials
	{ "Katana",   8, 1  , 1},
	{ "Flowers",  14,1  , 1},
	{ "Molotov",  18,1  , 12},
	{ "Deagle",	  24,75 , 1},
	{ "MP5",	  29,150, 1},
	{ "Shotgun",  25,75 , 2},
	{ "AK47",	  30,150, 2},
	{ "M4",		  31,150, 2},
	{ "Rifle",	  33,75,  2}
};
COMMAND:sellgun(playerid, params[])
{
	if(strcmp(PlayerInfo[playerid][job],"GunDealer", true)) return SendClientError(playerid, CANT_USE_CMD);
	new iPlayer, iWeapon[ 128 ];
	if( sscanf ( params, "us", iPlayer, iWeapon))
	{
		SCP(playerid, "[PlayerID/PartOfName] [weapon]");
		new bStr[ 256 ];
		format(bStr, sizeof(bStr), "Available weapons: ");
		for(new q; q < sizeof(weapon_arr); q++)
		{
			new tmp[ 20 ];
			format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
			strcat(bStr, tmp);
		}
		strdel(bStr,strlen(bStr)-1, strlen(bStr));
		SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
		return 1;
	}
	if(!IsPlayerConnected(iPlayer)) return SendClientError(playerid, PLAYER_NOT_FOUND);
	//if(iPlayer == playerid) return SendClientError(playerid, "You cannot sell any guns to yourself!");
	if(GetDistanceBetweenPlayers(playerid, iPlayer) > 3) return SendClientError(playerid, "He is too far away!");
	new dSELECT = -1;
	for(new q; q < sizeof(weapon_arr); q++)
	{
		if(strfind(weapon_arr[q][wname],iWeapon, true) != -1) dSELECT = q;
	}
	if(dSELECT == -1)
	{
		new bStr[ 256 ];
		format(bStr, sizeof(bStr), "Available weapons: ");
		for(new q; q < sizeof(weapon_arr); q++)
		{
			new tmp[ 20 ];
			format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
			strcat(bStr, tmp);
		}
		strdel(bStr,strlen(bStr)-1, strlen(bStr));
		SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
		return 1;
	}
	if(PlayerInfo[playerid][sguns] < weapon_arr[dSELECT][wSellables])
		return SendClientMSG(playerid, COLOR_ADMIN_PM, "[GUNDEALER]: You don't have enough sellables! You need %d sellabes.", weapon_arr[dSELECT][wSellables]);
	format(iStr, sizeof(iStr), "has sold a %s with %d ammo to %s.", weapon_arr[dSELECT][wname],weapon_arr[dSELECT][wAmmo], MaskedName(iPlayer));
	Action(playerid, iStr);
	if(dSELECT == 3) SetPVarInt(iPlayer, "Molotov", 1);
	GivePlayerWeapon(iPlayer, weapon_arr[dSELECT][wID], weapon_arr[dSELECT][wAmmo]);
	PlayerInfo[playerid][sguns] -= weapon_arr[dSELECT][wSellables];
	PlayerInfo[playerid][jobskill] += minrand(1,2);
	format(iStr, sizeof(iStr), "6[JOB] GunDealer %s has sold a %s to %s.", PlayerName(playerid), weapon_arr[dSELECT][wname], PlayerName(iPlayer));
	SendClientMSG(playerid, COLOR_LIGHTGREY, " You lost %d sellables selling this %s. You now have %d sellables left.", weapon_arr[dSELECT][wSellables], weapon_arr[dSELECT][wname], PlayerInfo[playerid][sguns]);
	return 1;
}
Reply
#2

pawn Код:
COMMAND:gundealer(playerid, params[])
{
    if(IsPlayerFED(playerid))
        return SendClientError(playerid, CANT_USE_CMD);
    if(!IsPlayerInSphere(playerid,2201.1729,-1970.2307,13.7841,5))
        return SendClientError(playerid, "You are not at the right location!");
    if(strcmp(PlayerInfo[playerid][job],"None",true))
        return SendClientMessage(playerid,COLOR_RED,"[JOB] You already have a job - Use \"/quitjob\" to leave your current one!");

    myStrcpy(PlayerInfo[playerid][job],"GunDealer");
    ShowInfoBox(playerid, "GunDealer", "congratulations, you are now a ~r~gundealer~w~! Use /jobhelp to see your new commands. Check your radar for the place to buy guns!");
    SetPlayerCheckpoint(playerid, -33.6417,-1122.1495,1.0970, 3.0);
    format(iStr, sizeof(iStr), "6[JOB] %s is now a GunDealer!", PlayerName(playerid));
    return 1;
}
enum _wdata
{
    wname[ 12 ],
    wID,
    wAmmo,
    wSellables,
}
new weapon_arr[][_wdata] = {
    // Weapon ,  ID, Ammo, Materials
    { "Katana",   8, 1  , 1},
    { "Flowers",  14,1  , 1},
    { "Molotov",  18,1  , 12},
    { "Deagle",   24,75 , 1},
    { "MP5",      29,150, 1},
    { "Shotgun",  25,75 , 2},
    { "AK47",     30,150, 2},
    { "M4",       31,150, 2},
    { "Rifle",    33,75,  2}
};
COMMAND:sellgun(playerid, params[])
{
    if(strcmp(PlayerInfo[playerid][job],"GunDealer", true)) return SendClientError(playerid, CANT_USE_CMD);
    new iPlayer, iWeapon[ 128 ];
    if( sscanf ( params, "us", iPlayer, iWeapon))
    {
        SCP(playerid, "[PlayerID/PartOfName] [weapon]");
        new bStr[ 256 ];
        format(bStr, sizeof(bStr), "Available weapons: ");
        for(new q; q < sizeof(weapon_arr); q++)
        {
            new tmp[ 20 ];
            format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
            strcat(bStr, tmp);
        }
        strdel(bStr,strlen(bStr)-1, strlen(bStr));
        SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
        return 1;
    }
    if(!IsPlayerConnected(iPlayer)) return SendClientError(playerid, PLAYER_NOT_FOUND);
    //if(iPlayer == playerid) return SendClientError(playerid, "You cannot sell any guns to yourself!");
    if(GetDistanceBetweenPlayers(playerid, iPlayer) > 3) return SendClientError(playerid, "He is too far away!");
    new dSELECT = -1;
    for(new q; q < sizeof(weapon_arr); q++)
    {
        if(strfind(weapon_arr[q][wname],iWeapon, true) != -1) dSELECT = q;
    }
    if(dSELECT == -1)
    {
        new bStr[ 256 ];
        format(bStr, sizeof(bStr), "Available weapons: ");
        for(new q; q < sizeof(weapon_arr); q++)
        {
            new tmp[ 20 ];
            format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
            strcat(bStr, tmp);
        }
        strdel(bStr,strlen(bStr)-1, strlen(bStr));
        SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
        return 1;
    }
    if(PlayerInfo[playerid][sguns] < weapon_arr[dSELECT][wSellables])
        return SendClientMSG(playerid, COLOR_ADMIN_PM, "[GUNDEALER]: You don't have enough sellables! You need %d sellabes.", weapon_arr[dSELECT][wSellables]);
    else if(weapon_arr[dSELECT][wID] == WEAPON_SNIPER)  //  let's check if he is selling sniper
    {
        //  Don't allow to sell this weapon to other teams than T0 and T1
        if((team[iPlayer] != T0) || (team[iPlayer] != T1))  //  just change variables
            return  SendClientMessage(playerid, COLOR_ADMIN_PM, "You can't sell this weapon to this player");
    }
    format(iStr, sizeof(iStr), "has sold a %s with %d ammo to %s.", weapon_arr[dSELECT][wname],weapon_arr[dSELECT][wAmmo], MaskedName(iPlayer));
    Action(playerid, iStr);
    if(dSELECT == 3) SetPVarInt(iPlayer, "Molotov", 1);
    GivePlayerWeapon(iPlayer, weapon_arr[dSELECT][wID], weapon_arr[dSELECT][wAmmo]);
    PlayerInfo[playerid][sguns] -= weapon_arr[dSELECT][wSellables];
    PlayerInfo[playerid][jobskill] += minrand(1,2);
    format(iStr, sizeof(iStr), "6[JOB] GunDealer %s has sold a %s to %s.", PlayerName(playerid), weapon_arr[dSELECT][wname], PlayerName(iPlayer));
    SendClientMSG(playerid, COLOR_LIGHTGREY, " You lost %d sellables selling this %s. You now have %d sellables left.", weapon_arr[dSELECT][wSellables], weapon_arr[dSELECT][wname], PlayerInfo[playerid][sguns]);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Scottas
Посмотреть сообщение
pawn Код:
COMMAND:gundealer(playerid, params[])
{
    if(IsPlayerFED(playerid))
        return SendClientError(playerid, CANT_USE_CMD);
    if(!IsPlayerInSphere(playerid,2201.1729,-1970.2307,13.7841,5))
        return SendClientError(playerid, "You are not at the right location!");
    if(strcmp(PlayerInfo[playerid][job],"None",true))
        return SendClientMessage(playerid,COLOR_RED,"[JOB] You already have a job - Use \"/quitjob\" to leave your current one!");

    myStrcpy(PlayerInfo[playerid][job],"GunDealer");
    ShowInfoBox(playerid, "GunDealer", "congratulations, you are now a ~r~gundealer~w~! Use /jobhelp to see your new commands. Check your radar for the place to buy guns!");
    SetPlayerCheckpoint(playerid, -33.6417,-1122.1495,1.0970, 3.0);
    format(iStr, sizeof(iStr), "6[JOB] %s is now a GunDealer!", PlayerName(playerid));
    return 1;
}
enum _wdata
{
    wname[ 12 ],
    wID,
    wAmmo,
    wSellables,
}
new weapon_arr[][_wdata] = {
    // Weapon ,  ID, Ammo, Materials
    { "Katana",   8, 1  , 1},
    { "Flowers",  14,1  , 1},
    { "Molotov",  18,1  , 12},
    { "Deagle",   24,75 , 1},
    { "MP5",      29,150, 1},
    { "Shotgun",  25,75 , 2},
    { "AK47",     30,150, 2},
    { "M4",       31,150, 2},
    { "Rifle",    33,75,  2}
};
COMMAND:sellgun(playerid, params[])
{
    if(strcmp(PlayerInfo[playerid][job],"GunDealer", true)) return SendClientError(playerid, CANT_USE_CMD);
    new iPlayer, iWeapon[ 128 ];
    if( sscanf ( params, "us", iPlayer, iWeapon))
    {
        SCP(playerid, "[PlayerID/PartOfName] [weapon]");
        new bStr[ 256 ];
        format(bStr, sizeof(bStr), "Available weapons: ");
        for(new q; q < sizeof(weapon_arr); q++)
        {
            new tmp[ 20 ];
            format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
            strcat(bStr, tmp);
        }
        strdel(bStr,strlen(bStr)-1, strlen(bStr));
        SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
        return 1;
    }
    if(!IsPlayerConnected(iPlayer)) return SendClientError(playerid, PLAYER_NOT_FOUND);
    //if(iPlayer == playerid) return SendClientError(playerid, "You cannot sell any guns to yourself!");
    if(GetDistanceBetweenPlayers(playerid, iPlayer) > 3) return SendClientError(playerid, "He is too far away!");
    new dSELECT = -1;
    for(new q; q < sizeof(weapon_arr); q++)
    {
        if(strfind(weapon_arr[q][wname],iWeapon, true) != -1) dSELECT = q;
    }
    if(dSELECT == -1)
    {
        new bStr[ 256 ];
        format(bStr, sizeof(bStr), "Available weapons: ");
        for(new q; q < sizeof(weapon_arr); q++)
        {
            new tmp[ 20 ];
            format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
            strcat(bStr, tmp);
        }
        strdel(bStr,strlen(bStr)-1, strlen(bStr));
        SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
        return 1;
    }
    if(PlayerInfo[playerid][sguns] < weapon_arr[dSELECT][wSellables])
        return SendClientMSG(playerid, COLOR_ADMIN_PM, "[GUNDEALER]: You don't have enough sellables! You need %d sellabes.", weapon_arr[dSELECT][wSellables]);
    else if(weapon_arr[dSELECT][wID] == WEAPON_SNIPER)  //  let's check if he is selling sniper
    {
        //  Don't allow to sell this weapon to other teams than T0 and T1
        if((team[iPlayer] != T0) || (team[iPlayer] != T1))  //  just change variables
            return  SendClientMessage(playerid, COLOR_ADMIN_PM, "You can't sell this weapon to this player");
    }
    format(iStr, sizeof(iStr), "has sold a %s with %d ammo to %s.", weapon_arr[dSELECT][wname],weapon_arr[dSELECT][wAmmo], MaskedName(iPlayer));
    Action(playerid, iStr);
    if(dSELECT == 3) SetPVarInt(iPlayer, "Molotov", 1);
    GivePlayerWeapon(iPlayer, weapon_arr[dSELECT][wID], weapon_arr[dSELECT][wAmmo]);
    PlayerInfo[playerid][sguns] -= weapon_arr[dSELECT][wSellables];
    PlayerInfo[playerid][jobskill] += minrand(1,2);
    format(iStr, sizeof(iStr), "6[JOB] GunDealer %s has sold a %s to %s.", PlayerName(playerid), weapon_arr[dSELECT][wname], PlayerName(iPlayer));
    SendClientMSG(playerid, COLOR_LIGHTGREY, " You lost %d sellables selling this %s. You now have %d sellables left.", weapon_arr[dSELECT][wSellables], weapon_arr[dSELECT][wname], PlayerInfo[playerid][sguns]);
    return 1;
}
It isn't working exatly, let me tell you how it should be if you can fix it, cause im not that fine on scripting
lthis is used to buy on ammunation only t1 and t0..
Код:
 if(PlayerInfo[playerid][ranklvl] > 1 && PlayerInfo[playerid][playerteam] != HITMAN || PlayerInfo[playerid][playerteam] == CIV)
Anyway thanks if you can help me.
Reply
#4

Quote:
Originally Posted by Scottas
Посмотреть сообщение
pawn Код:
COMMAND:gundealer(playerid, params[])
{
    if(IsPlayerFED(playerid))
        return SendClientError(playerid, CANT_USE_CMD);
    if(!IsPlayerInSphere(playerid,2201.1729,-1970.2307,13.7841,5))
        return SendClientError(playerid, "You are not at the right location!");
    if(strcmp(PlayerInfo[playerid][job],"None",true))
        return SendClientMessage(playerid,COLOR_RED,"[JOB] You already have a job - Use \"/quitjob\" to leave your current one!");

    myStrcpy(PlayerInfo[playerid][job],"GunDealer");
    ShowInfoBox(playerid, "GunDealer", "congratulations, you are now a ~r~gundealer~w~! Use /jobhelp to see your new commands. Check your radar for the place to buy guns!");
    SetPlayerCheckpoint(playerid, -33.6417,-1122.1495,1.0970, 3.0);
    format(iStr, sizeof(iStr), "6[JOB] %s is now a GunDealer!", PlayerName(playerid));
    return 1;
}
enum _wdata
{
    wname[ 12 ],
    wID,
    wAmmo,
    wSellables,
}
new weapon_arr[][_wdata] = {
    // Weapon ,  ID, Ammo, Materials
    { "Katana",   8, 1  , 1},
    { "Flowers",  14,1  , 1},
    { "Molotov",  18,1  , 12},
    { "Deagle",   24,75 , 1},
    { "MP5",      29,150, 1},
    { "Shotgun",  25,75 , 2},
    { "AK47",     30,150, 2},
    { "M4",       31,150, 2},
    { "Rifle",    33,75,  2}
};
COMMAND:sellgun(playerid, params[])
{
    if(strcmp(PlayerInfo[playerid][job],"GunDealer", true)) return SendClientError(playerid, CANT_USE_CMD);
    new iPlayer, iWeapon[ 128 ];
    if( sscanf ( params, "us", iPlayer, iWeapon))
    {
        SCP(playerid, "[PlayerID/PartOfName] [weapon]");
        new bStr[ 256 ];
        format(bStr, sizeof(bStr), "Available weapons: ");
        for(new q; q < sizeof(weapon_arr); q++)
        {
            new tmp[ 20 ];
            format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
            strcat(bStr, tmp);
        }
        strdel(bStr,strlen(bStr)-1, strlen(bStr));
        SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
        return 1;
    }
    if(!IsPlayerConnected(iPlayer)) return SendClientError(playerid, PLAYER_NOT_FOUND);
    //if(iPlayer == playerid) return SendClientError(playerid, "You cannot sell any guns to yourself!");
    if(GetDistanceBetweenPlayers(playerid, iPlayer) > 3) return SendClientError(playerid, "He is too far away!");
    new dSELECT = -1;
    for(new q; q < sizeof(weapon_arr); q++)
    {
        if(strfind(weapon_arr[q][wname],iWeapon, true) != -1) dSELECT = q;
    }
    if(dSELECT == -1)
    {
        new bStr[ 256 ];
        format(bStr, sizeof(bStr), "Available weapons: ");
        for(new q; q < sizeof(weapon_arr); q++)
        {
            new tmp[ 20 ];
            format(tmp, sizeof(tmp), " %s (%d ammo),", weapon_arr[q][wname], weapon_arr[q][wAmmo]);
            strcat(bStr, tmp);
        }
        strdel(bStr,strlen(bStr)-1, strlen(bStr));
        SendMessageToPlayer(playerid, COLOR_ADMIN_PM, bStr);
        return 1;
    }
    if(PlayerInfo[playerid][sguns] < weapon_arr[dSELECT][wSellables])
        return SendClientMSG(playerid, COLOR_ADMIN_PM, "[GUNDEALER]: You don't have enough sellables! You need %d sellabes.", weapon_arr[dSELECT][wSellables]);
    else if(weapon_arr[dSELECT][wID] == WEAPON_SNIPER)  //  let's check if he is selling sniper
    {
        //  Don't allow to sell this weapon to other teams than T0 and T1
        if((team[iPlayer] != T0) || (team[iPlayer] != T1))  //  just change variables
            return  SendClientMessage(playerid, COLOR_ADMIN_PM, "You can't sell this weapon to this player");
    }
    format(iStr, sizeof(iStr), "has sold a %s with %d ammo to %s.", weapon_arr[dSELECT][wname],weapon_arr[dSELECT][wAmmo], MaskedName(iPlayer));
    Action(playerid, iStr);
    if(dSELECT == 3) SetPVarInt(iPlayer, "Molotov", 1);
    GivePlayerWeapon(iPlayer, weapon_arr[dSELECT][wID], weapon_arr[dSELECT][wAmmo]);
    PlayerInfo[playerid][sguns] -= weapon_arr[dSELECT][wSellables];
    PlayerInfo[playerid][jobskill] += minrand(1,2);
    format(iStr, sizeof(iStr), "6[JOB] GunDealer %s has sold a %s to %s.", PlayerName(playerid), weapon_arr[dSELECT][wname], PlayerName(iPlayer));
    SendClientMSG(playerid, COLOR_LIGHTGREY, " You lost %d sellables selling this %s. You now have %d sellables left.", weapon_arr[dSELECT][wSellables], weapon_arr[dSELECT][wname], PlayerInfo[playerid][sguns]);
    return 1;
}
It isn't working exatly, let me tell you how it should be if you can fix it, cause im not that fine on scripting
lthis is used to buy on ammunation only t1 and t0..
Код:
 if(PlayerInfo[playerid][ranklvl] > 1 && PlayerInfo[playerid][playerteam] != HITMAN || PlayerInfo[playerid][playerteam] == CIV)
Anyway thanks if you can help me.

Thanks as lot man, without you wouldn't fix this, done fixed <3 rep +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)