This dont work :X
#1

please say me why this dont work? I giving 4 errors:

Quote:

dcmd_giveweapon(playerid,params[])
{
if(AccInfo[playerid][Level] >= 2)
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
new tmp3[256]; tmp3 = strtok(params,Index);

if(!strlen(tmp) || !strlen(tmp2)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /giveweapon [PlayerID] [Weapon ID/Name] [Ammo]") &&
SendClientMessage(playerid, orange, "Function: Will Crash a specified player");
new player1 = strval(tmp);
new weap, ammo, WeapName[32];
new string[128];
if(!strlen(tmp3) || !IsNumeric(tmp3) || strval(tmp3) <= 0 || strval(tmp3) > 99999) ammo = 500;
else ammo = strval(tmp3);
if(!IsNumeric(tmp2)) weap = GetWeaponIDFromName(tmp2);
else weap = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(!IsValidWeapon(weap))
return SendClientMessage(playerid,red,"ERROR: Invalid Weapon ID");
SendCommandToAdmins(playerid,"GiveWeapon");
GetWeaponName(weap,WeapName,32);
format(string, sizeof(string), "|- You have given \"%s\" a %s (%d) with %d rounds of Ammo -|", PlayerName2(player1), WeapName, weap, ammo);
SendClientMessage(playerid,BlueMsg,string);
if(player1 != playerid)
{
format(string,sizeof(string),"|- Administrator \"%s\" has given you a %s (%d) with %d rounds of Ammo -|", PlayerName2(playerid), WeapName, weap, ammo);
SendClientMessage(player1,blue,string);
}
return GivePlayerWeapon(player1, weap, ammo);
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}

Reply
#2

Wrap your code in [ pawn][/pawn] without the space in the first part, and post what errors you are having.
Reply
#3

C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1539) : warning 203: symbol is never used: "dcmd_giveweapon"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

Have you added something similar to dcmd(giveweapon,10,cmdtext); under OnPlayerCommandText?
Reply
#5

no i didnt i dont have dcmd
Reply
#6

pawn Код:
//add this at the top of script after the #include <a_samp> or other includes

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
next is add this onplayercommandtext

pawn Код:
dcmd(giveweapon, 10, cmdtext);
Reply
#7

but where onplayercommandtext and
Quote:

dcmd(giveweapon, 10, cmdtext);

omg i want anyone create /giveweapon for me
Reply
#8

pawn Код:
public OnPlayerCommandText(playerid)
dcmd(giveweapon, 10, cmdtext);
Like this.
Edit: Damn forgot the braces!
Reply
#9

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid)
dcmd(giveweapon, 10, cmdtext);
Like this.
No. That would fire the command everytime OnPlayerText is called.

This, would be the appropriate code:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(giveweapon, 10, cmdtext);
}
Reply
#10

after what? just give me all pawn code for giveweapon or create new pawno code for giveweapon command pls for level 3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)