/kill don't work..
#1

Please help, when I try to make /kill cmd and I compile it it says

Quote:

C:\Programmer\Rockstar Games\GTA San Andreas\server\gamemodes\DM.pwn(337) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Here is the script.. I'm a newbie... soo bad script :P

Quote:

#include <a_samp>
#include <a_players>

/*

Duel Filterscript (Ripped from LW_LVDM)
Brought to you by [NB]Sneaky

www.99BlaZed.com
www.sneakyhost.net

You will need to edit line 184,185,201,202

*/

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define SendError(%1,%2) SendClientMessage(%1,COLOR_RED,"ERROR: " %2)
#define SendUsage(%1,%2) SendClientMessage(%1,COLOR_WHITE,"USAGE: " %2)

#define COLOR_ORANGE 0xFF8040FF
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000AA
#define COLOR_WHITE 0xFFFFFFAA

stock
g_GotInvitedToDuel[MAX_PLAYERS],
g_HasInvitedToDuel[MAX_PLAYERS],
g_IsPlayerDueling[MAX_PLAYERS],
g_DuelCountDown[MAX_PLAYERS],
g_DuelTimer[MAX_PLAYERS],
g_DuelInProgress,
g_DuelingID1,
g_DuelingID2;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Duel Mode");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0,1383.9786,2185.3762,11.0234,137.4 348,0,0,0,0,0,0); //
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
g_GotInvitedToDuel[playerid] = 0;
g_HasInvitedToDuel[playerid] = 0;
g_IsPlayerDueling[playerid] = 0;
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
if(playerid == g_DuelingID1 || playerid == g_DuelingID2)
{
g_DuelInProgress = 0;
}
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{

new
sString[128],
pName[MAX_PLAYER_NAME],
zName[MAX_PLAYER_NAME],
Float:Health,
Float:Armor;

if(g_IsPlayerDueling[playerid] == 1 && g_IsPlayerDueling[killerid] == 1)
{
GetPlayerHealth(killerid, Health);
GetPlayerArmour(killerid, Armor);

GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(killerid, zName, MAX_PLAYER_NAME);

if(Health > 90.0 && Armor > 90.0)
{
format(sString, sizeof(sString),"(News) %s has \"OWNED\" %s in the duel and has %.2f health and %.2f armor left!", zName,pName,Health,Armor);
SendClientMessageToAll(COLOR_ORANGE, sString);

g_GotInvitedToDuel[playerid] = 0;g_HasInvitedToDuel[playerid] = 0;g_IsPlayerDueling[playerid] = 0;
g_GotInvitedToDuel[killerid] = 0;g_HasInvitedToDuel[killerid] = 0;g_IsPlayerDueling[killerid] = 0;
g_DuelInProgress = 0;
return 1;
}
else
{
format(sString, sizeof(sString),"(News) %s has won the duel from %s and has %.2f health and %.2f armor left!", zName,pName,Health,Armor);
SendClientMessageToAll(COLOR_ORANGE, sString);

g_GotInvitedToDuel[playerid] = 0;g_HasInvitedToDuel[playerid] = 0;g_IsPlayerDueling[playerid] = 0;
g_GotInvitedToDuel[killerid] = 0;g_HasInvitedToDuel[killerid] = 0;g_IsPlayerDueling[killerid] = 0;
g_DuelInProgress = 0;
return 1;
}
}
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(duel,4,cmdtext);
dcmd(cduel,5,cmdtext);
dcmd(duelaccept,10,cmdtext);
return 1;
}
dcmd_cduel(playerid, params[])
{
#pragma unused params

if(g_HasInvitedToDuel[playerid] == 0)
return SendError(playerid, "You did not invite anyone to a duel!");

SendClientMessage(playerid, COLOR_YELLOW, "You have reset your duel invite, you can now use /duel [playerid] again.");
g_HasInvitedToDuel[playerid] = 0;

return 1;
}

dcmd_duelaccept(playerid, params[])
{
if(params[0] == '\0' || !IsNumeric(params))
return SendUsage(playerid, "/duelaccept [playerid]");

if(g_DuelInProgress == 1)
return SendError(playerid, "Another duel is in progress at the moment, wait till that duel is finished!");

new
DuelID = strvalEx(params),
pName[MAX_PLAYER_NAME],
zName[MAX_PLAYER_NAME],
tString[128];

if(DuelID != g_GotInvitedToDuel[playerid])
return SendError(playerid, "That player did not invite you to a duel!");

GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(DuelID, zName, MAX_PLAYER_NAME);

format(tString, sizeof(tString), "You accepted the duel with %s (ID:%d), duel will start in 10 seconds..",zName,DuelID);
SendClientMessage(playerid, COLOR_YELLOW, tString);

format(tString, sizeof(tString), "%s (ID:%d), accepted the duel with you, duel will start in 10 seconds..",pName,playerid);
SendClientMessage(DuelID, COLOR_YELLOW, tString);

format(tString, sizeof(tString), "(News) Duel between %s and %s will start in 10 seconds",pName,zName);
SendClientMessageToAll(COLOR_ORANGE, tString);

InitializeDuel(playerid);
InitializeDuelEx( DuelID);

g_IsPlayerDueling[playerid] = 1;
g_IsPlayerDueling[DuelID] = 1;

g_DuelingID1 = playerid;
g_DuelingID2 = DuelID;

g_DuelInProgress = 1;

return 1;
}

dcmd_duel(playerid, params[])
{
if(params[0] == '\0' || !IsNumeric(params))
return SendUsage(playerid, "/duel [playerid]");

if(g_HasInvitedToDuel[playerid] == 1)
return SendError(playerid, "You already invited someone to a duel! (Type, /cduel to reset your invite)");

new
DuelID = strvalEx(params),
pName[MAX_PLAYER_NAME],
zName[MAX_PLAYER_NAME],
tString[128];

GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(DuelID, zName, MAX_PLAYER_NAME);

if (!IsPlayerConnected(DuelID))
return SendError(playerid, "Player is not connected.");

if( g_HasInvitedToDuel[DuelID] == 1)
return SendError(playerid, "That player is already invited to a duel!");

if( DuelID == playerid)
return SendError(playerid, "You can not duel yourself!");

format(tString, sizeof(tString), "You invited %s (ID:%d) to a 1 on 1 duel, wait till %s accepts your invite.",zName, DuelID, zName);
SendClientMessage(playerid, COLOR_YELLOW, tString);

format(tString, sizeof(tString), "You got invited by %s (ID:%d) to a 1 on 1 duel, type /duelaccept [playerid] to accept and start the duel. ",pName, playerid);
SendClientMessage(DuelID, COLOR_YELLOW, tString);

g_GotInvitedToDuel[DuelID] = playerid;
g_HasInvitedToDuel[playerid] = 1;

return 1;
}

forward InitializeDuel(playerid);
public InitializeDuel(playerid)
{
g_DuelTimer[playerid] = SetTimerEx("DuelCountDown", 1000, 1, "i", playerid);

SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);

AddPlayerClass(0,2093.2373,2159.9622,10.8203,45.00 15,0,0,0,0,0,0); //
AddPlayerClass(0,2093.2373,2159.9622,10.8203,45.00 15,0,0,0,0,0,0); //
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 0);
g_DuelCountDown[playerid] = 11;

return 1;
}

forward InitializeDuelEx(playerid);
public InitializeDuelEx(playerid)
{
g_DuelTimer[playerid] = SetTimerEx("DuelCountDown", 1000, 1, "i", playerid);

SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);

AddPlayerClass(0,2069.1753,2184.6125,10.8203,225.4 598,0,0,0,0,0,0); //
AddPlayerClass(0,2069.1753,2184.6125,10.8203,225.4 598,0,0,0,0,0,0); //
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 0);
g_DuelCountDown[playerid] = 11;

return 1;
}

forward DuelCountDown(playerid);
public DuelCountDown(playerid)
{
new
tString[128] ;

g_DuelCountDown[playerid] --;

PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);

format(tString, sizeof(tString), "~w~%d", g_DuelCountDown[playerid]);
GameTextForPlayer(playerid, tString, 900, 3);

if(g_DuelCountDown[playerid] == 0)
{
KillTimer(g_DuelTimer[playerid]);
TogglePlayerControllable(playerid, 1);
GameTextForPlayer(playerid,"~g~GO GO GO", 900, 3);
return 1;
}

return 1;
}

strvalEx(xxx[])
{
if(strlen(xxx) > 9)
return 0;
return strval(xxx);
}

IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return false;
}
return true;

}

if (strcmp("/kill", cmdtext, true, 10) == 0}
{
SetPlayerHealth(playerid,0);

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

But help please
Reply
#2

pawn Код:
if (strcmp("/kill", cmdtext, true, 10) == 0}
{
SetPlayerHealth(playerid,0);
Fixed:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {
   if(strcmp("/kill", cmdtext, true) == 0) {
      SetPlayerHealth(playerid, 0);
      return 1;
   }
   // All of your other commands belong below this.
   return 0;
}
Reply
#3

If I added to the GM it just gives me extra errors...
Reply
#4

Remember use pastebin for big scripts.

Try remplacing your old "kill" comand for it:

pawn Код:
if(!strcmp("/kill", cmdtext, true))
    {
        SetPlayerHealth(playerid, 0);
        return 1;
    }
Reply
#5

here the good pawn http://pastebin.com/LuTh8AK8
Reply
#6

Still it don't work.. I have a duel script right under Onplayercommand.. Where do I paste it? Right under the onplayercommand or at the end of the duel script??
Reply
#7

Lol my /kill Sucks, Whenever you do it.. If youre the only one on server it works fine, If not, It Kills people Randomly XD
Reply
#8

Quote:
Originally Posted by Matthew_Johnston
Посмотреть сообщение
Lol my /kill Sucks, Whenever you do it.. If youre the only one on server it works fine, If not, It Kills people Randomly XD
lol ..

But anyone others can help me??
Reply
#9

niga thats easy here

Quote:

if(!strcmp("/kill", cmdtext, true))
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, 0xFF0000FF, "You used /kill");
return 1;
}

Reply
#10

on the end of the dual script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)