Jump to content
MakeWebGames

Gang surrenders to lose respect!


radio_active
 Share

Recommended Posts

Okay ive decided that im going to make it so if a gang declares war on another gang then surrenders to the gang they declared on they will lose 5 respect to surrender. If they surrender to a gang who declares war on them it will only cost 1 respect. So i came up with something like this which im 100% sure will not work. But im trying to get my head around it as i havnt done any coding in 2 months.

 

if($gangdata['gangID'] == $ir['warDECLARER'])
{
$rep = sprintf('UPDATE `gangs` set `gangrespect`=gangrespect-%u WHERE `gangid`=%u',5,$ir['gang']);
$repl = $db->query($rep);
}
else
{
$rep1 = sprintf('UPDATE `gangs` set `gangrespect`=gangrespect-%u WHERE `gangid`=%u',1,$ir['gang']);
$rep2 = $db->query($rep1);
}

 

The gang that receives the surrender will receive the respect that goes along with the surrender. Once i have this part worked out ill be able to do the second part by myself.

Any help is appreciated!

I will also give karma if its helpful xD

Thankyou

Link to comment
Share on other sites

Re: Gang surrenders to lose respect!

Problem ive hit at the moment is i need to make a variable $respect so in gang events it will say

----------------------------------------------------------

Gang surrendered to gang losing 5 respect.

Gang surrender to gang2 losing 1 respect.

Gang have asked to surrender losing 5 respect.

Gang have asked to surrender losing 1 respect

-----------------------------------------------------------

Any help here appreciated. Im not sure if the first post is going at it from the right direct. I need an array possible of 1 or 5 in the variable so i can put it into the text events.

Link to comment
Share on other sites

Re: Gang surrenders to lose respect!

Oo yah i forgot the $gangdata but i believe you need it on the gangID aswell as its searching for gangs through the gang field list.

As for the $respect = 5;

Well that would need the variable function being something like..

$rep = sprintf('SELECT `gangrespect` FROM `gangs` WHERE gangID = %u' ,$gangdata['gangID'] );

$respect= $db->query($rep);

So your defining what the variable is! So are you saying something like this?

 

$rep = sprintf('SELECT `gangrespect` FROM `gangs` WHERE  gangID = %u' ,$gangdata['gangID'] );
$respect= $db->query($rep);

if($gangdata['gangID'] == $gangdata['warDECLARER'])
{
$respect = +5;
}
else
{
$respect = +1;
}

$rep1 = sprintf('UPDATE `gangs` SET `gangsrespect`= %u WHERE  gangID = %u' ,$respect, $gangdata['gangID'] );
$respect1= $db->query($rep1);

 

Or along those lines..

What i stated in my previous post about inserting the variable into the words it would be..

Gang surrendered to gang losing $respect respect.

I think we are on the right track now =)

 

PS. on the line if($gangdata['gangID'] == $gangdata['warDECLARER']), i dont need the second $gangdata right? It could be something like this?

if($gangdata['gangID'] == ['warDECLARER']) as its alreaedy defined... So its like saying if GangID ==Wardeclarer?

Link to comment
Share on other sites

Re: Gang surrenders to lose respect!

I'm not 100% sure of what your wantning, I think i know.....What I was doing was trying to set a number to $respect..If all you needing ot do is send events to both gangs...just insert the event_add in each part of the code...

 

if($ir['gangID'] == $gangdata['warDECLARER'])
{
$rep = sprintf("UPDATE gangs set gangrespect = gang respecct - '%u' WHERE gangID = '%u' ",
   (5),
   ($ir['gang']));
       mysql_query($rep);

//event_add for gang getting repect
//event_add for gang losint respect
}
else
{
$rep = sprintf("UPDATE gangs SET gangrespect = gangrespect - '%u' WHERE gangID = '%u' ",
   (1),
   ($ir['gang']));
       mysql_query($rep);
//event add for gang getting respect
//event add fro gagn losing respect
}

Link to comment
Share on other sites

Re: Gang surrenders to lose respect!

if($ir['gang'] == $gangdata['warDECLARER'])

{

$rep = sprintf("UPDATE gangs set gangrespect = gang respecct - '%u' WHERE gangID = '%u' ",

(5),

($ir['gang']));

mysql_query($rep);

//event_add for gang getting repect

//event_add for gang losint respect

}

else

{

$rep = sprintf("UPDATE gangs SET gangrespect = gangrespect - '%u' WHERE gangID = '%u' ",

(1),

($ir['gang']));

mysql_query($rep);

//event add for gang getting respect

//event add fro gagn losing respect

}

Link to comment
Share on other sites

Re: Gang surrenders to lose respect!

So basically what i had in the first post accept with the event ads?

Ummmm okay this is what im wanting..

If GANG1 declares war on GANG2 and then GANG1 surrenders, it will cost them 5 respect to send a surrender and if GANG2 accepts the surrender, they will recieve 5 respect.

If GANG1 declares on GANG2 and GANG2 surrenders, it will cost GANG2 1 respect to send the surrender and GANG1 will get that respect point if they accept it.

So whoever declares war, it will cost them more respect if they surrender...Else it will only cost 1 respect for gangs to surrender being they didnt declare war on the gang they are surrendering to.

Link to comment
Share on other sites

Re: Gang surrenders to lose respect!

Yes, I think you where very close on the first post, minus couple typos....

I don't think this will do antying, lol

if($gangdata['gangID'] == $gangdata['warDECLARER'])

Thats why I changed it up some.....

But Yes, you where on right track. Just add that into your accept surrender function...Thne when they accept it it will take the respect...and send the events...I think what you had coded..will work....But there is only one way to see lol....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...