Help with dcmd_wcheck command!!!
#1

Hi all i need a dcmd_wcheck command like when i use /wcheck <playerid> it sends me back the weapon names and ammos the targetid had. Please help
Reply
#2

Anyone? i am in great trouble, Help please!!!
Reply
#3

bump! anyone /gethealth , /getarmour or /getweapons. Any of these or /getinfo with all 3 functions? Anyone?
Reply
#4

I have never used dcmd before, I normally use zcmd. Here is what I would do for /gethealth, however it is untested.

NOTE: This requires sscanf, I highly recommend using it if you don't have it.
Код:
dcmd_gethealth(const playerid, const params[])
{
	//if(CheckIfPlayerIsAnAdminHere)
	//{
		new Float:fHealth, iTargetID, szString[16+MAX_PLAYER_NAME+1], szPlayername[MAX_PLAYER_NAME+1];
		if(sscanf(params, "u", iTargetID)) return SendClientMessage(playerid, -1, "Syntax: /gethealth [playerid]");
		GetPlayerHealth(iTargetID, fHealth);
		GetPlayerName(iTargetID, szPlayername, sizeof(szPlayername));
		format(szString, sizeof(szString), "%s has %.0f health!", szPlayername, fHealth);
		SendClientMessage(playerid, -1, szString);
		return 1;
	//}
	//else return SendClientMessage(playerid, -1, "You are not authorised to use this command!");
}
Reply
#5

Yeah that worked thanks man!
I scripted my own dcmd wheck cmd if anyone wants i am a newbie but that works!!
pawn Код:
dcmd_wcheck(playerid,params[])
{
    new ID;
    if(IsPlayerCommandLevel(playerid,"morning"))
    {
        if(sscanf(params, "u", ID))
        {
           SendClientMessage(playerid,red,"USAGE: /wcheck (ID)");
           return 1;
        }
        new WeapAmmo[2], name[24], string[128];
        GetPlayerName(ID, name, sizeof(name));
        format(string, sizeof(string), "%s's Weapons:", name);
        for(new w = 0; w < 13; w++)
        {
            GetPlayerWeaponData(ID, w, WeapAmmo[0], WeapAmmo[1]);
            GetWeaponName(WeapAmmo[0], name, sizeof(name));
            format(string, sizeof(string), "%s %s(%d),", string, name, WeapAmmo[1]);
        }
        string[strlen(string)-1] = 0;
        SendClientMessage(playerid, red, string);
    }
    else return SendLevelErrorMessage(playerid,"morning");
    return 1;
}
Reply
#6

please someone post /getarmour cmd and also if someone can improve the above code.
Reply
#7

Quote:
Originally Posted by HitterHitman
Посмотреть сообщение
please someone post /getarmour cmd and also if someone can improve the above code.
This should work, all you really have to do is change /gethealth to /getarmour and all the health related variables/text to armour.
Код:
 
dcmd_getarmor(const playerid, const params[])
{
	//if(CheckIfPlayerIsAnAdminHere)
	//{
		new Float:fArmour, iTargetID, szString[16+MAX_PLAYER_NAME+1], szPlayername[MAX_PLAYER_NAME+1];
		if(sscanf(params, "u", iTargetID)) return SendClientMessage(playerid, -1, "Syntax: /getarmor [playerid]");
		GetPlayerArmour(iTargetID, fArmour);
		GetPlayerName(iTargetID, szPlayername, sizeof(szPlayername));
		format(szString, sizeof(szString), "%s has %.0f armor!", szPlayername, fHealth);
		SendClientMessage(playerid, -1, szString);
		return 1;
	//}
	//else return SendClientMessage(playerid, -1, "You are not authorised to use this command!");
}
Reply
#8

Quote:
Originally Posted by BlackSirrah239
Посмотреть сообщение
This should work, all you really have to do is change /gethealth to /getarmour and all the health related variables/text to armour.
Код:
 
dcmd_getarmor(const playerid, const params[])
{
	//if(CheckIfPlayerIsAnAdminHere)
	//{
		new Float:fArmour, iTargetID, szString[16+MAX_PLAYER_NAME+1], szPlayername[MAX_PLAYER_NAME+1];
		if(sscanf(params, "u", iTargetID)) return SendClientMessage(playerid, -1, "Syntax: /getarmor [playerid]");
		GetPlayerArmour(iTargetID, fArmour);
		GetPlayerName(iTargetID, szPlayername, sizeof(szPlayername));
		format(szString, sizeof(szString), "%s has %.0f armor!", szPlayername, fHealth);
		SendClientMessage(playerid, -1, szString);
		return 1;
	//}
	//else return SendClientMessage(playerid, -1, "You are not authorised to use this command!");
}
Yeah worked!!

Can someone improve the /wcheck cmd.
Like now i am getting hitman007's weapon (0),(0),etc.
But, i want them like if i have no weapons it shows hitman007 has no weapons and if i have weapons less then 13 it doesn't show me all 13 slots ex- (0),Colt--,(0),RPG,etc. In short i want to remove (0) and give a special message if target has no weapons, Thank you very much!!!
Reply
#9

How about this:
Код:
stock WeaponIDCheck(weaponid)
{
	new szReason[16];
    switch(weaponid)
		{
		    case 0: format(szReason, sizeof(szReason), "Fists");
		    case 1: format(szReason, sizeof(szReason), "Brass Knuckles");
		    case 2: format(szReason, sizeof(szReason), "Golf Club");
		    case 3: format(szReason, sizeof(szReason), "Night Stick");
		    case 4: format(szReason, sizeof(szReason), "Knife");
		    case 5: format(szReason, sizeof(szReason), "Baseball Bat");
		    case 6: format(szReason, sizeof(szReason), "Shovel");
		    case 7: format(szReason, sizeof(szReason), "Pool Cue");
		    case 8: format(szReason, sizeof(szReason), "Katana");
		    case 9: format(szReason, sizeof(szReason), "Chainsaw");
		    case 10: format(szReason, sizeof(szReason), "Dildo");
		    case 11: format(szReason, sizeof(szReason), "Dildo");
		    case 12: format(szReason, sizeof(szReason), "Vibrator");
		    case 13: format(szReason, sizeof(szReason), "Vibrator");
		    case 14: format(szReason, sizeof(szReason), "Flowers");
		    case 15: format(szReason, sizeof(szReason), "Cane");
		    case 16: format(szReason, sizeof(szReason), "Grenade");
		    case 17: format(szReason, sizeof(szReason), "Tear Gas");
		    case 18: format(szReason, sizeof(szReason), "Molotov Cocktail");
		    case 22: format(szReason, sizeof(szReason), "9mm Pistol");
		    case 23: format(szReason, sizeof(szReason), "Silenced 9mm");
		    case 24: format(szReason, sizeof(szReason), "Desert Eagle");
		    case 25: format(szReason, sizeof(szReason), "Shotgun");
		    case 26: format(szReason, sizeof(szReason), "Sawn-off Shotgun");
		    case 27: format(szReason, sizeof(szReason), "Spas-12");
		    case 28: format(szReason, sizeof(szReason), "Uzi");
		    case 29: format(szReason, sizeof(szReason), "MP5");
		    case 30: format(szReason, sizeof(szReason), "AK-47");
		    case 31: format(szReason, sizeof(szReason), "M4");
		    case 32: format(szReason, sizeof(szReason), "Tec-9");
		    case 33: format(szReason, sizeof(szReason), "County Rifle");
		    case 34: format(szReason, sizeof(szReason), "Sniper Rifle");
		    case 35: format(szReason, sizeof(szReason), "RPG");
		    case 36: format(szReason, sizeof(szReason), "Heat-Seaking Rocket");
		    case 37: format(szReason, sizeof(szReason), "Flamethrower");
		    case 38: format(szReason, sizeof(szReason), "Minigun");
		    case 39: format(szReason, sizeof(szReason), "C4");
		    case 40: format(szReason, sizeof(szReason), "Detonator");
		    case 41: format(szReason, sizeof(szReason), "Spraycan");
		    case 42: format(szReason, sizeof(szReason), "Fire Extinguisher");
		    case 43: format(szReason, sizeof(szReason), "Camera");
		    case 44: format(szReason, sizeof(szReason), "Night Vision Goggles");
		    case 45: format(szReason, sizeof(szReason), "Thermal Goggles");
		    case 46: format(szReason, sizeof(szReason), "Parachute");
		    default: format(szReason, sizeof(szReason), "Unknown");
		}
	return szReason;
}
and this:
Код:
dcmd_wcheck(playerid,params[])
{
    new iTargetID;
    if(IsPlayerCommandLevel(playerid,"morning"))
    {
        if(sscanf(params, "u", iTargetID)) return SendClientMessage(playerid,red,"USAGE: /wcheck (ID)");
        new iAmmo[2], szPlayername[MAX_PLAYER_NAME+1], szString[128];
        GetPlayerName(iTargetID, szPlayername, sizeof(szPlayername));
        format(szString, sizeof(szString), "%s's Weapons:", szPlayername);
        SendClientMessage(playerid, red, szString);
        for(new i = 0; i < 13; i++)
        {
            GetPlayerWeaponData(iTargetID, i, iAmmo[0], iAmmo[1]);
            GetWeaponName(iAmmo[0], szPlayername, sizeof(szPlayername));
            if(iAmmo[0] != 0)
			{
				format(szString, sizeof(szString), "%s (%d)", WeaponIDCheck(iAmmo[0]), iAmmo[0]); //Prints the weapon name and weapon id
				SendClientMessage(playerid, 0xBFC0C2FF, szString);
			}
        }
        SendClientMessage(playerid, red, "__________"); //line underneath the weapons to show the end of it. Also looks neater in my opinion.
        return 1;
    }
    else return SendLevelErrorMessage(playerid,"morning");
    return 1;
}
Code is not tested.
Reply
#10

where to put the first code!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)