[Pomoc] Komanda za oruzje

Započeo Matteo
•20. Sep. 2010.
2,539
pregleda
21
postova
matteokov
4
Shot Caller
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
Evo kao sto vidite u terba mi najobicnija komanda za davanje oruzja nekoj osobi ne sebo ko ovdje
	if (strcmp("/givesniper", cmdtext, true, 10) == 0)
{
GivePlayerWeapon(playerid, 34, 40);
return 1;
}

Hocu da mogu dat nekome... Pomoc...
gonss
5
Crime Lord
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
if(strcmp(cmd, "/givegun", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givegun [playerid/PartOfName] [weaponid(eg. 46 = Parachute)] ");
return 1;
}
new playa;
new gun;
new ammo;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
gun = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givegun [playerid/PartOfName] ");
SendClientMessage(playerid, COLOR_GRAD4, "3(Club) 4(knife) 5(bat) 6(Shovel) 7(Cue) 8(Katana) 10-13(Dildo) 14(Flowers) 16(Grenades) 18(Molotovs) 22(Pistol) 23(SPistol)");
SendClientMessage(playerid, COLOR_GRAD3, "24(Eagle) 25(shotgun) 29(MP5) 30(AK47) 31(M4) 33(Rifle) 34(Sniper) 37(Flamethrower) 41(spray) 42(exting) 43(Camera) 46(Parachute)");
return 1;
}
if(gun < 1||gun > 46||gun==27)
{ SendClientMessage(playerid, COLOR_GRAD1, "   wrong WeaponID!"); return 1; }
tmp = strtok(cmdtext, idx);
ammo = strval(tmp);
if(ammo <1||ammo > 999)
{ SendClientMessage(playerid, COLOR_GRAD1, "   dont go below 1 or above 999 bullets!"); return 1; }
if (PlayerInfo >= 4)
{
   if(IsPlayerConnected(playa))
   {
       if(playa != INVALID_PLAYER_ID)
       {
GivePlayerWeapon(playa, gun, ammo);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
}
}
return 1;
}

ja msm da je toto
matteokov
4
Shot Caller
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
napise mi milju errora xD
gonss
5
Crime Lord
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
//----------------------------------------------------------------------------------
if(strcmp(cmd, "/givegun", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givegun [playerid/PartOfName] [weaponid(eg. 46 = Parachute)] ");
return 1;
}
new playa;
new gun;
new ammo;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
gun = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givegun [playerid/PartOfName] ");
SendClientMessage(playerid, COLOR_GRAD4, "3(Club) 4(knife) 5(bat) 6(Shovel) 7(Cue) 8(Katana) 10-13(Dildo) 14(Flowers) 16(Grenades) 18(Molotovs) 22(Pistol) 23(SPistol)");
SendClientMessage(playerid, COLOR_GRAD3, "24(Eagle) 25(shotgun) 29(MP5) 30(AK47) 31(M4) 33(Rifle) 34(Sniper) 37(Flamethrower) 41(spray) 42(exting) 43(Camera) 46(Parachute)");
return 1;
}
if(gun < 1||gun > 46||gun==27||gun==1||gun==2||gun==9||gun==17||gun==19||gun==20||gun==21||gun==36||gun==38||gun==39||gun==40||gun==44||gun==45)
{ SendClientMessage(playerid, COLOR_GRAD1, "  wrong WeaponID!"); return 1; }
tmp = strtok(cmdtext, idx);
ammo = strval(tmp);
if(ammo <1||ammo > 999)
{ SendClientMessage(playerid, COLOR_GRAD1, "  dont go below 1 or above 999 bullets!"); return 1; }
if (PlayerInfo >= 4)
{
    if(IsPlayerConnected(playa))
    {
        if(playa != INVALID_PLAYER_ID)
        {
GivePlayerWeapon(playa, gun, ammo);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "  Nisi Ovlasten da koristis tu komandu!");
}
}
return 1;
}

to?
matteokov
4
Shot Caller
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
da za to mi ispise milju errora, imam svoj gamemod nije nijedan kao GF bas moj, treba mi nesto jednostavno jer je to DM skripta
gonss
5
Crime Lord
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
za DM
//============GiveGun=========================
if(strcmp(cmdtext, "/givegun",true)==0) {
new weaponname, player2name;
new playermsg, player2msg;
tmp = strtok(cmdtext, idx);

if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "Usage: /givegun ");
return 1;
}
new player2id = strval(tmp);

if(IsPlayerConnected(player2id))
{
if(player2id==playerid)
{
SendClientMessage(playerid, COLOR_RED, "You can't use your own ID");
return 1;
}
else
{
weaponid = GetPlayerWeapon(playerid);
new weaponammo;
if(weaponid == 0)
{
SendClientMessage(playerid, COLOR_RED, "You're not holding a weapon");
return 1;
}
else
{
new weapo;
for(new i;i<13;i++)
{
GetPlayerWeaponData(playerid, i, weapo, weapo);
if(weapo==weaponid) weaponammo=weapo;
}
ResetPlayerWeapons(playerid);
for(new i;i<13;i++) if(weapo!=weaponid) GivePlayerWeapon(playerid, weapo, weapo);
GivePlayerWeapon(player2id, weaponid, weaponammo);

GetWeaponName(weaponid, weaponname, 64);
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(player2id, player2name, sizeof(player2name));

format(playermsg, 255, "You gave your %s to %s(%d)", weaponname, player2name, player2id);
SendClientMessage(playerid, COLOR_YELLOW, playermsg);

format(player2msg, 255, "You recived a %s from %s(%d)", weaponname, playername, playerid);
SendClientMessage(player2id, COLOR_YELLOW, player2msg);
}
}
}
else
{
format(string, sizeof(string), "(%d) is not an active player", player2id);
SendClientMessage(playerid, COLOR_RED, string);
}
return 1;
}
matteokov
4
Shot Caller
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
opet errori daj nes skroz jednostavno, mogu ja svako komadnu za svako oruzje, nije bed samo da ukucam npr /giveminigun i da on to oruzje da nekome
uredite ovo:
	if (strcmp("/givesniper", cmdtext, true, 10) == 0)
{
GivePlayerWeapon(playerid, 34, 40);
return 1;
}
NanX
4
Made Man
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
Kod give player weapon poslje player id stavis ono ti je id prvo a drugo ammo... I uredis recimo tec9
Playerid,32,100
32-id tec9
100-ammo ...
Nadam se da sam pomogo...
Iam stunt mode al na mobu sam pa nemogu dat.. Sry
Johnâ„¢
5
Godfather
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
20. Sep. 2010.
Evo kako bi to izgledalo preko ZCMD-a i sscanf:


CMD:givegun(playerid, params[])
{
new
    pID,
    gID,
Ammo;
if(sscanf(params, "udd", pID, gID, Ammo)) return SendClientMessage(playerid, 0xFF0000AA, "Koristi: /givegun ");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, " Taj igrac ne postoji!");
GivePlayerWeapon(pID, gID, Ammo);
return 1;
}
matteokov
4
Shot Caller
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
21. Sep. 2010.
Quote from September 20, 2010, 5:35 pm:
Kod give player weapon poslje player id stavis ono ti je id prvo a drugo ammo... I uredis recimo tec9
Playerid,32,100
32-id tec9
100-ammo ...
Nadam se da sam pomogo...
Iam stunt mode al na mobu sam pa nemogu dat.. Sry


nekuzim bas :/

paradox gdje to ubacim posto je CMD
Johnâ„¢
5
Godfather
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
21. Sep. 2010.
Mozes ispod OnPlayerCommandText, ali ti treba ZCMD i sscanf.
matteokov
4
Shot Caller
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
21. Sep. 2010.
moze link od sscanfa
Johnâ„¢
5
Godfather
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
21. Sep. 2010.
Sscanf download
matteokov
4
Shot Caller
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
21. Sep. 2010.
sta ide u sta, mislim na ove datoteke
Johnâ„¢
5
Godfather
Balkan SA:MPBalkan SA:MP
SA-MP DoprinosSA-MP Doprinos
21. Sep. 2010.
sscanf2.inc stavis u pawno/include folder. Ako imas Windows onda stavi sscanf.dll u plugins folder (ako nemas plugins folder, napravi ga) i onda samo jos u server.cfg stavi plugins sscanf . A ako imas Linux onda stavi sscanf.so u plugins folder i u server.cfg umjesto plugins sscanf stavi plugins sscanf.so . Nadam se da sam dobro objasnio.

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha