PDA

View Full Version : How to tell pawno to do nothing?


QatarKnight
28/07/2013, 12:34 PM
I have a piece of code:

CMD:god(playerid, params[])
{
if(playerinminigame[playerid] == 1)
{
SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
}
return 1;
}

I want to make it so if they're not in minigame they can use the command /god. In other words i want to tell pawno that if they're not any minigame it does nothing.

GuyYahood1
28/07/2013, 12:36 PM
Try:

CMD:god(playerid, params[])
{
if(playerinminigame[playerid]) return SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
//Here write what command do for they're not in minigame..
return 1;
}

QatarKnight
28/07/2013, 12:39 PM
Try:

CMD:god(playerid, params[])
{
if(playerinminigame[playerid]) return SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
//Here write what command do for they're not in minigame..
return 1;
}

The command /god is in the gamemode i want it to work if they're not in a minigame.

GuyYahood1
28/07/2013, 12:46 PM
CMD:god(playerid, params[])
{
if(playerinminigame[playerid]) return SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
//Here write what command do for they're not in minigame..
SetPlayerHealte(playerid, 1000); //For Example
return 1;
}
I signaled to you where you do the order, it will work only if they are not in minigame...
understood?

QatarKnight
28/07/2013, 12:55 PM
I signaled to you where you do the order, it will work only if they are not in minigame...
understood?

I want it to setplayerhealth to infinite but when i type that i get undefined symbol "infinite"

Konstantinos
28/07/2013, 12:56 PM
#define INFINITY (Float:0x7F800000)


// Somewhere:
SetPlayerHealth(playerid, INFINITY);

QatarKnight
28/07/2013, 12:58 PM
#define INFINITY (Float:0x7F800000)


// Somewhere:
SetPlayerHealth(playerid, INFINITY);


I get this also
C:\Users\New\Desktop\Current Server2\FunGaming Stunt-Freeroam\filterscripts\Event.pwn(2563) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Konstantinos
28/07/2013, 01:04 PM
Show the lines 2562, 2563, 2564. Are you sure, it's inside a callback?

QatarKnight
28/07/2013, 01:07 PM
Show the lines 2562, 2563, 2564. Are you sure, it's inside a callback?

CMD:god(playerid, params[])
{
if(playerinminigame[playerid] == 1)
{
SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
else SetPlayerHealth(playerid, INFINITY);
}
return 1;
}

Binx
28/07/2013, 01:24 PM
CMD:god(playerid, params[])
{
if(playerinminigame[playerid] == 1)
{
SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
else SetPlayerHealth(playerid, 99999);
}
return 1;
}

QatarKnight
28/07/2013, 01:28 PM
CMD:god(playerid, params[])
{
if(playerinminigame[playerid] == 1)
{
SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
else SetPlayerHealth(playerid, 99999);
}
return 1;
}

I still get assumed zero error.

Rillo
28/07/2013, 01:49 PM
CMD:god(playerid, params[])
{
if(playerinminigame[playerid] == 1) return SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
else SetPlayerHealth(playerid, INFINITY);
return 1;
}

Konstantinos
28/07/2013, 02:10 PM
CMD:god(playerid, params[])
{
if(playerinminigame[playerid] == 1)
{
SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
else SetPlayerHealth(playerid, INFINITY);
}
return 1;
}

You didn't close the "}" from the if statement, that's why. Just use:

CMD:god(playerid, params[])
{
if(playerinminigame[playerid] == 1) return SendClientMessage(playerid, -1, "You can't use any commands in a minigame.");
SetPlayerHealth(playerid, INFINITY);
return 1;
}